lanan-system/dl-module-base/src/main/resources/mapper/custom/CustomerMainMapper.xml

50 lines
2.1 KiB
XML
Raw Normal View History

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-01 17:23:57 +08:00
<select id="selectListPage" resultType="cn.iocoder.yudao.module.custom.vo.CustomerMainRespVO">
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-08-02 18:18:40 +08:00
group_concat(item.ser_content) AS serContents
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-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>
</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-01 14:15:40 +08:00
</mapper>