<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.jeecg.modules.basedata.mapper.FdCustomerMapper">

    <!-- 客户表和联系人表的连接查询 -->
    <select id="findByPage" resultType="org.jeecg.modules.basedata.entity.FdCustomer">
        SELECT
        f.contacts,
        f.telephone,
          f.id,
          `code`,
          `name`,
          short_name,
          abbreviation,
          fs.contact_psn as contactPsn,
          fs.contect_tel as telephone,
          fs.email,
          f.address,
          phone,tax_no,bank,account,
          `enable` FROM fd_customer as f
        LEFT JOIN fd_customer_contacts as fs
        on f.id=fs.pk_customer_id
        ${ew.customSqlSegment}
    </select>

    <!-- 添加联系人前查询客户ID -->
    <select id="Customer" resultType="org.jeecg.modules.basedata.entity.FdCustomer">
        select *from fd_customer
        where `name` like #{name}
        and del_flag ='0'
    </select>
</mapper>