liyong
2026-05-07 e4fa8e197d9998c964b69dc1195773e1db1b2233
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?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.ruoyi.basic.mapper.CustomerContactMapper">
 
    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.ruoyi.basic.pojo.CustomerContact">
        <id column="id" property="id" />
        <result column="contact_person" property="contactPerson" />
        <result column="contact_phone" property="contactPhone" />
        <result column="customer_id" property="customerId" />
        <result column="dept_id" property="deptId" />
        <result column="create_user" property="createUser" />
        <result column="create_time" property="createTime" />
        <result column="update_user" property="updateUser" />
        <result column="update_time" property="updateTime" />
        <result column="remark" property="remark" />
        <result column="del_flag" property="delFlag" />
    </resultMap>
    <select id="listPage" resultType="com.ruoyi.basic.dto.CustomerContactDto">
        SELECT
        cc.*,
        (
        SELECT GROUP_CONCAT(ci.customer_name SEPARATOR ',')
        FROM customer ci
        WHERE FIND_IN_SET(ci.id, cc.customer_id)
        ) AS customer_names
        FROM customer_contact cc
        <where>
            cc.del_flag = 0
            <if test="customerContactDto.contactPerson != null and customerContactDto.contactPerson !=''">
                and cc.contact_person = #{customerContactDto.contactPerson}
            </if>
            <if test="customerContactDto.contactPhone != null and customerContactDto.contactPhone !=''">
                and cc.contact_phone = #{customerContactDto.contactPhone}
            </if>
        </where>
    </select>
</mapper>