2024-08-01 14:15:40 +08:00
|
|
|
|
<?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="cn.iocoder.yudao.module.custom.mapper.CustomerMainMapper">
|
|
|
|
|
|
|
2024-08-01 17:23:57 +08:00
|
|
|
|
|
2024-08-01 14:15:40 +08:00
|
|
|
|
<!--
|
|
|
|
|
|
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
|
|
|
|
|
|
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
|
|
|
|
|
|
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
|
|
|
|
|
|
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
|
|
|
|
|
|
-->
|
2024-08-04 10:43:34 +08:00
|
|
|
|
<resultMap id="CustomerMainMap" type="cn.iocoder.yudao.module.custom.vo.CustomerMainRespVO">
|
|
|
|
|
|
<id column="id" property="id"/>
|
2024-08-07 12:00:49 +08:00
|
|
|
|
<id column="deptCode" property="deptCode"/>
|
2024-08-04 10:43:34 +08:00
|
|
|
|
<collection select="getAttn" property="attnList" javaType="list"
|
|
|
|
|
|
column="deptCode"
|
|
|
|
|
|
ofType="cn.iocoder.yudao.module.custom.entity.CustomerMain">
|
|
|
|
|
|
</collection>
|
|
|
|
|
|
</resultMap>
|
|
|
|
|
|
<select id="selectListPage" resultMap="CustomerMainMap">
|
2024-08-01 17:23:57 +08:00
|
|
|
|
SELECT
|
|
|
|
|
|
main.id AS id,
|
|
|
|
|
|
main.user_id AS userId,
|
|
|
|
|
|
main.type_code AS typeCode,
|
|
|
|
|
|
main.dept_code AS deptCode,
|
|
|
|
|
|
main.cus_name AS cusName,
|
|
|
|
|
|
main.phone_number AS phoneNumber,
|
|
|
|
|
|
main.birthday AS birthday,
|
|
|
|
|
|
main.address AS address,
|
|
|
|
|
|
main.sex AS sex,
|
|
|
|
|
|
main.id_card AS idCard,
|
|
|
|
|
|
main.id_card_image AS idCardImage,
|
|
|
|
|
|
main.data_from AS dataFrom,
|
|
|
|
|
|
main.near_do_time AS nearDoTime,
|
|
|
|
|
|
main.near_do_content AS nearDoContent,
|
|
|
|
|
|
main.inviter AS inviter,
|
|
|
|
|
|
main.inviter_type AS inviterType,
|
|
|
|
|
|
main.status AS status,
|
2024-09-20 15:59:50 +08:00
|
|
|
|
group_concat(item.ser_content) AS serContents,
|
|
|
|
|
|
memberLevel.name AS levelName
|
2024-08-01 17:23:57 +08:00
|
|
|
|
FROM
|
|
|
|
|
|
base_customer_main main
|
2024-08-02 18:18:40 +08:00
|
|
|
|
LEFT JOIN base_customer_item item ON main.id = item.cus_id AND item.deleted = 0
|
2024-09-20 15:59:50 +08:00
|
|
|
|
LEFT JOIN dl_member_level memberLevel ON main.member_level_id = memberLevel.id
|
2024-08-01 17:23:57 +08:00
|
|
|
|
<where>
|
|
|
|
|
|
main.deleted = 0
|
|
|
|
|
|
<if test="entity.cusName != null and entity.cusName != ''">
|
|
|
|
|
|
AND main.cus_name LIKE concat('%',#{entity.cusName},'%')
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="entity.typeCode != null and entity.typeCode != ''">
|
|
|
|
|
|
AND main.type_code = #{entity.typeCode}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="entity.systemCode != null and entity.systemCode != ''">
|
|
|
|
|
|
AND item.system_code = #{entity.systemCode}
|
|
|
|
|
|
</if>
|
2024-08-06 17:00:24 +08:00
|
|
|
|
<if test="entity.phoneNumber != null and entity.phoneNumber != ''">
|
2024-08-07 15:28:20 +08:00
|
|
|
|
AND main.phone_number LIKE concat('%',#{entity.phoneNumber},'%')
|
2024-08-06 17:00:24 +08:00
|
|
|
|
</if>
|
2024-08-01 17:23:57 +08:00
|
|
|
|
</where>
|
2024-08-02 18:18:40 +08:00
|
|
|
|
GROUP BY main.id
|
2024-08-01 17:23:57 +08:00
|
|
|
|
ORDER BY main.create_time DESC
|
|
|
|
|
|
</select>
|
2024-08-04 10:43:34 +08:00
|
|
|
|
<select id="getAttn" resultType="cn.iocoder.yudao.module.custom.entity.CustomerMain">
|
2024-09-19 19:46:07 +08:00
|
|
|
|
SELECT main.id AS id,
|
|
|
|
|
|
main.user_id AS userId,
|
|
|
|
|
|
main.type_code AS typeCode,
|
|
|
|
|
|
main.dept_code AS deptCode,
|
|
|
|
|
|
main.cus_name AS cusName,
|
|
|
|
|
|
main.phone_number AS phoneNumber,
|
|
|
|
|
|
main.birthday AS birthday,
|
|
|
|
|
|
main.address AS address,
|
|
|
|
|
|
main.sex AS sex,
|
|
|
|
|
|
main.id_card AS idCard,
|
|
|
|
|
|
main.id_card_image AS idCardImage,
|
|
|
|
|
|
main.data_from AS dataFrom,
|
|
|
|
|
|
main.near_do_time AS nearDoTime,
|
|
|
|
|
|
main.near_do_content AS nearDoContent,
|
|
|
|
|
|
main.inviter AS inviter,
|
|
|
|
|
|
main.inviter_type AS inviterType,
|
|
|
|
|
|
main.status AS status
|
|
|
|
|
|
FROM base_customer_main main
|
|
|
|
|
|
where main.dept_code = #{deptCode}
|
|
|
|
|
|
and main.deleted = 0
|
|
|
|
|
|
and main.type_code = '04'
|
2024-08-04 10:43:34 +08:00
|
|
|
|
ORDER BY main.create_time DESC
|
|
|
|
|
|
</select>
|
2024-08-01 14:15:40 +08:00
|
|
|
|
</mapper>
|