<?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="com.dsk.system.mapper.ContactInfoMapper">

    <select id="selectPageList" resultType="com.dsk.system.domain.customer.vo.ContactInfoListVo">
        select
            cc.id, cc.customer_id, cc.business_id, bi.project_name, cc.name, cc.sex, cc.role,
            cc.position, cc.contact_information, cc.company_id, cc.uip_id, cc.company_name, cc.remark,
            cc.update_by
        from contact_info cc
        left join business_info bi on cc.business_id = bi.id
        <where>
            <if test="customerId != null and customerId !='' "> and (cc.customer_id = #{customerId} or bi.customer_id = #{customerId})</if>
            <if test="businessId != null "> and cc.business_id = #{businessId} </if>
        </where>
        order by cc.create_time desc
    </select>

</mapper>

