134 lines
8.4 KiB
XML
134 lines
8.4 KiB
XML
<?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.ibs.list.mapper.SysCustAppointSupplementMapper">
|
|
|
|
|
|
<select id="selectCustDeptUserGridListTab" parameterType="custDeptUserGrid" resultType="CustDeptUserGrid">
|
|
select id, dept_id, user_id, user_name, grid_id, grid_name, cust_id, cust_idc,cust_name, cust_phone,dept_name,grid_name2,outlets,ops_dept
|
|
from cust_dept_user_grid_${log3}
|
|
<where>
|
|
<if test="deptId != null ">and dept_id in
|
|
(select dept_id from sys_dept where dept_id = #{deptId} or find_in_set(#{deptId},ancestors))</if>
|
|
<if test="userId != null ">and user_id = #{userId}</if>
|
|
<if test="userName != null and userName != ''">and user_name like concat('%', #{userName}, '%')</if>
|
|
<if test="gridId != null ">and grid_id = #{gridId}</if>
|
|
<if test="gridName != null and gridName != ''">and grid_name like concat('%', #{gridName}, '%')</if>
|
|
<if test="custId != null and custId != ''">and cust_id = #{custId}</if>
|
|
<if test="custIdc != null and custIdc != ''">and cust_idc = #{custIdc}</if>
|
|
<if test="custName != null and custName != ''">and cust_name like concat('%', #{custName}, '%')</if>
|
|
<if test="custPhone != null and custPhone != ''">and cust_phone = #{custPhone}</if>
|
|
<if test="deptName != null and deptName != ''">and dept_name like concat('%', #{deptName}, '%')</if>
|
|
<if test="gridName2 != null and gridName2 != ''">and grid_name2 like concat('%', #{gridName2}, '%')</if>
|
|
<if test="outlets != null and outlets != ''">and outlets like concat('%', #{outlets}, '%')</if>
|
|
<if test="tellerId != null and tellerId != ''">and teller_id = #{tellerId}</if>
|
|
<if test="opsDept != null and opsDept != ''">and ops_dept = #{opsDept}</if>
|
|
</where>
|
|
</select>
|
|
|
|
|
|
<select id="selectGridInfoTsByGridIds" resultType="GridInfoTs">
|
|
|
|
select distinct gdur.grid_id,gdur.user_name ,gdur.relate_dept_id,gdsr.shape_id,dsc.cust_id,dsc.cust_name,su.user_id
|
|
from grid_draw_user_relate gdur
|
|
inner join grid_draw_shape_relate gdsr on gdsr.grid_id = gdur.grid_id
|
|
inner join draw_shape_cust_${log3} dsc on dsc.shape_id = gdsr.shape_id
|
|
left join sys_user su on su.user_name = gdur.user_name
|
|
where gdur.grid_id in
|
|
<foreach item="id" collection="gridIds" open="(" separator="," close=")">
|
|
#{id}
|
|
</foreach>
|
|
|
|
</select>
|
|
|
|
<select id="selectSysCampaignGroupCustomerList" parameterType="SysCampaignGroupCustomer" resultType="SysCampaignGroupCustomer">
|
|
select id, cust_id, campaign_id, group_id, dept_id, user_id, create_by, create_time, update_by, update_time, remark, del_flag, grid_id, list_type, push_status, org_claim_status, org_distribute_status, cust_claim_status,create_role, grid_name, grid_name2, outlets,cust_idc,second_push_status,social_credit_code,cust_phone,outlets_id
|
|
from sys_campaign_group_customer scgc
|
|
left join sys_campaign_group_customer_supplement scgcs
|
|
on scgcs.cust_id = scgc.cust_id and scgcs.campaign_id = scgc.campaign_id
|
|
where
|
|
scgc.push_status != '1' and scgcs.cust_id is null
|
|
order by scgc.create_time desc
|
|
</select>
|
|
|
|
<select id="selectVirtualCustUserList" resultType="VirtualCustUser">
|
|
select id, grid_id, cust_id, user_name, nick_name, relate_dept_id, relate_dept_name,su.user_id
|
|
from grid_virtual_cust_user_${log3} gvcu
|
|
left join sys_user su on su.user_name = gvcu.user_name
|
|
<where>
|
|
<if test="gridId != null and gridId != ''">
|
|
and grid_id = #{gridId}
|
|
</if>
|
|
<if test="custId != null and custId != ''">
|
|
and cust_id = #{custId}
|
|
</if>
|
|
<if test="relateDeptId != null and relateDeptId != ''">
|
|
and relate_dept_id in (select dept_id from sys_dept where dept_id = #{relateDeptId} or find_in_set(#{relateDeptId},ancestors))
|
|
</if>
|
|
</where>
|
|
|
|
</select>
|
|
|
|
<select id="selectSysCampaignVoList" resultType="SysCampaign">
|
|
select id, campaign_name, campaign_id, dept_id, user_id, create_by, create_time, update_by, update_time, start_time, end_time,
|
|
campaign_degree, remark, del_flag, campaign_type, claim_type, distribute_type, distribute_type2, distribute_type3,
|
|
distribute_cont, distribute_cont2, distribute_cont3,claim_start_time,
|
|
claim_end_time, executer, create_role, group_id, second_push_status, task_type, check_target, task_index, reward, feed_back, cust_type
|
|
from sys_campaign
|
|
<where>
|
|
<if test="createRole != null and createRole != ''"> and create_role = #{createRole}</if>
|
|
<if test="timeNow != null"> and #{timeNow} >= start_time and #{timeNow} <= end_time</if>
|
|
<if test="deptId != null and deptId != ''"> and dept_id = #{deptId}</if>
|
|
<if test="custType != null and custType != ''"> and cust_type = #{custType}</if>
|
|
</where>
|
|
</select>
|
|
|
|
|
|
|
|
<select id="selectCustDeptUserCmpmList" parameterType="CustDeptUserCmpm" resultType="CustDeptUserCmpm">
|
|
select id, dept_id, dept_name, outlets, outlets_id, user_id, user_name, nick_name, cust_id, cust_type, cust_name, cust_idc, code_no_level1, code_value_level1, code_no_level2,
|
|
code_value_level2 from cust_dept_user_cmpm_${log3}
|
|
<where>
|
|
<if test="deptId != null "> and dept_id = #{deptId}</if>
|
|
<if test="deptName != null and deptName != ''"> and dept_name like concat('%', #{deptName}, '%')</if>
|
|
<if test="outlets != null and outlets != ''"> and outlets = #{outlets}</if>
|
|
<if test="outletsId != null and outletsId != ''"> and outlets_id = #{outletsId}</if>
|
|
<if test="userId != null "> and user_id = #{userId}</if>
|
|
<if test="userName != null and userName != ''"> and user_name like concat('%', #{userName}, '%')</if>
|
|
<if test="nickName != null and nickName != ''"> and nick_name like concat('%', #{nickName}, '%')</if>
|
|
<if test="custId != null and custId != ''"> and cust_id = #{custId}</if>
|
|
<if test="custType != null and custType != ''"> and cust_type = #{custType}</if>
|
|
<if test="custName != null and custName != ''"> and cust_name like concat('%', #{custName}, '%')</if>
|
|
<if test="custIdc != null and custIdc != ''"> and cust_idc = #{custIdc}</if>
|
|
<if test="codeNoLevel1 != null and codeNoLevel1 != ''"> and code_no_level1 = #{codeNoLevel1}</if>
|
|
<if test="codeValueLevel1 != null "> and code_value_level1 = #{codeValueLevel1}</if>
|
|
<if test="codeNoLevel2 != null and codeNoLevel2 != ''"> and code_no_level2 = #{codeNoLevel2}</if>
|
|
<if test="codeValueLevel2 != null "> and code_value_level2 = #{codeValueLevel2}</if>
|
|
</where>
|
|
</select>
|
|
|
|
|
|
<insert id="insertSysCampaignGroupCustomerBatch" parameterType="java.util.List" useGeneratedKeys="true" keyProperty="id">
|
|
insert into sys_campaign_group_customer_supplement
|
|
(cust_id,campaign_id,group_id,dept_id,user_id,create_by,create_time,update_by,
|
|
update_time,remark,del_flag,grid_id,list_type,push_status,org_claim_status,org_distribute_status,cust_claim_status,create_role,grid_name,
|
|
grid_name2,outlets,cust_idc,second_push_status,social_credit_code,cust_phone,outlets_id,push_user_level)
|
|
values
|
|
<foreach collection="list" item="item" index="index" separator=",">
|
|
(#{item.custId},#{item.campaignId},#{item.groupId},#{item.deptId},#{item.userId},#{item.createBy},sysdate(),
|
|
#{item.updateBy},#{item.updateTime},#{item.remark},#{item.delFlag},#{item.gridId},#{item.listType},#{item.pushStatus},
|
|
#{item.orgClaimStatus},#{item.orgDistributeStatus},#{item.custClaimStatus},#{item.createRole},#{item.gridName},
|
|
#{item.gridName2},#{item.outlets},#{item.custIdc},#{item.secondPushStatus},#{item.socialCreditCode},#{item.custPhone},#{item.outletsId},#{item.pushUserLevel})
|
|
|
|
</foreach>
|
|
</insert>
|
|
|
|
<update id="updateSysCampaignGroupCustomerSupplementDeleteFlag">
|
|
update sys_campaign_group_customer_supplement set del_flag = '1'
|
|
where campaign_id = #{campaignId} and cust_id = #{custId}
|
|
</update>
|
|
|
|
|
|
|
|
|
|
</mapper>
|