This commit is contained in:
wkc
2026-02-26 14:51:13 +08:00
commit acd6c38ae2
2102 changed files with 320452 additions and 0 deletions

View File

@@ -0,0 +1,485 @@
<?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.cmpm.mapper.GridCmpmMapper">
<select id="selectManageList" resultType="GridCmpm">
select *
from grid_cmpm_${gridType}
where user_name is not null
<if test="branchId != null">and branch_id = #{branchId}</if>
<if test="outletId != null">and outlet_id = #{outletId}</if>
<if test="curUserName != null and curUserName !='' ">and user_name = #{curUserName}</if>
<if test="custId != null and custId !='' ">and cust_id like concat('%',#{custId},'%') </if>
<if test="custName != null and custName !='' ">and cust_name like concat('%',#{custName},'%')</if>
<if test="userName != null and userName !='' ">and user_name like concat('%',#{userName},'%')</if>
<if test="custTypes != null and custTypes.size() > 0 ">
and cust_type in
<foreach item="custType" collection="custTypes" open="(" separator="," close=")">
#{custType}
</foreach>
</if>
<if test="custLevels != null and custLevels.size() > 0 ">
and cust_level in
<foreach item="custLevel" collection="custLevels" open="(" separator="," close=")">
#{custLevel}
</foreach>
</if>
order by cust_level desc, user_name
</select>
<select id="selectCommonList" resultType="GridCmpm">
select *
from grid_cmpm_${gridType} gc
where gc.user_name is null
and not exists (
select 1 from grid_cmpm_transfer
where transfer_status != '3' and transfer_status != '-1'
and cust_id = gc.cust_id
<if test="gridType == 'corporate_account'">
and account_no = gc.account_no
</if>
)
<if test="branchId != null">and (gc.branch_id = #{branchId} or gc.branch_id is null)</if>
<if test=" custId != null and custId !='' ">and gc.cust_id like concat('%',#{custId},'%') </if>
<if test="custName != null and custName !='' ">and gc.cust_name like concat('%',#{custName},'%')</if>
<if test="userName != null and userName !='' ">and gc.user_name like concat('%',#{userName},'%')</if>
<if test="custTypes != null and custTypes.size() > 0 ">
and gc.cust_type in
<foreach item="custType" collection="custTypes" open="(" separator="," close=")">
#{custType}
</foreach>
</if>
<if test="custLevels != null and custLevels.size() > 0 ">
and gc.cust_level in
<foreach item="custLevel" collection="custLevels" open="(" separator="," close=")">
#{custLevel}
</foreach>
</if>
order by gc.cust_level desc
</select>
<select id="getCustLevel" resultType="String">
select cust_level from grid_cmpm_${gridType}
<where>
<if test="custId != null and custId !='' ">and cust_id = #{custId}</if>
<if test="accountNo != null and accountNo !='' ">and account_no = #{accountNo}</if>
</where>
</select>
<select id="getGridCmpmByCustKey" resultType="GridCmpm">
select * from grid_cmpm_${gridType}_${deptCode}
where cust_id = #{custId}
<if test="userName != null and userName !='' ">and user_name = #{userName}</if>
<if test="userName == null"> and user_name is null</if>
<if test="gridType == 'corporate_account'">and account_no = #{accountNo}</if>
</select>
<select id="queryGridCmpmByCustKey" resultType="GridCmpm">
select * from grid_cmpm_${gridType}_${deptCode}
where cust_id in
<foreach item="custId" collection="custIds" open="(" separator="," close=")">
#{custId}
</foreach>
<if test="accountNos != null and accountNos.size() > 0'">
and account_no in
<foreach item="accountNo" collection="accountNos" open="(" separator="," close=")">
#{accountNo}
</foreach>
</if>
</select>
<select id="getGridCmpmByUserName" resultType="GridCmpm">
select * from grid_cmpm_${gridType}_${deptCode} gc
where gc.user_name = #{userName}
and not exists (
select 1 from grid_cmpm_transfer
where (transfer_status != '3' and transfer_status != '-1')
and cust_id = gc.cust_id
<if test="gridType == 'corporate_account'">
and account_no = gc.account_no
</if>
)
</select>
<update id="updateGridCmpm">
update grid_cmpm_${gridType}_${deptCode}
set user_name = #{userName},
nick_name = #{nickName},
outlet_id = #{outletId},
outlet_name = #{outletName},
branch_id = #{branchId},
branch_name = #{branchName},
source = '手动指定',
lock_flag = '1'
where cust_id = #{custId} and user_name = #{prevUserName}
<if test="gridType == 'corporate_account'">
and account_no = #{accountNo}
</if>
</update>
<select id="getAllCustLevel" resultType="String">
select distinct cust_level from grid_cmpm_${gridType} where cust_level is not null order by cust_level;
</select>
<select id="queryClaimList" resultType="GridCmpmClaimVO">
select gc.cust_name, gc.cust_type, gc.cust_id, gc.account_no, gc.user_name, gc.nick_name
from grid_cmpm_${gridType}_${deptCode} gc
where gc.user_name is not null
<if test="custKey != null and custKey !='' ">
and (gc.cust_id like concat('%',#{custKey},'%')
or gc.account_no like concat('%',#{custKey},'%')
or gc.cust_name like concat('%',#{custKey},'%'))
</if>
</select>
<select id="getCustManagerList" resultType="DwbRetailCustLevelManagerDetailVO">
select id, outlet_id, outlet_name, branch_id, branch_name, cust_name, cust_idc, cust_isn, cust_age, cust_sex, cust_phone, cust_address, cust_aum_bal,
aum_bal_comp_lm, cust_aum_month_avg, cust_level, cust_level_comp_lm, manager_name, manager_id
from dwb_retail_cust_level_manager_detail
<where>
<if test="managerId != null and managerId !='' ">and manager_id = #{managerId}</if>
<if test="outletId != null and outletId !='' ">and outlet_id = #{outletId}</if>
<if test="branchId != null and branchId !='' ">and branch_id = #{branchId}</if>
</where>
</select>
<select id="getCustLevelCount" resultType="Integer">
select count(1)
from dwb_retail_cust_level_manager_detail
<where>
<if test="custLevel != null and custLevel !='' ">and cust_level = #{custLevel}</if>
<if test="managerId != null and managerId !='' ">and manager_id = #{managerId}</if>
<if test="outletId != null and outletId !='' ">and outlet_id = #{outletId}</if>
<if test="branchId != null and branchId !='' ">and branch_id = #{branchId}</if>
</where>
</select>
<select id="selectCustInfoFromGridCmpm" resultType="CustBaseInfo">
select a.* from
<if test="custPattern == 0">
cust_info_retail a
</if>
<if test="custPattern == 1">
cust_info_merchant a
</if>
<if test="custPattern == 2">
cust_info_business a
</if>
where a.cust_id in (
<if test="custPattern == 0">
select distinct cust_id from grid_cmpm_retail
where user_name = #{cmpmUserName}
<if test="custLevel != null and custLevel !='' ">and cust_level = #{custLevel}</if>
</if>
<if test="custPattern == 1">
select distinct cust_id from grid_cmpm_corporate
where user_name = #{cmpmUserName} and cust_type = '1'
<if test="custLevel != null and custLevel !='' ">and cust_level = #{custLevel}</if>
union all
select distinct cust_id from grid_cmpm_corporate_account
where user_name = #{cmpmUserName} and cust_type = '1'
<if test="custLevel != null and custLevel !='' ">and cust_level = #{custLevel}</if>
</if>
<if test="custPattern == 2">
select distinct cust_id from grid_cmpm_corporate
where user_name = #{cmpmUserName} and cust_type = '2'
<if test="custLevel != null and custLevel !='' ">and cust_level = #{custLevel}</if>
union all
select distinct cust_id from grid_cmpm_corporate_account
where user_name = #{cmpmUserName} and cust_type = '2'
<if test="custLevel != null and custLevel !='' ">and cust_level = #{custLevel}</if>
</if>
)
<if test="custId != null and custId !='' ">and a.cust_id like concat('%',#{custId},'%') </if>
<if test="custName != null and custName !='' ">and a.cust_name like concat('%',#{custName},'%')</if>
<if test="regionTopGridIds != null and regionTopGridIds.size() > 0 ">
AND a.cust_id IN (
SELECT cust_id
FROM grid_region_cust_user grcu
<where>
<if test="regionTopGridIds != null and regionTopGridIds.size()>0">
<foreach collection="regionTopGridIds" item="param" separator="or">
grcu.top_grid_id = #{param.value}
</foreach>
</if>
)
</where>
</if>
<if test="regionSecGridIds != null and regionSecGridIds.size()>0">
AND a.cust_id IN (
SELECT cust_id
FROM grid_region_cust_user grcu
<where>
<foreach collection="regionSecGridIds" item="param" separator="or">
grcu.sec_grid_id = #{param.value}
</foreach>
</where>
)
</if>
<if test="virtualGridIds != null and virtualGridIds.size() > 0 ">
AND a.cust_id IN (
SELECT cust_id
FROM grid_virtual_cust_user gvcu
<where>
<foreach collection="virtualGridIds" item="param" separator="or">
gvcu.grid_id = #{param.value}
</foreach>
</where>
)
</if>
<if test="drawGridIds != null and drawGridIds.size() > 0 ">
AND a.cust_id IN (
SELECT dsc.cust_id
FROM grid_draw_user_relate gdur
INNER JOIN grid_draw_shape_relate gdsr ON gdur.grid_id = gdsr.grid_id
INNER JOIN draw_shape_cust dsc ON gdsr.shape_id = dsc.shape_id
<where>
<foreach collection="drawGridIds" item="param" separator="or">
gdur.grid_id = #{param.value}
</foreach>
</where>
)
</if>
<if test="continuousParams != null and continuousParams.size() > 0 or discreteParams != null and discreteParams.size() > 0">
<if test="continuousParams != null and continuousParams.size() > 0">
and
<foreach collection="continuousParams" item="param" separator="and">
<choose>
<when test="param.value[0] != null and param.value[0] != '' and param.value[1] != null and param.value[1] != ''">
CAST(${param.key} AS DECIMAL(10,2)) BETWEEN CAST(#{param.value[0]} AS DECIMAL(10,2)) AND CAST(#{param.value[1]} AS DECIMAL(10,2))
</when>
<when test="param.value[0] != null and param.value[0] != ''">
CAST(${param.key} AS DECIMAL(10,2)) &gt;= CAST(#{param.value[0]} AS DECIMAL(10,2))
</when>
<when test="param.value[1] != null and param.value[1] != ''">
CAST(${param.key} AS DECIMAL(10,2)) &lt;= CAST(#{param.value[1]} AS DECIMAL(10,2))
</when>
</choose>
</foreach>
</if>
<if test="discreteParams != null and discreteParams.size() > 0">
and
<foreach collection="discreteParams" item="param" separator="and">
${param.key} = #{param.value}
</foreach>
</if>
</if>
<if test="custTag != null and custTag != ''"> and
((CASE WHEN substr(#{custTag}, 1, 1) = '1' THEN substr(a.cust_tag, 1, 1) = '1' end)
OR (CASE WHEN substr(#{custTag}, 2, 1) = '1' THEN substr(a.cust_tag, 2, 1) = '1' end)
OR (CASE WHEN substr(#{custTag}, 3, 1) = '1' THEN substr(a.cust_tag, 3, 1) = '1' end))
</if>
<if test="custScale != null and custScale != ''">
and ( a.cust_scale = '5'
<if test="
custScale0 != null and custScale0 != ''">or a.cust_scale = #{custScale0}</if>
<if test="
custScale1 != null and custScale1 != ''">or a.cust_scale = #{custScale1}</if>
<if test="
custScale2 != null and custScale2 != ''">or a.cust_scale = #{custScale2}</if>
<if test="
custScale3 != null and custScale3 != ''">or a.cust_scale = #{custScale3}</if>
)
</if>
limit #{start},#{size}
</select>
<select id="queryCustInfoFromGridCmpm" resultType="CustBaseInfo">
select a.* from
<if test="custPattern == 0">
cust_info_retail a
</if>
<if test="custPattern == 1">
cust_info_merchant a
</if>
<if test="custPattern == 2">
cust_info_business a
</if>
where a.cust_id in (
<if test="custPattern == 0">
select distinct cust_id from grid_cmpm_retail
where user_name is not null
and cust_type = '0'
<if test="cmpmBranchId != null">and branch_id = #{cmpmBranchId}</if>
<if test="cmpmOutletId != null">and outlet_id = #{cmpmOutletId}</if>
<if test="cmpmUserName != null">and user_name = #{cmpmUserName}</if>
<if test="custLevel != null and custLevel !='' ">and cust_level = #{custLevel}</if>
</if>
<if test="custPattern == 1">
select distinct cust_id from grid_cmpm_retail
where user_name is not null
and cust_type = '1'
<if test="cmpmBranchId != null">and branch_id = #{cmpmBranchId}</if>
<if test="cmpmOutletId != null">and outlet_id = #{cmpmOutletId}</if>
<if test="cmpmUserName != null">and user_name = #{cmpmUserName}</if>
<if test="custLevel != null and custLevel !='' ">and cust_level = #{custLevel}</if>
</if>
<if test="custPattern == 2">
select distinct cust_id from grid_cmpm_corporate
where user_name is not null
<if test="cmpmBranchId != null">and branch_id = #{cmpmBranchId}</if>
<if test="cmpmOutletId != null">and outlet_id = #{cmpmOutletId}</if>
<if test="cmpmUserName != null">and user_name = #{cmpmUserName}</if>
<if test="custLevel != null and custLevel !='' ">and cust_level = #{custLevel}</if>
</if>
)
<if test="custId != null and custId !='' ">and a.cust_id like concat('%',#{custId},'%') </if>
<if test="custName != null and custName !='' ">and a.cust_name like concat('%',#{custName},'%')</if>
<if test="regionTopGridIds != null and regionTopGridIds.size() > 0 ">
AND a.cust_id IN (
SELECT cust_id
FROM grid_region_cust_user grcu
<where>
<if test="regionTopGridIds != null and regionTopGridIds.size()>0">
<foreach collection="regionTopGridIds" item="param" separator="or">
grcu.top_grid_id = #{param.value}
</foreach>
</if>
)
</where>
</if>
<if test="regionSecGridIds != null and regionSecGridIds.size()>0">
AND a.cust_id IN (
SELECT cust_id
FROM grid_region_cust_user grcu
<where>
<foreach collection="regionSecGridIds" item="param" separator="or">
grcu.sec_grid_id = #{param.value}
</foreach>
</where>
)
</if>
<if test="virtualGridIds != null and virtualGridIds.size() > 0 ">
AND a.cust_id IN (
SELECT cust_id
FROM grid_virtual_cust_user gvcu
<where>
<foreach collection="virtualGridIds" item="param" separator="or">
gvcu.grid_id = #{param.value}
</foreach>
</where>
)
</if>
<if test="drawGridIds != null and drawGridIds.size() > 0 ">
AND a.cust_id IN (
SELECT dsc.cust_id
FROM grid_draw_user_relate gdur
INNER JOIN grid_draw_shape_relate gdsr ON gdur.grid_id = gdsr.grid_id
INNER JOIN draw_shape_cust dsc ON gdsr.shape_id = dsc.shape_id
<where>
<foreach collection="drawGridIds" item="param" separator="or">
gdur.grid_id = #{param.value}
</foreach>
</where>
)
</if>
<if test="continuousParams != null and continuousParams.size() > 0 or discreteParams != null and discreteParams.size() > 0">
<if test="continuousParams != null and continuousParams.size() > 0">
and
<foreach collection="continuousParams" item="param" separator="and">
<choose>
<when test="param.value[0] != null and param.value[0] != '' and param.value[1] != null and param.value[1] != ''">
CAST(${param.key} AS DECIMAL(10,2)) BETWEEN CAST(#{param.value[0]} AS DECIMAL(10,2)) AND CAST(#{param.value[1]} AS DECIMAL(10,2))
</when>
<when test="param.value[0] != null and param.value[0] != ''">
CAST(${param.key} AS DECIMAL(10,2)) &gt;= CAST(#{param.value[0]} AS DECIMAL(10,2))
</when>
<when test="param.value[1] != null and param.value[1] != ''">
CAST(${param.key} AS DECIMAL(10,2)) &lt;= CAST(#{param.value[1]} AS DECIMAL(10,2))
</when>
</choose>
</foreach>
</if>
<if test="discreteParams != null and discreteParams.size() > 0">
and
<foreach collection="discreteParams" item="param" separator="and">
${param.key} = #{param.value}
</foreach>
</if>
</if>
<if test="custTag != null and custTag != ''"> and
((CASE WHEN substr(#{custTag}, 1, 1) = '1' THEN substr(a.cust_tag, 1, 1) = '1' end)
OR (CASE WHEN substr(#{custTag}, 2, 1) = '1' THEN substr(a.cust_tag, 2, 1) = '1' end)
OR (CASE WHEN substr(#{custTag}, 3, 1) = '1' THEN substr(a.cust_tag, 3, 1) = '1' end))
</if>
<if test="custScale != null and custScale != ''">
and ( a.cust_scale = '5'
<if test="
custScale0 != null and custScale0 != ''">or a.cust_scale = #{custScale0}</if>
<if test="
custScale1 != null and custScale1 != ''">or a.cust_scale = #{custScale1}</if>
<if test="
custScale2 != null and custScale2 != ''">or a.cust_scale = #{custScale2}</if>
<if test="
custScale3 != null and custScale3 != ''">or a.cust_scale = #{custScale3}</if>
)
</if>
limit #{start},#{size}
</select>
<select id="getCustManagerResult" resultType="DwbRetailResultVO">
select
sum(cust_aum_bal) as cust_aum_bal,
sum(aum_bal_comp_lm) as aum_bal_comp_lm,
sum(cust_aum_month_avg) as cust_aum_month_avg,
sum(cust_aum_month_avg_lm) as cust_aum_month_avg_lm
from dwb_retail_cust_level_manager_detail_875
<where>
<if test="managerId != null and managerId !='' ">and manager_id = #{managerId}</if>
<if test="outletId != null and outletId !='' ">and outlet_id = #{outletId}</if>
<if test="branchId != null and branchId !='' ">and branch_id = #{branchId}</if>
</where>
</select>
<select id="getCustLevelList" resultType="String">
select distinct
cust_level
from dwb_retail_cust_level_manager_detail_875
</select>
<select id="getCustCountByLevel" resultType="int">
select count(1)
from dwb_retail_cust_level_manager_detail_875
<where>
<if test="dto.managerId != null and dto.managerId !='' ">and manager_id = #{dto.managerId}</if>
<if test="dto.outletId != null and dto.outletId !='' ">and outlet_id = #{dto.outletId}</if>
<if test="dto.branchId != null and dto.branchId !='' ">and branch_id = #{dto.branchId}</if>
<!-- 根据 time 参数动态判断字段 -->
<if test="time == 'now' and dto.custLevel != null and dto.custLevel != ''">
and cust_level = #{dto.custLevel}
</if>
<if test="time == 'last' and dto.custLevel != null and dto.custLevel != ''">
and cust_level_lm = #{dto.custLevel}
</if>
</where>
</select>
<select id="selectDeptListByRole" resultType="java.lang.String">
<choose>
<when test="role == 'outlet'">
select distinct outlet_id
from dwb_retail_cust_level_manager_detail_875
where outlet_id is not null
</when>
<when test="role == 'branch'">
select distinct branch_id
from dwb_retail_cust_level_manager_detail_875
where branch_id is not null
</when>
<otherwise>
<!-- 其他角色返回一个具体值,例如 'default_dept' -->
select 'head' as dept_id from dual
</otherwise>
</choose>
</select>
<select id="selectManagerList" resultType="java.lang.String">
select distinct manager_id
from dwb_retail_cust_level_manager_detail_875
where manager_id is not null
</select>
</mapper>

View File

@@ -0,0 +1,37 @@
<?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.cmpm.mapper.GridCmpmRetailMapper">
<select id="getGridCmpmRetailByCustId" resultType="GridCmpmRetail">
select * from grid_cmpm_retail_${deptCode} where cust_id = #{custId}
</select>
<select id="getGridCmpmRetailByUserName" resultType="GridCmpmRetail">
select * from grid_cmpm_retail_${deptCode} gcr
where gcr.user_name = #{userName}
and not exists (
select 1 from grid_cmpm_transfer
where (transfer_status != '3' or transfer_status != '-1') and cust_id = gcr.cust_id
)
</select>
<update id="updateGridCmpmRetail">
update grid_cmpm_retail_${deptCode}
set user_name = #{userName},
nick_name = #{nickName},
outlet_id = #{outletId},
outlet_name = #{outletName},
branch_id = #{branchId},
branch_name = #{branchName},
source = '1',
lock_flag = '1'
where cust_id = #{custId}
</update>
<select id="getAllCustLevel" resultType="String">
select distinct cust_level from grid_cmpm_retail;
</select>
</mapper>

View File

@@ -0,0 +1,94 @@
<?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.cmpm.mapper.GridCmpmTransferMapper">
<select id="getGridCmpmTransferList" resultType="GridCmpmTransferVO">
select gct.* , concat(prev.nick_name , gct.prev_user_name)as prev_user,
concat(next.nick_name, gct.next_user_name) as next_user
from grid_cmpm_transfer gct
left join sys_user prev on gct.prev_user_name = prev.user_name
left join sys_user next on gct.next_user_name = next.user_name
where (gct.transfer_status != '3' and gct.transfer_status != '-1') and head_id = #{headId}
<if test="gridType != null and gridType != ''">
and gct.grid_type = #{gridType}
</if>
<if test="keyword != null and keyword != ''">
and (gct.cust_name like concat('%',#{keyword},'%') or gct.cust_id like concat('%',#{keyword},'%') or gct.account_no like concat('%',#{keyword},'%'))
</if>
<if test="userRole != null and userRole == 'outlet'">
and gct.transfer_status = '0' and gct.prev_outlet_id = #{deptId}
</if>
<if test="userRole != null and userRole == 'branch'">
and gct.transfer_status = '1' and gct.prev_branch_id = #{deptId}
</if>
<if test="userRole != null and userRole == 'private' ">
and gct.transfer_status = '2' and gct.grid_type = 'retail'
</if>
<if test="userRole != null and userRole == 'public'">
and gct.transfer_status = '2' and gct.grid_type like 'corporate%'
</if>
<if test="userRole != null and userRole == 'head'">
and gct.transfer_status = '2'
</if>
<if test="userRole != null and userRole == 'manager'">
and gct.prev_user_name = #{userName}
</if>
order by gct.update_time desc
</select>
<select id="getGridCmpmTransferHistoryList" resultType="GridCmpmTransferVO">
select gct.* , concat(prev.nick_name , gct.prev_user_name)as prev_user,
concat(next.nick_name, gct.next_user_name) as next_user
from grid_cmpm_transfer gct
left join sys_user prev on gct.prev_user_name = prev.user_name
left join sys_user next on gct.next_user_name = next.user_name
where head_id = #{headId}
<if test="gridType != null and gridType != ''">
and gct.grid_type = #{gridType}
</if>
<if test="keyword != null and keyword != ''">
and (gct.cust_name like concat('%',#{keyword},'%') or gct.cust_id like concat('%',#{keyword},'%') or gct.account_no like concat('%',#{keyword},'%'))
</if>
<if test="userRole != null and userRole == 'outlet'">
and (gct.prev_outlet_id = #{deptId} or gct.next_outlet_id = #{deptId})
</if>
<if test="userRole != null and userRole == 'branch'">
and (gct.prev_branch_id = #{deptId} or gct.next_branch_id = #{deptId})
</if>
<if test="userRole != null and userRole == 'private'">
and gct.grid_type = 'retail'
</if>
<if test="userRole != null and userRole == 'public'">
and gct.grid_type like 'corporate%'
</if>
<if test="userRole != null and userRole == 'manager'">
and (gct.prev_user_name = #{userName} or gct.next_user_name = #{userName})
</if>
order by gct.update_time desc
</select>
<select id="checkExistTransferCust" resultType="Long">
select count(*) from grid_cmpm_transfer
where transfer_status != '3' and transfer_status != '-1'
and (cust_id = #{custKey} or account_no = #{custKey})
<if test="userName != null and userName != ''">
and prev_user_name = #{userName}
</if>
<if test="userName == null">
and prev_user_name is null
</if>
</select>
<insert id="batchInsert" parameterType="List">
INSERT INTO grid_cmpm_transfer (transfer_label, transfer_type, transfer_status, grid_type, head_id, cust_type, cust_name, cust_id, account_no, prev_user_name, prev_outlet_id, prev_branch_id,
next_user_name, next_outlet_id, next_branch_id, create_time, update_time)
VALUES
<foreach collection="gridCmpmTransferList" item="transfer" separator=",">
(#{transfer.transferLabel}, #{transfer.transferType}, #{transfer.transferStatus}, #{transfer.gridType}, #{transfer.headId}, #{transfer.custName}, #{transfer.custId}, #{transfer.accountNo},
#{transfer.prevUserName}, #{transfer.prevOutletId}, #{transfer.prevBranchId}, #{transfer.nextUserName}, #{transfer.nextOutletId}, #{transfer.nextBranchId}, current_timestamp(), current_timestamp())
</foreach>
</insert>
</mapper>

View File

@@ -0,0 +1,53 @@
<?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.cmpm.mapper.VisitCustReachMapper">
<select id="queryVisitCust" resultType="VisitCustReachVO">
select gcr.cust_id, gcr.cust_name, gcr.cust_idn, gcr.mobile,
vcr.id, vcr.tel_plan_date, vcr.tel_plan_remark, vcr.tel_summary_date, vcr.tel_summary_remark, vcr.visit_plan_date, vcr.visit_plan_remark, vcr.visit_summary_date,
vcr.visit_summary_remark
from grid_cmpm_retail gcr
left join (select * from visit_cust_reach where submit_flag = '0' and create_by = #{userName} ) vcr on gcr.cust_id = vcr.cust_id
where
(
gcr.user_name = #{userName}
or
(gcr.user_name is null and gcr.branch_id is null)
<if test="branchId != null">
or
(gcr.user_name is null and gcr.branch_id = #{branchId})
</if>
)
<if test="custName != null and custName != ''">
and gcr.cust_name = #{custName}
</if>
</select>
<select id="queryVisitCustReachList" resultType="VisitCustReachListVO">
select vcr.*, concat(su.nick_name,'-', vcr.create_by) as nick_name, (vcr.create_by = #{editUserName} and submit_flag = 0) as edit_flag
from visit_cust_reach vcr
left join sys_user su on su.user_name = vcr.create_by
where 1=1
<if test="aliasUserName != null and aliasUserName != ''">
and vcr.create_by = #{aliasUserName}
</if>
<if test="userName != null and userName != ''">
and vcr.create_by like concat('%',#{userName},'%')
</if>
<if test="custName != null and custName != ''">
and vcr.cust_name like concat('%',#{custName},'%')
</if>
<if test="deptId != null">
and vcr.dept_id in (select dept_id from sys_dept where dept_id = #{deptId} or find_in_set(#{deptId},ancestors))
</if>
order by vcr.create_time desc
</select>
<select id="queryVisitCustReachListByCustId" resultType="VisitCustReachListVO">
select vcr.*, concat(su.nick_name,'-', vcr.create_by) as nick_name
from visit_cust_reach vcr
left join sys_user su on su.user_name = vcr.create_by
where vcr.cust_id = #{custId}
order by vcr.create_time desc
</select>
</mapper>