2026-03-18 16:39:23 +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="com.ruoyi.group.mapper.CustGroupMemberMapper">
|
|
|
|
|
|
|
|
|
|
|
|
<select id="selectCustGroupMemberList" resultType="CustGroupMemberVO">
|
|
|
|
|
|
SELECT
|
|
|
|
|
|
cgm.id,
|
|
|
|
|
|
cgm.group_id,
|
|
|
|
|
|
cgm.cust_type,
|
|
|
|
|
|
cgm.cust_id,
|
|
|
|
|
|
cgm.cust_name,
|
|
|
|
|
|
cgm.cust_idc,
|
|
|
|
|
|
cgm.social_credit_code,
|
2026-04-07 18:58:11 +08:00
|
|
|
|
cgm.user_name,
|
|
|
|
|
|
cgm.nick_name,
|
|
|
|
|
|
cgm.outlet_id,
|
|
|
|
|
|
cgm.outlet_name,
|
|
|
|
|
|
cgm.branch_id,
|
|
|
|
|
|
cgm.branch_name,
|
2026-03-18 16:39:23 +08:00
|
|
|
|
cgm.create_time
|
|
|
|
|
|
FROM ibs_cust_group_member cgm
|
|
|
|
|
|
<where>
|
|
|
|
|
|
cgm.group_id = #{groupId}
|
|
|
|
|
|
AND cgm.del_flag = '0'
|
|
|
|
|
|
<if test="dto != null and dto.custType != null and dto.custType != ''">
|
|
|
|
|
|
AND cgm.cust_type = #{dto.custType}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="dto != null and dto.custName != null and dto.custName != ''">
|
|
|
|
|
|
AND cgm.cust_name LIKE CONCAT('%', #{dto.custName}, '%')
|
|
|
|
|
|
</if>
|
2026-04-07 18:58:11 +08:00
|
|
|
|
<if test="dto != null and dto.userName != null and dto.userName != ''">
|
|
|
|
|
|
AND cgm.user_name = #{dto.userName}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="dto != null and dto.nickName != null and dto.nickName != ''">
|
|
|
|
|
|
AND cgm.nick_name LIKE CONCAT('%', #{dto.nickName}, '%')
|
|
|
|
|
|
</if>
|
2026-03-18 16:39:23 +08:00
|
|
|
|
</where>
|
|
|
|
|
|
ORDER BY cgm.create_time ASC
|
|
|
|
|
|
</select>
|
|
|
|
|
|
|
2026-04-07 18:58:11 +08:00
|
|
|
|
<!-- 批量查询个人客户是否存在 -->
|
|
|
|
|
|
<select id="selectExistingRetailCustIds" resultType="String">
|
|
|
|
|
|
SELECT DISTINCT t.cust_id
|
|
|
|
|
|
FROM ibs_cust_group_member t
|
|
|
|
|
|
INNER JOIN cust_info_retail c ON t.cust_id = c.cust_id AND t.cust_idc = c.cust_idc
|
|
|
|
|
|
WHERE t.del_flag = '0'
|
|
|
|
|
|
AND t.cust_type = '0'
|
|
|
|
|
|
AND t.cust_id IN
|
|
|
|
|
|
<foreach collection="list" item="item" open="(" separator="," close=")">
|
|
|
|
|
|
#{item}
|
|
|
|
|
|
</foreach>
|
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 批量查询商户客户是否存在 -->
|
|
|
|
|
|
<select id="selectExistingMerchantCustIds" resultType="String">
|
|
|
|
|
|
SELECT DISTINCT t.cust_id
|
|
|
|
|
|
FROM ibs_cust_group_member t
|
|
|
|
|
|
INNER JOIN cust_info_merchant c ON t.cust_id = c.cust_id AND t.social_credit_code = c.social_credit_code
|
|
|
|
|
|
WHERE t.del_flag = '0'
|
|
|
|
|
|
AND t.cust_type = '1'
|
|
|
|
|
|
AND t.cust_id IN
|
|
|
|
|
|
<foreach collection="list" item="item" open="(" separator="," close=")">
|
|
|
|
|
|
#{item}
|
|
|
|
|
|
</foreach>
|
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 批量查询企业客户是否存在 -->
|
|
|
|
|
|
<select id="selectExistingBusinessCustIds" resultType="String">
|
|
|
|
|
|
SELECT DISTINCT t.cust_id
|
|
|
|
|
|
FROM ibs_cust_group_member t
|
|
|
|
|
|
INNER JOIN cust_info_business c ON t.cust_id = c.cust_id AND t.social_credit_code = c.social_credit_code
|
|
|
|
|
|
WHERE t.del_flag = '0'
|
|
|
|
|
|
AND t.cust_type = '2'
|
|
|
|
|
|
AND t.cust_id IN
|
|
|
|
|
|
<foreach collection="list" item="item" open="(" separator="," close=")">
|
|
|
|
|
|
#{item}
|
|
|
|
|
|
</foreach>
|
|
|
|
|
|
</select>
|
|
|
|
|
|
|
2026-03-18 16:39:23 +08:00
|
|
|
|
<!-- 批量插入客群客户(INSERT IGNORE,遇到重复键自动跳过) -->
|
|
|
|
|
|
<insert id="batchInsertMembers">
|
|
|
|
|
|
INSERT IGNORE INTO ibs_cust_group_member
|
2026-04-07 18:58:11 +08:00
|
|
|
|
(group_id, cust_type, cust_id, cust_name, cust_idc, social_credit_code,
|
|
|
|
|
|
user_name, nick_name, outlet_id, outlet_name, branch_id, branch_name,
|
|
|
|
|
|
create_by, create_time, del_flag, manual_remove)
|
2026-03-18 16:39:23 +08:00
|
|
|
|
VALUES
|
|
|
|
|
|
<foreach collection="list" item="item" index="index" separator=",">
|
2026-04-07 18:58:11 +08:00
|
|
|
|
(#{item.groupId}, #{item.custType}, #{item.custId}, #{item.custName}, #{item.custIdc}, #{item.socialCreditCode},
|
|
|
|
|
|
#{item.userName}, #{item.nickName}, #{item.outletId}, #{item.outletName}, #{item.branchId}, #{item.branchName},
|
|
|
|
|
|
#{item.createBy}, NOW(), '0', '0')
|
2026-03-18 16:39:23 +08:00
|
|
|
|
</foreach>
|
|
|
|
|
|
</insert>
|
|
|
|
|
|
|
|
|
|
|
|
</mapper>
|