liyong
2026-05-07 1492ffd32e43d0294cc6ac9a4f4389cd50d91fe9
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_name" property="contactName" />
        <result column="phone" property="phone" />
        <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.contactName != null and customerContactDto.contactName !=''">
                and cc.contact_name = #{customerContactDto.contactName}
            </if>
            <if test="customerContactDto.phone != null and customerContactDto.phone !=''">
                and cc.phone = #{customerContactDto.phone}
            </if>
        </where>
    </select>
</mapper>