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,271 @@
<?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.task.mapper.AppointmentMapper">
<resultMap type="com.ruoyi.ibs.task.domain.entity.AppointmentInfo" id="AppointmentInfoResult">
<result property="id" column="id" />
<result property="custIdc" column="cust_idc" />
<result property="custName" column="cust_name" />
<result property="belongUserId" column="belong_user_id" />
<result property="startTime" column="start_time" />
<result property="completeTime" column="complete_time" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="prodCode" column="prod_code" />
<result property="prodName" column="prod_name" />
<result property="userName" column="user_name" />
<result property="nickName" column="nick_name" />
</resultMap>
<sql id="selectAppointmentInfoVo">
select id, cust_idc, cust_name, belong_user_id, start_time, complete_time, create_by, create_time, belong_user_id, prod_code, prod_name, user_name, nick_name, cust_type from appointment_info
</sql>
<select id="selectAppointmentByCustIdc" parameterType="AppointmentInfo" resultMap="AppointmentInfoResult">
<include refid="selectAppointmentInfoVo"/>
<where>
<if test="custIdc != null and custIdc != ''">
and cust_idc = #{custIdc}
</if>
and NOW() BETWEEN start_time AND complete_time
</where>
</select>
<select id="selectUnClaimListByCustIdc" parameterType="AppointmentInfo" resultMap="AppointmentInfoResult">
<include refid="selectAppointmentInfoVo"/>
<where>
<if test="custIdc != null and custIdc != ''">
and cust_idc = #{custIdc}
</if>
and (belong_user_id is null or belong_user_id = '')
and (prod_code is not null and prod_code != '')
and (prod_name is not null and prod_name != '')
</where>
</select>
<select id="selectAppointmentListByUserName" parameterType="AppointmentInfo" resultMap="AppointmentInfoResult">
<include refid="selectAppointmentInfoVo"/>
<where>
<if test="userRole == 'branch' ">
and dept_id = #{deptId}
</if>
<if test="userRole == 'outlet' ">
and outlets_id = #{outletId}
</if>
<if test="userRole == 'manager' ">
and user_name = #{userName}
</if>
<if test="userRole == 'public' ">
and cust_type = '2'
</if>
<if test="userRole == 'private' ">
and cust_type != '2'
</if>
and (prod_code is null or prod_code = '')
and (prod_name is null or prod_name = '')
</where>
order by create_time
</select>
<select id="selectClaimListByUserName" parameterType="AppointmentInfo" resultMap="AppointmentInfoResult">
select cust_idc, cust_name, cust_type,
complete_time, user_name, nick_name
from appointment_info
<where>
<if test="userRole == 'branch' ">
and dept_id = #{deptId}
</if>
<if test="userRole == 'outlet' ">
and outlets_id = #{outletId}
</if>
<if test="userRole == 'manager' ">
and user_name = #{userName}
</if>
<if test="userRole == 'public' ">
and cust_type = '2'
</if>
<if test="userRole == 'private' ">
and cust_type != '2'
</if>
and (user_name is not null and user_name != '')
and (prod_code is not null and prod_code != '')
and (prod_name is not null and prod_name != '')
</where>
group by cust_idc, cust_name, cust_type,complete_time, user_name, nick_name
order by complete_time
</select>
<select id="selectDictValueByDictLabel" parameterType="String" resultType="String">
select
CASE
WHEN count(1) &gt; 0
then max(dict_value)
ELSE '7'
END AS dict_value
FROM sys_dict_data
<where>
<if test="dictLabel != null and dictLabel != ''">
and dict_label = #{dictLabel}
</if>
and dict_type = 'appointment_duration'
</where>
</select>
<select id="selectAllProds" resultType="com.ruoyi.ibs.task.domain.vo.ProductInfoVO">
select
CONCAT(code_no_level1, '_', code_no_level2) AS prodCode,
code_value_level2 AS prodName
from
cmpm_code
</select>
<select id="selectCustProdDetail" resultType="com.ruoyi.ibs.task.domain.vo.ProductInfoVO">
select
prod_code,
prod_name
from
appointment_info
<where>
<if test="custIdc != null and custIdc != ''">
and cust_idc = #{custIdc}
</if>
and (prod_code is not null and prod_code != '')
and (prod_name is not null and prod_name != '')
</where>
</select>
<select id="selectClaimCustDetail" resultType="com.ruoyi.ibs.task.domain.vo.ProductInfoVO">
select
prod_code,
prod_name
from
appointment_info
<where>
<if test="userName != null and userName != ''">
and user_name = #{userName}
</if>
<if test="custIdc != null and custIdc != ''">
and cust_idc = #{custIdc}
</if>
and (prod_code is not null and prod_code != '')
and (prod_name is not null and prod_name != '')
</where>
</select>
<insert id="insertAppointment" parameterType="AppointmentInfo">
insert into appointment_info(
<if test="id != null and id != 0">id,</if>
<if test="custIdc != null and custIdc != ''">cust_idc,</if>
<if test="custName != null and custName != ''">cust_name,</if>
<if test="custType != null and custType != ''">cust_type,</if>
<if test="belongUserId != null and belongUserId != ''">belong_user_id,</if>
<if test="startTime != null">start_time,</if>
<if test="completeTime != null">complete_time,</if>
<if test="prodCode != null">prod_code,</if>
<if test="prodName != null">prod_name,</if>
<if test="userName != null">user_name,</if>
<if test="nickName != null">nick_name,</if>
<if test="createBy != null">create_by,</if>
<if test="deptId != null">dept_id,</if>
<if test="outletId != null">outlets_id,</if>
create_time
)values(
<if test="id != null and id != 0">#{id},</if>
<if test="custIdc != null and custIdc != ''">#{custIdc},</if>
<if test="custName != null and custName != ''">#{custName},</if>
<if test="custType != null and custType != ''">#{custType},</if>
<if test="belongUserId != null and belongUserId != ''">#{belongUserId},</if>
<if test="startTime != null">#{startTime},</if>
<if test="completeTime != null">#{completeTime},</if>
<if test="prodCode != null">#{prodCode},</if>
<if test="prodName != null">#{prodName},</if>
<if test="userName != null">#{userName},</if>
<if test="nickName != null">#{nickName},</if>
<if test="createBy != null">#{createBy},</if>
<if test="deptId != null">#{deptId},</if>
<if test="outletId != null">#{outletId},</if>
sysdate()
)
</insert>
<update id="updateAppointment" parameterType="AppointmentInfo">
update appointment_info
<trim prefix="SET" suffixOverrides=",">
<if test="belongUserId != null and belongUserId != ''">belong_user_id = #{belongUserId},</if>
<if test="outletId != null and outletId != ''">outlets_id = #{outletId},</if>
<if test="deptId != null and deptId != ''">dept_id = #{deptId},</if>
<if test="userName != null and userName != ''">user_name = #{userName},</if>
<if test="nickName != null and nickName != ''">nick_name = #{nickName},</if>
complete_time = sysdate(),
</trim>
where cust_idc = #{custIdc}
and (user_name is null or user_name = '')
</update>
<insert id="secondVisit">
insert into second_visit(
<if test="custId != null and custId != ''">cust_id,</if>
<if test="custName != null and custName != ''">cust_name,</if>
<if test="custType != null and custType != ''">cust_type,</if>
<if test="fromUserName != null">from_user_name,</if>
<if test="fromNickName != null">from_nick_name,</if>
<if test="toUserName != null">to_user_name,</if>
<if test="toNickName != null">to_nick_name,</if>
<if test="secondVisitTime != null">second_visit_time,</if>
<if test="applyRemark != null">apply_remark,</if>
<if test="approvalRemark != null">approval_remark,</if>
<if test="createBy != null">create_by,</if>
create_time
)values(
<if test="custId != null and custId != ''">#{custId},</if>
<if test="custName != null and custName != ''">#{custName},</if>
<if test="custType != null and custType != ''">#{custType},</if>
<if test="fromUserName != null">#{fromUserName},</if>
<if test="fromNickName != null">#{fromNickName},</if>
<if test="toUserName != null">#{toUserName},</if>
<if test="toNickName != null">#{toNickName},</if>
<if test="secondVisitTime != null">#{secondVisitTime},</if>
<if test="applyRemark != null">#{applyRemark},</if>
<if test="approvalRemark != null">#{approvalRemark},</if>
<if test="createBy != null">#{createBy},</if>
sysdate()
)
</insert>
<update id="updateSecondVisitReadTime">
update second_visit
set read_time = sysdate()
where from_user_name = #{userName} and second_visit_time is not null
</update>
<select id="selectTodaySecondVisits" resultType="SecondVisitVO">
select id, cust_id, cust_name, cust_type, from_user_name, from_nick_name, second_visit_time, read_time
from second_visit
where second_visit_time is not null
and from_user_name = #{userName}
and second_visit_time = #{today}
</select>
<update id="updateResourceAssistReadTime">
update second_visit
set read_time = sysdate()
where to_user_name = #{userName} and second_visit_time is null
</update>
<select id="selectResourceAssistList" resultType="SecondVisitVO">
select id, cust_id, cust_name, cust_type, from_user_name, from_nick_name, to_user_name, to_nick_name, apply_remark, approval_remark, status, read_time, create_by
from second_visit
where second_visit_time is null
and (from_user_name = #{userName} or to_user_name = #{userName})
</select>
<update id="resourceAssistFeedback">
update second_visit
set status = #{status},
approval_remark = #{approvalRemark},
update_by = #{updateBy},
update_time = #{updateTime}
where id = #{id}
</update>
</mapper>

View File

@@ -0,0 +1,869 @@
<?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.customerselect.mapper.CustInfoBusinessMapper">
<resultMap type="CustInfoBusiness" id="CustInfoBusinessResult">
<result property="id" column="id" />
<result property="custType" column="cust_type" />
<result property="custTag" column="cust_tag" />
<result property="custScale" column="cust_scale" />
<result property="custName" column="cust_name" />
<result property="lpName" column="lp_name" />
<result property="custPhone" column="cust_phone" />
<result property="custId" column="cust_id" />
<result property="custIsn" column="cust_isn" />
<result property="custCapital" column="cust_capital" />
<result property="custLocation" column="cust_location" />
<result property="loanTag" column="loan_tag" />
<result property="status" column="status" />
<result property="belongBranchId" column="belong_branch_id" />
<result property="belongBranchName" column="belong_branch_name" />
<result property="belongOutletId" column="belong_outlet_id" />
<result property="belongOutletName" column="belong_outlet_name" />
<result property="belongUserId" column="belong_user_id" />
<result property="belongUserName" column="belong_user_name" />
<result property="belongUserNameList" column="belong_user_name_list" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="regionCode" column="region_code" />
<result property="socialCreditCode" column="social_credit_code" />
<result property="tel" column="tel" />
<result property="registerLocation" column="register_location" />
<result property="businessScope" column="business_scope" />
<result property="taxpayerIdentificationNumber" column="taxpayer_identification_number" />
<result property="taxpayerQualification" column="taxpayer_qualification" />
<result property="label" column="label" />
<result property="industry" column="industry" />
<result property="custIdc" column="cust_idc" />
<result property="custAge" column="cust_age" />
<result property="custGender" column="cust_gender" />
<result property="birthday" column="birthday" />
<result property="recordStatus" column="record_status" />
<result property="asset" column="asset" />
<result property="credit" column="credit" />
</resultMap>
<resultMap type="CustInfoBusiness" id="CustInfoBusinessResult2">
<result property="id" column="id" />
<result property="custType" column="cust_type" />
<result property="custTag" column="cust_tag" />
<result property="custScale" column="cust_scale" />
<result property="custName" column="cust_name" />
<result property="lpName" column="lp_name" />
<result property="custPhone" column="cust_phone" />
<result property="custId" column="cust_id" />
<result property="custIsn" column="cust_isn" />
<result property="custCapital" column="cust_capital" />
<result property="custLocation" column="cust_location" />
<result property="loanTag" column="loan_tag" />
<result property="status" column="status" />
<result property="belongBranchId" column="belong_branch_id" />
<result property="belongBranchName" column="dept_name" />
<result property="belongOutletId" column="belong_outlet_id" />
<result property="belongOutletName" column="outlets" />
<result property="belongUserId" column="belong_user_id" />
<result property="belongUserName" column="belong_user_name" />
<result property="belongUserNameList" column="belong_user_name_list" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="regionCode" column="region_code" />
<result property="socialCreditCode" column="social_credit_code" />
<result property="tel" column="tel" />
<result property="registerLocation" column="register_location" />
<result property="businessScope" column="business_scope" />
<result property="taxpayerIdentificationNumber" column="taxpayer_identification_number" />
<result property="taxpayerQualification" column="taxpayer_qualification" />
<result property="label" column="label" />
<result property="industry" column="industry" />
<result property="custIdc" column="cust_idc" />
<result property="custAge" column="cust_age" />
<result property="custGender" column="cust_gender" />
<result property="birthday" column="birthday" />
</resultMap>
<resultMap type="CustManageInfo" id="CustManageInfoResult">
<result property="custId" column="cust_id" />
<result property="custName" column="cust_name" />
<result property="custNo" column="social_credit_code" />
<result property="belongUserId" column="user_name" />
<result property="belongUserName" column="nick_name" />
<result property="custPattern" column="cust_type" />
<result property="regionCode" column="region_code" />
</resultMap>
<sql id="selectCustInfoBusinessVo">
select id, cust_type, cust_tag, cust_scale, cust_name, lp_name, cust_phone, cust_id, cust_isn, cust_capital, cust_location, loan_tag, status, belong_branch_id, belong_branch_name, belong_outlet_id, belong_outlet_name, belong_user_id, belong_user_name, create_by, create_time, update_by, update_time, region_code, social_credit_code, tel,
register_location, business_scope, taxpayer_identification_number, taxpayer_qualification, label, industry, cust_idc,cust_age,cust_gender,birthday,record_status from cust_info_business
</sql>
<select id="selectCustInfoBusinessList" parameterType="CustInfoBusiness" resultMap="CustInfoBusinessResult2">
SELECT a.id, a.cust_type, a.cust_tag, a.cust_scale, a.cust_name, a.lp_name,
a.cust_phone, a.cust_id, a.cust_isn,a.loan_tag,a.cust_capital,
GROUP_CONCAT(b.dept_name SEPARATOR ',') as dept_name,
GROUP_CONCAT(b.outlets SEPARATOR ',') as outlets,
a.cust_idc,GROUP_CONCAT(b.user_name SEPARATOR ',') as belong_user_name_list
from cust_info_business a
<if test="opsDept != null and opsDept != ''">
inner </if>
<if test="opsDept == null or opsDept == ''">
left </if>
join (select user_name,user_id,dept_id,cust_id,dept_name,outlets from
(select concat_ws('-',user_name,teller_id) as user_name,user_id,dept_id,cust_id,dept_name,outlets from cust_dept_user_grid
<where>
<if test="opsDept != null and opsDept != ''">
ops_dept = #{opsDept}</if>
</where>
union
(select '', t2.user_id,t2.dept_id,t2.cust_id,'','' from cust_dept_user_cmpm t2
left join (select cust_id from cust_dept_user_grid
<where>
<if test="opsDept != null and opsDept != ''">
ops_dept = #{opsDept}</if>
</where>
group by cust_id)t1 on t2.cust_id = t1.cust_id
where (t1.cust_id is null or t1.cust_id = '') and t2.cust_type = '2' and t2.dept_id is not null)) f
where 1=1
<if test = "isHead == false">
${params.dataScope}
</if>
) b on a.cust_id = b.cust_id
<where>
<if test = "isHead == false">
b.user_id>0
</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="custName != null and custName != ''"> and a.cust_name like concat('%', #{custName}, '%') </if>
<if test="custType != null and custType != ''"> and a.cust_type = #{custType}</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>
</where>
group by a.cust_id,a.id
limit #{start},#{size}
</select>
<select id="selectCustInfoBusinessListHead" parameterType="CustInfoBusiness" resultType="com.ruoyi.ibs.customerselect.domain.CustBaseInfo">
SELECT a.id, a.cust_type, a.cust_tag, a.cust_scale, a.cust_name, a.lp_name,
a.cust_phone, a.cust_id, a.cust_isn,a.loan_tag,a.cust_capital,a.asset,a.credit,
null as dept_name,
null as outlets,
a.cust_idc,null as belong_user_name_list,
a.hq_cur_balance, a.bz_cur_balance, a.is_credit,
a.loan_balance_cny, a.loan_year_dailyaverage, a.is_htqy, a.finance_prod_716_open_flag, a.finance_prod_716_balance,
a.finance_prod_711_open_flag, a.finance_prod_711_balance, a.intl_bussiness_jcbh_open_flag, a.is_ustr,
a.ustr_count_per_m, a.ustr_bal_m, a.eleccharge_sign_flag, a.watercharge_sign_flag, a.taxdeduction_sign_flag,
a.pjb, a.czb, a.sfb, a.mrb, a.szst, a.is_open_sts, a.intl_bussiness_open_flag, a.intl_bussiness_325_open_flag,
a.is_365zf,a.is_180zf,a.is_90zf,a.is_30zf, a.cust_level
from cust_info_business a
<where>
<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="custName != null and custName != ''"> and a.cust_name like concat('%', #{custName}, '%') </if>
<if test="custId != null and custId != ''"> and a.cust_id like concat('%', #{custId}, '%') </if>
<if test="custType != null and custType != ''"> and a.cust_type = #{custType}</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>
</where>
group by a.cust_id,a.id
limit #{start},#{size}
</select>
<select id="selectCustInfoBusinessListOps" parameterType="CustInfoBusiness" resultType="com.ruoyi.ibs.customerselect.domain.CustBaseInfo">
SELECT distinct a.id, a.cust_type, a.cust_tag, a.cust_scale, a.cust_name, a.lp_name,
a.cust_phone, a.cust_id, a.cust_isn,a.loan_tag,a.cust_capital,a.asset,a.credit,
null as dept_name,
null as outlets,
a.cust_idc,null as belong_user_name_list,
a.hq_cur_balance, a.bz_cur_balance, a.is_credit,
a.loan_balance_cny, a.loan_year_dailyaverage, a.is_htqy, a.finance_prod_716_open_flag, a.finance_prod_716_balance,
a.finance_prod_711_open_flag, a.finance_prod_711_balance, a.intl_bussiness_jcbh_open_flag, a.is_ustr,
a.ustr_count_per_m, a.ustr_bal_m, a.eleccharge_sign_flag, a.watercharge_sign_flag, a.taxdeduction_sign_flag,
a.pjb, a.czb, a.sfb, a.mrb, a.szst, a.is_open_sts, a.intl_bussiness_open_flag, a.intl_bussiness_325_open_flag,
a.is_365zf,a.is_180zf,a.is_90zf,a.is_30zf, a.cust_level
from cust_info_business a
<if test="isSelectGrid == false">
inner join (select user_id,dept_id,cust_id from
(select user_id,dept_id,cust_id,outlets_id from cust_dept_user_grid
<where>
<if test="opsDept != null and opsDept != ''">
ops_dept = #{opsDept}</if>
</where>
union all
(select t2.user_id,t2.dept_id,t2.cust_id,t2.outlets_id from cust_dept_user_cmpm t2
where t2.cust_type = '2' and t2.dept_id is not null)
) f
where 1=1
<if test="deptId != null ">
and f.dept_id in (select dept_id from sys_dept where dept_id = #{deptId} or find_in_set(#{deptId},ancestors))
</if>
<if test="outletsId != null ">
and f.outlets_id in (select dept_id from sys_dept where dept_id = #{outletsId} or find_in_set(#{outletsId},ancestors))
</if>
<if test="userId != null ">
and f.user_id = #{userId}</if>
) b on a.cust_id = b.cust_id
</if>
<where>
<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>
<if test="userName != null ">
and gvcu.user_name = #{userName}
</if>
</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="custName != null and custName != ''"> and a.cust_name like concat('%', #{custName}, '%') </if>
<if test="custId != null and custId != ''"> and a.cust_id like concat('%', #{custId}, '%') </if>
<if test="custType != null and custType != ''"> and a.cust_type = #{custType}</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>
</where>
group by a.cust_id,a.id
limit #{start},#{size}
</select>
<select id="selectCustInfoBusinessList_COUNT" resultType="Long">
select -1
</select>
<select id="getBusinessNumByDeptId" parameterType="Long" resultType="java.lang.Long">
select count(distinct a.cust_id) from cust_info_business a
inner join (select distinct code, grid_id
from grid_region_admin_division_relate
where delete_flag = '0') b
on b.code = a.region_code
inner join (select distinct grid_id from grid_region_user_relate where delete_flag ='0' and parent_grid_id is null
and relate_dept_id in (select dept_id from sys_dept where dept_id = #{headDeptId} or find_in_set(#{headDeptId},ancestors))) c
on b.grid_id =c.grid_id
</select>
<select id="getBusinessNumByUserId" parameterType="String" resultType="java.lang.Long">
select count(distinct a.cust_id) from cust_info_business a
inner join (select distinct code, grid_id
from grid_region_admin_division_relate
where delete_flag = '0'
and ops_dept != '0') b
on b.code = a.region_code
inner join (select distinct grid_id, user_name, delete_flag
from grid_region_user_relate
where delete_flag = '0'
and parent_grid_id is not null) c
on b.grid_id = c.grid_id
where c.user_name = #{UserId} and c.delete_flag ='0'
</select>
<select id="selectCustInfoBusinessByAdminList" parameterType="Long">
select a.* from cust_info_business a inner join grid_region_admin_division_relate b on b.code like concat('',a.region_code , '%')
where b.grid_id = #{gridId}
<if test="custName != null and custName != ''"> and cust_name like concat('%', #{custName}, '%') </if>
<if test="custId != null and custId != ''"> and cust_id like concat('%', #{custId}, '%') </if>
group by a.cust_id
</select>
<select id="selectunDisCustByAdminList" parameterType="Long">
select a.* from cust_info_business a inner join grid_region_admin_division_relate b on b.code like concat('',a.region_code , '%')
where b.grid_id = #{gridId} and a.belong_user_name = ''
<if test="custName != null and custName != ''"> and cust_name like concat('%', #{custName}, '%') </if>
<if test="custId != null and custId != ''"> and cust_id like concat('%', #{custId}, '%') </if>
group by a.cust_id
</select>
<select id="selectunDisCustByVirtualList" >
select a.* from cust_info_business a inner join grid_virtual_customer_relate b on b.cust_id =a.cust_id
where b.grid_id = #{gridId} and a.belong_user_name = ''
<if test="custName != null and custName != ''"> and a.cust_name like concat('%', #{custName}, '%') </if>
<if test="custId != null and custId != ''"> and a.cust_id like concat('%', #{custId}, '%') </if>
group by a.cust_id
</select>
<select id="selectCustInfoBusinessByVirtualList" >
select a.* from cust_info_business a inner join grid_virtual_customer_relate b on b.cust_id =a.cust_id
where b.grid_id = #{gridId}
<if test="custName != null and custName != ''"> and a.cust_name like concat('%', #{custName}, '%') </if>
<if test="custId != null and custId != ''"> and a.cust_id like concat('%', #{custId}, '%') </if>
group by a.cust_id
</select>
<select id="selectBusinessNumByAdmin" parameterType="Long" resultType="java.lang.Long">
select count(distinct a.cust_id) from (select cust_id,region_code from cust_info_business) a
inner join (select distinct code,grid_id from grid_region_admin_division_relate) b on b.code = a.region_code
inner join (select distinct grid_id from grid_region_user_relate where delete_flag ='0'
and (relate_dept_id in (select dept_id from sys_dept where dept_id = #{userDept} or find_in_set(#{userDept},ancestors)) or user_name = #{userDept})) c on b.grid_id = c.grid_id
where b.grid_id = #{gridId}
</select>
<select id="selectCustInfoBusinessListBykeyword" parameterType="CustInfoBusiness" resultMap="CustInfoBusinessResult">
<include refid="selectCustInfoBusinessVo"/>
<where>
<if test="keyword != null and keyword != ''"> and ( cust_idc like concat('%', #{keyword}, '%') or cust_name like concat('%', #{keyword}, '%')
or cust_phone like concat('%', #{keyword}, '%') or lp_name like concat('%', #{keyword}, '%'))
</if>
</where>
</select>
<select id="selectCustInfoBusinessListBykeywordBranchAndManager" parameterType="CustInfoBusiness" resultMap="CustInfoBusinessResult">
select distinct a.id, a.cust_name, a.lp_name, a.cust_id, a.social_credit_code,a.cust_phone,a.tel ,a.cust_idc
from cust_info_business a inner join
(select user_id,dept_id,outlets_id,cust_id from cust_dept_user_grid
<where>
<if test="deptId != null and deptId != ''">
and dept_id in (select dept_id from sys_dept where dept_id = #{deptId} or find_in_set(#{deptId},ancestors))
</if>
<if test="outletsId != null and outletsId != ''">
and outlets_id in (select dept_id from sys_dept where dept_id = #{outletsId} or find_in_set(#{outletsId},ancestors))
</if>
<if test="userId != null and userId != ''">
and user_id = #{userId}
</if>
<if test="opsDept != null and opsDept != ''">
and ops_dept = #{opsDept}
</if>
</where>
union all
(select t2.user_id,t2.dept_id,t2.outlets_id,t2.cust_id from cust_dept_user_cmpm t2
<where>
and t2.cust_type = '2'
<if test="deptId != null and deptId != ''">
and t2.dept_id in (select dept_id from sys_dept where dept_id = #{deptId} or find_in_set(#{deptId},ancestors))
</if>
<if test="outletsId != null and outletsId != ''">
and t2.outlets_id in (select dept_id from sys_dept where dept_id = #{outletsId} or find_in_set(#{outletsId},ancestors))
</if>
<if test="userId != null and userId != ''">
and t2.user_id = #{userId}
</if>
</where>
)) b
on a.cust_id = b.cust_id
<where>
<if test="keyword != null and keyword != ''"> and ( a.cust_idc like concat('%', #{keyword}, '%') or a.cust_name like concat('%', #{keyword}, '%')
or a.cust_phone like concat('%', #{keyword}, '%') or a.lp_name like concat('%', #{keyword}, '%'))
</if>
</where>
</select>
<select id="selectCustInfoBusinessById" parameterType="Long" resultMap="CustInfoBusinessResult">
<include refid="selectCustInfoBusinessVo"/>
where id = #{id}
</select>
<insert id="insertCustInfoBusiness" parameterType="CustInfoBusiness" useGeneratedKeys="true" keyProperty="id">
insert into cust_info_business
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="custType != null and custType != ''">cust_type,</if>
<if test="custTag != null and custTag != ''">cust_tag,</if>
<if test="custScale != null and custScale != ''">cust_scale,</if>
<if test="custName != null and custName != ''">cust_name,</if>
<if test="lpName != null">lp_name,</if>
<if test="custPhone != null">cust_phone,</if>
<if test="custId != null">cust_id,</if>
<if test="custIsn != null">cust_isn,</if>
<if test="custCapital != null">cust_capital,</if>
<if test="custLocation != null">cust_location,</if>
<if test="loanTag != null">loan_tag,</if>
<if test="status != null">status,</if>
<if test="belongBranchId != null">belong_branch_id,</if>
<if test="belongBranchName != null">belong_branch_name,</if>
<if test="belongOutletId != null">belong_outlet_id,</if>
<if test="belongOutletName != null">belong_outlet_name,</if>
<if test="belongUserId != null">belong_user_id,</if>
<if test="belongUserName != null">belong_user_name,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="regionCode != null">region_code,</if>
<if test="socialCreditCode != null">social_credit_code,</if>
<if test="tel != null">tel,</if>
<if test="registerLocation != null">register_location,</if>
<if test="businessScope != null">business_scope,</if>
<if test="taxpayerIdentificationNumber != null">taxpayer_identification_number,</if>
<if test="taxpayerQualification != null">taxpayer_qualification,</if>
<if test="label != null">label,</if>
<if test="industry != null">industry,</if>
<if test="custIdc != null">cust_idc,</if>
<if test="custAge != null">cust_age,</if>
<if test="custGender != null">cust_gender,</if>
<if test="birthday != null">birthday,</if>
<if test="recordStatus != null "> record_status ,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="custType != null and custType != ''">#{custType},</if>
<if test="custTag != null and custTag != ''">#{custTag},</if>
<if test="custScale != null and custScale != ''">#{custScale},</if>
<if test="custName != null and custName != ''">#{custName},</if>
<if test="lpName != null">#{lpName},</if>
<if test="custPhone != null">#{custPhone},</if>
<if test="custId != null">#{custId},</if>
<if test="custIsn != null">#{custIsn},</if>
<if test="custCapital != null">#{custCapital},</if>
<if test="custLocation != null">#{custLocation},</if>
<if test="loanTag != null">#{loanTag},</if>
<if test="status != null">#{status},</if>
<if test="belongBranchId != null">#{belongBranchId},</if>
<if test="belongBranchName != null">#{belongBranchName},</if>
<if test="belongOutletId != null">#{belongOutletId},</if>
<if test="belongOutletName != null">#{belongOutletName},</if>
<if test="belongUserId != null">#{belongUserId},</if>
<if test="belongUserName != null">#{belongUserName},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="regionCode != null">#{regionCode},</if>
<if test="socialCreditCode != null">#{socialCreditCode},</if>
<if test="tel != null">#{tel},</if>
<if test="registerLocation != null">#{registerLocation},</if>
<if test="businessScope != null">#{businessScope},</if>
<if test="taxpayerIdentificationNumber != null">#{taxpayerIdentificationNumber},</if>
<if test="taxpayerQualification != null">#{taxpayerQualification},</if>
<if test="label != null">#{label},</if>
<if test="industry != null">#{industry},</if>
<if test="custIdc != null">#{custIdc},</if>
<if test="custAge != null">#{custAge},</if>
<if test="custGender != null">#{custGender},</if>
<if test="birthday != null">#{birthday},</if>
<if test="recordStatus != null"> #{recordStatus}</if>
</trim>
</insert>
<update id="updateCustInfoBusiness" parameterType="CustInfoBusiness">
update cust_info_business
<trim prefix="SET" suffixOverrides=",">
<if test="custType != null and custType != ''">cust_type = #{custType},</if>
<if test="custTag != null and custTag != ''">cust_tag = #{custTag},</if>
<if test="custScale != null and custScale != ''">cust_scale = #{custScale},</if>
<if test="custName != null and custName != ''">cust_name = #{custName},</if>
<if test="lpName != null">lp_name = #{lpName},</if>
<if test="custPhone != null">cust_phone = #{custPhone},</if>
<if test="custId != null">cust_id = #{custId},</if>
<if test="custIsn != null">cust_isn = #{custIsn},</if>
<if test="custCapital != null">cust_capital = #{custCapital},</if>
<if test="custLocation != null">cust_location = #{custLocation},</if>
<if test="loanTag != null">loan_tag = #{loanTag},</if>
<if test="status != null">status = #{status},</if>
<if test="belongBranchId != null">belong_branch_id = #{belongBranchId},</if>
<if test="belongBranchName != null">belong_branch_name = #{belongBranchName},</if>
<if test="belongOutletId != null">belong_outlet_id = #{belongOutletId},</if>
<if test="belongOutletName != null">belong_outlet_name = #{belongOutletName},</if>
<if test="belongUserId != null">belong_user_id = #{belongUserId},</if>
<if test="belongUserName != null">belong_user_name = #{belongUserName},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="regionCode != null">region_code = #{regionCode},</if>
<if test="socialCreditCode != null">social_credit_code = #{socialCreditCode},</if>
<if test="tel != null">tel = #{tel},</if>
<if test="registerLocation != null">register_location = #{registerLocation},</if>
<if test="businessScope != null">business_scope = #{businessScope},</if>
<if test="taxpayerIdentificationNumber != null">taxpayer_identification_number = #{taxpayerIdentificationNumber},</if>
<if test="taxpayerQualification != null">taxpayer_qualification = #{taxpayerQualification},</if>
<if test="label != null">label = #{label},</if>
<if test="industry != null">industry = #{industry},</if>
<if test="custIdc != null">cust_idc = #{custIdc},</if>
<if test="custAge != null">cust_age = #{custAge},</if>
<if test="custGender != null">cust_gender = #{custGender},</if>
<if test="birthday != null">birthday = #{birthday},</if>
<if test="recordStatus != null and recordStatus != ''"> record_status = #{recordStatus},</if>
</trim>
where id = #{id}
</update>
<update id="updateCustInfoBusinessLabel" parameterType="CustInfoBusiness">
update cust_info_business
<trim prefix="SET" suffixOverrides=",">
<if test="custType != null and custType != ''">cust_type = #{custType},</if>
<if test="custTag != null and custTag != ''">cust_tag = #{custTag},</if>
<if test="custScale != null and custScale != ''">cust_scale = #{custScale},</if>
<if test="custName != null and custName != ''">cust_name = #{custName},</if>
<if test="lpName != null and custName != ''">lp_name = #{lpName},</if>
<if test="custPhone != null and custPhone != ''">cust_phone = #{custPhone},</if>
<if test="custId != null and custId != ''">cust_id = #{custId},</if>
<if test="custIsn != null and custIsn != ''">cust_isn = #{custIsn},</if>
<if test="custCapital != null and custCapital != ''">cust_capital = #{custCapital},</if>
<if test="custLocation != null and custLocation != ''">cust_location = #{custLocation},</if>
<if test="loanTag != null and loanTag != ''">loan_tag = #{loanTag},</if>
<if test="status != null and status != ''">status = #{status},</if>
<if test="belongBranchId != null and belongBranchId != ''">belong_branch_id = #{belongBranchId},</if>
<if test="belongBranchName != null and belongBranchName != ''">belong_branch_name = #{belongBranchName},</if>
<if test="belongOutletId != null and belongOutletId != ''">belong_outlet_id = #{belongOutletId},</if>
<if test="belongOutletName != null and belongOutletName != ''">belong_outlet_name = #{belongOutletName},</if>
<if test="belongUserId != null and belongUserId != ''">belong_user_id = #{belongUserId},</if>
<if test="belongUserName != null and belongUserName != ''">belong_user_name = #{belongUserName},</if>
<if test="createBy != null and createBy != ''">create_by = #{createBy},</if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="regionCode != null and regionCode != ''">region_code = #{regionCode},</if>
<if test="socialCreditCode != null and socialCreditCode != ''">social_credit_code = #{socialCreditCode},</if>
<if test="tel != null and tel != ''">tel = #{tel},</if>
<if test="registerLocation != null and registerLocation != ''">register_location = #{registerLocation},</if>
<if test="businessScope != null and businessScope != ''">business_scope = #{businessScope},</if>
<if test="taxpayerIdentificationNumber != null and taxpayerIdentificationNumber != ''">taxpayer_identification_number = #{taxpayerIdentificationNumber},</if>
<if test="taxpayerQualification != null and taxpayerQualification != ''">taxpayer_qualification = #{taxpayerQualification},</if>
<if test="label != null and label != ''">label = #{label},</if>
<if test="industry != null and industry != ''">industry = #{industry},</if>
<if test="custIdc != null and custIdc != ''">cust_idc = #{custIdc},</if>
<if test="custAge != null and custAge != ''">cust_age = #{custAge},</if>
<if test="custGender != null and custGender != ''">cust_gender = #{custGender},</if>
<if test="birthday != null ">birthday = #{birthday},</if>
<if test="recordStatus != null and recordStatus != ''"> record_status = #{recordStatus},</if>
</trim>
where cust_id = #{custId}
</update>
<delete id="deleteCustInfoBusinessById" parameterType="Long">
delete from cust_info_business where id = #{id}
</delete>
<delete id="deleteCustInfoBusinessByIds" parameterType="String">
delete from cust_info_business where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<select id="selectCustInfoBusinessByCustId" parameterType="String" resultMap="CustInfoBusinessResult">
select * from cust_info_business
where cust_id = #{custId}
</select>
<select id="selectCustInfoBusinessBySocialCreditCode" parameterType="String" resultMap="CustInfoBusinessResult">
select * from cust_info_business
where social_credit_code = #{socialCreditCode}
</select>
<select id="selectCustInfoBusinessLists" parameterType="CustInfoBusiness" resultMap="CustInfoBusinessResult">
<include refid="selectCustInfoBusinessVo"/>
<where>
<if test="custType != null and custType != ''"> and cust_type = #{custType}</if>
<if test="custTag != null and custTag != ''"> and cust_tag = #{custTag}</if>
<if test="custScale != null and custScale != ''"> and cust_scale = #{custScale}</if>
<if test="custName != null and custName != ''"> and cust_name like concat('%', #{custName}, '%')</if>
<if test="lpName != null and lpName != ''"> and lp_name like concat('%', #{lpName}, '%')</if>
<if test="custPhone != null and custPhone != ''"> and cust_phone = #{custPhone}</if>
<if test="custId != null and custId != ''"> and cust_id = #{custId}</if>
<if test="custIsn != null and custIsn != ''"> and cust_isn = #{custIsn}</if>
<if test="custCapital != null and custCapital != ''"> and cust_capital = #{custCapital}</if>
<if test="custLocation != null and custLocation != ''"> and cust_location = #{custLocation}</if>
<if test="loanTag != null and loanTag != ''"> and loan_tag = #{loanTag}</if>
<if test="status != null and status != ''"> and status = #{status}</if>
<if test="belongBranchId != null and belongBranchId != ''"> and belong_branch_id = #{belongBranchId}</if>
<if test="belongBranchName != null and belongBranchName != ''"> and belong_branch_name like concat('%', #{belongBranchName}, '%')</if>
<if test="belongOutletId != null and belongOutletId != ''"> and belong_outlet_id = #{belongOutletId}</if>
<if test="belongOutletName != null and belongOutletName != ''"> and belong_outlet_name like concat('%', #{belongOutletName}, '%')</if>
<if test="belongUserId != null and belongUserId != ''"> and belong_user_id = #{belongUserId}</if>
<if test="belongUserName != null and belongUserName != ''"> and belong_user_name like concat('%', #{belongUserName}, '%')</if>
<if test="regionCode != null and regionCode != ''"> and region_code = #{regionCode}</if>
<if test="socialCreditCode != null and socialCreditCode != ''"> and social_credit_code = #{socialCreditCode}</if>
<if test="tel != null and tel != ''"> and tel = #{tel}</if>
<if test="registerLocation != null and registerLocation != ''"> and register_location = #{registerLocation}</if>
<if test="businessScope != null and businessScope != ''"> and business_scope = #{businessScope}</if>
<if test="taxpayerIdentificationNumber != null and taxpayerIdentificationNumber != ''"> and taxpayer_identification_number = #{taxpayerIdentificationNumber}</if>
<if test="taxpayerQualification != null and taxpayerQualification != ''"> and taxpayer_qualification = #{taxpayerQualification}</if>
<if test="label != null and label != ''"> and label = #{label}</if>
<if test="industry != null and industry != ''"> and industry = #{industry}</if>
<if test="custIdc != null and custIdc != ''"> and cust_idc = #{custIdc}</if>
<if test="birthday != null "> and birthday = #{birthday}</if>
</where>
</select>
<select id="getBusinessNumByLegalId" parameterType="String" resultType="java.lang.Long">
select count(*) from cust_info_business
where social_credit_code = #{LegalId}
</select>
<update id="updateBusinessByAnchor" parameterType="CustInfoUpdateFromAnchor">
update cust_info_business
<trim prefix="SET" suffixOverrides=",">
<if test="anchorName != null">cust_name = #{anchorName},</if>
<if test="belongBusiness != null">industry = #{belongBusiness},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="updateOrg != null">update_dept = #{updateOrg},</if>
<if test="address != null">${addressName} = #{address},</if>
<if test="regionCode != null">region_code = #{regionCode},</if>
</trim>
where social_credit_code = #{legalId}
</update>
<insert id="insertBusinessByAnchor" parameterType="CustInfoUpdateFromAnchor" >
insert into cust_info_business
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="custId != null">cust_id,</if>
<if test="custIsn != null">cust_isn,</if>
<if test="legalId != null">social_credit_code,</if>
<if test="anchorName != null">cust_name,</if>
<if test="belongBusiness != null">industry,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="address != null">${addressName},</if>
<if test="regionCode != null">region_code,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="custId != null">#{custId},</if>
<if test="custIsn != null">#{custIsn},</if>
<if test="legalId != null">#{legalId},</if>
<if test="anchorName != null">#{anchorName},</if>
<if test="belongBusiness != null">#{belongBusiness},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="address != null">#{address},</if>
<if test="regionCode != null">#{regionCode},</if>
</trim>
</insert>
<delete id="deleteBusinessByAnchor" parameterType="CustInfoDeleteFromAnchor">
update cust_info_business set region_code ='' where social_credit_code = #{legalId}
</delete>
<select id="getLpNameByCustId" >
select distinct lp_name from cust_info_business
where cust_id = #{custId}
</select>
<select id="getBusiIdcByCustId" parameterType="String">
select distinct social_credit_code from cust_info_business
where cust_id = #{custId}
</select>
<select id="selectBusinessInfoByManage" parameterType="CustManageInfo" resultMap="CustManageInfoResult">
select distinct a.cust_id,a.cust_name,a.social_credit_code,a.region_code,c.user_name,c.nick_name,'2' as cust_type from cust_info_business a
inner join (select distinct code,grid_id from grid_region_admin_division_relate where delete_flag ='0') b on
b.code =a.region_code
inner join (select distinct grid_id,relate_dept_id,user_name,nick_name from grid_region_user_relate where delete_flag ='0'
and (relate_dept_id in (select dept_id from sys_dept where dept_id = #{userDept} or find_in_set(#{userDept},ancestors)) or user_name =#{userDept})) c
on b.grid_id = c.grid_id
where c.grid_id = #{gridId}
<if test="custName != null and custName != ''"> and a.cust_name like concat('%', #{custName}, '%') </if>
<if test="custId != null and custId != ''"> and a.cust_id like concat('%', #{custId}, '%') </if>
<if test="custNo != null and custNo != ''"> and a.social_credit_code like concat('%', #{custNo}, '%') </if>
<if test="distributeTag != null and distributeTag != ''">
and case when #{distributeTag} = '0' then exists (select * from sys_grid_user_cust d where d.grid_id = #{gridId} and a.cust_id =d.cust_id and c.user_name = d.user_name)
when #{distributeTag} = '1' then not exists (select * from sys_grid_user_cust d where d.grid_id = #{gridId} and a.cust_id =d.cust_id and c.user_name = d.user_name)
else 1=1 end
</if>
</select>
<select id="selectCustInfoBusinessByCustNameAndCustIdc" parameterType="String" resultMap="CustInfoBusinessResult">
<include refid="selectCustInfoBusinessVo"/>
<where>
<if test="custName != null and custName != ''"> and cust_name = #{custName}</if>
<if test="custIdc != null and custIdc != ''"> and cust_idc = #{custIdc}</if>
</where>
</select>
<select id="selectCustInfoBusinessCustId" parameterType="String" resultMap="CustInfoBusinessResult">
<include refid="selectCustInfoBusinessVo"/>
<where>
<if test="custId != null and custId != ''"> and cust_id = #{custId}</if>
</where>
</select>
<select id="countByCode" resultType="Long">
select count(distinct cust_id)
from cust_info_business_${deptCode}
where region_code like concat(#{code}, '%')
</select>
<select id="selectRecord" resultType="com.ruoyi.common.core.domain.entity.CustInfoBusiness">
select id,cust_name from cust_info_business where social_credit_code = #{socialCreditCode}
</select>
<insert id="insertCustomersToBusinessByScCode" parameterType="java.util.List">
INSERT INTO cust_info_business
(cust_id,cust_name, social_credit_code, update_by, update_time, cust_phone, industry, asset, credit)
VALUES
<foreach collection="list" item="item" separator=",">
(#{item.custId},#{item.custName}, #{item.socialCreditCode}, #{item.createBy}, #{item.createTime}, #{item.custPhone},#{item.industry},#{item.asset},#{item.credit})
</foreach>
</insert>
</mapper>

View File

@@ -0,0 +1,117 @@
<?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.tabs.mapper.CustTabDetailMapper">
<resultMap type="CustTabDetail" id="CustTabDetailResult">
<result property="id" column="id" />
<result property="tabId" column="tab_id" />
<result property="tabThresholdType" column="tab_threshold_type" />
<result property="tabThreshold" column="tab_threshold" />
<result property="tabThresholdRule" column="tab_threshold_rule" />
<result property="booleanVal" column="boolean_val" />
<result property="enumVal" column="enum_val" />
<result property="createTime" column="create_time" />
<result property="createBy" column="create_by" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="remark" column="remark" />
<result property="potName" column="pot_name" />
<result property="potId" column="pot_id" />
</resultMap>
<sql id="selectCustTabDetailVo">
select id, tab_id, tab_threshold_type, tab_threshold, tab_threshold_rule, boolean_val, enum_val, create_time, create_by, update_by, update_time, remark,pot_name,pot_id
from cust_tab_detail
</sql>
<select id="selectCustTabDetailList" parameterType="CustTabDetail" resultMap="CustTabDetailResult">
<include refid="selectCustTabDetailVo"/>
<where>
<if test="tabId != null "> and tab_id = #{tabId}</if>
<if test="tabThresholdType != null and tabThresholdType != ''"> and tab_threshold_type = #{tabThresholdType}</if>
<if test="tabThreshold != null "> and tab_threshold = #{tabThreshold}</if>
<if test="tabThresholdRule != null and tabThresholdRule != ''"> and tab_threshold_rule = #{tabThresholdRule}</if>
<if test="booleanVal != null and booleanVal != ''"> and boolean_val = #{booleanVal}</if>
<if test="enumVal != null and enumVal != ''"> and enum_val = #{enumVal}</if>
</where>
</select>
<select id="selectCustTabDetailById" parameterType="Long" resultMap="CustTabDetailResult">
<include refid="selectCustTabDetailVo"/>
where id = #{id} and is_delete = '1'
</select>
<select id="selectCustTabDetailByTabId" parameterType="Long" resultMap="CustTabDetailResult">
<include refid="selectCustTabDetailVo"/>
where tab_id = #{tabId} and is_delete = '1'
</select>
<insert id="insertCustTabDetail" parameterType="CustTabDetail" useGeneratedKeys="true" keyProperty="id">
insert into cust_tab_detail
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="tabId != null and tabId !=''">tab_id,</if>
<if test="tabThresholdType != null and tabThresholdType!=''">tab_threshold_type,</if>
<if test="tabThreshold != null and tabThreshold != ''">tab_threshold,</if>
<if test="tabThresholdRule != null and tabThresholdRule !='' ">tab_threshold_rule,</if>
<if test="booleanVal != null and booleanVal!=''">boolean_val,</if>
<if test="enumVal != null and enumVal!='' ">enum_val,</if>
create_time,
<if test="createBy != null">create_by,</if>
<if test="updateBy != null">update_by,</if>
update_time,
<if test="remark != null">remark,</if>
<if test="potId != null">pot_id,</if>
<if test="potName != null">pot_name,</if>
is_delete,
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="tabId != null and tabId !=''">#{tabId},</if>
<if test="tabThresholdType != null and tabThresholdType!=''">#{tabThresholdType},</if>
<if test="tabThreshold != null and tabThreshold != ''">#{tabThreshold},</if>
<if test="tabThresholdRule != null and tabThresholdRule !=''">#{tabThresholdRule},</if>
<if test="booleanVal != null and booleanVal!=''">#{booleanVal},</if>
<if test="enumVal != null and enumVal!='' ">#{enumVal},</if>
sysdate(),
<if test="createBy != null">#{createBy},</if>
<if test="updateBy != null">#{updateBy},</if>
sysdate(),
<if test="remark != null">#{remark},</if>
<if test="potId != null">#{potId},</if>
<if test="potName != null">#{potName},</if>
'1',
</trim>
</insert>
<update id="updateCustTabDetail" parameterType="CustTabIdDetailVO">
update cust_tab_detail
<trim prefix="SET" suffixOverrides=",">
<if test="tabId != null">tab_id = #{tabId},</if>
<if test="tabThresholdType != null">tab_threshold_type = #{tabThresholdType},</if>
<if test="tabThreshold != null">tab_threshold = #{tabThreshold},</if>
<if test="tabThresholdRule != null">tab_threshold_rule = #{tabThresholdRule},</if>
<if test="booleanVal != null">boolean_val = #{booleanVal},</if>
<if test="enumVal != null">enum_val = #{enumVal},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="remark != null">remark = #{remark},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteCustTabDetailById" parameterType="Long">
delete from cust_tab_detail where id = #{id}
</delete>
<delete id="deleteCustTabDetailByIds" parameterType="String">
delete from cust_tab_detail where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@@ -0,0 +1,187 @@
<?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.tabs.mapper.CustTabListInfoMapper">
<resultMap type="CustTabListInfo" id="CustTabListInfoResult">
<result property="id" column="id" />
<result property="parentId" column="parent_id" />
<result property="tabName" column="tab_name" />
<result property="belongOrg3" column="belong_org3" />
<result property="tabEnum" column="tab_enum" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="createBy" column="create_by" />
<result property="remark" column="remark" />
<result property="custType" column="cust_type" />
<result property="computType" column="comput_type" />
<result property="endDate" column="end_date" />
<result property="authType" column="auth_type" />
<result property="authUser" column="auth_user" />
<result property="createDept" column="create_dept" />
<result property="updateName" column="update_name" />
<result property="treeList" column="tree_list" />
<result property="tabId" column="tab_id"/>
<result property="isStart" column="is_start"/>
</resultMap>
<sql id="selectCustTabListInfoVo">
select ctli.id, ctli.parent_id, ctli.tab_name, ctli.belong_org3, ctli.tab_enum, ctli.create_time,
ctli.update_by, ctli.update_time, ctli.create_by, ctli.remark, ctli.cust_type, ctli.comput_type,
ctli.end_date, ctli.auth_type, ctli.auth_user,ctli.tab_id,ctli.is_start
from cust_tab_list_info ctli
</sql>
<select id="selectTabPotListInfoByTabType" parameterType="CustTabListInfo" resultType="CustTabGroupVo">
select ctli.id,ctli.tab_id, ctli.tab_name,group_concat(ctli2.tab_name SEPARATOR '|') as children
from cust_tab_list_info ctli
left join cust_tab_list_info ctli2 on ctli.id= ctli2.parent_id
<where>
<if test="custType != null and custType != ''"> and ctli.cust_type = #{custType}</if>
<if test="tabType != null and tabType != ''"> and ctli.tab_type = #{tabType}</if>
<if test="loginId != null and loginId != ''"> and ( ctli.auth_type = '1' and ctli.create_by = #{loginId} or ctli.auth_type = '3' or
ctli.auth_type = '2' and ctli.auth_user like concat('%', #{loginId}, '%') )</if>
and ctli.is_delete = 0
and ctli.parent_id = #{parentId}
and ctli.tab_enum = '0'
</where>
group by ctli.id,ctli.tab_name,ctli.tab_id
</select>
<select id="selectCustTabListInfoList" parameterType="CustTabListInfo" resultMap="CustTabListInfoResult">
select ctli.id, ctli.parent_id, ctli.tab_name, ctli.belong_org3, ctli.tab_enum, ctli.create_time,
ctli.update_by, ctli.update_time, ctli.create_by, ctli.remark, ctli.cust_type, ctli.comput_type,
ctli.end_date, ctli.auth_type, ctli.auth_user, concat_ws('-',su.nick_name,su.user_name) as update_name,ctli.pot_sql,ctli.tree_list,ctli.tab_id,ctli.is_start
from cust_tab_list_info ctli
left join sys_user su on su.user_name = ctli.create_by
<where>
ctli.is_delete = 0
<if test="parentId != null and parentId != ''"> and ctli.parent_id = #{parentId}</if>
<if test="tabName != null and tabName != ''"> and ctli.tab_name like concat('%', #{tabName}, '%')</if>
<if test="tabNameBy != null and tabNameBy != ''"> and ctli.tab_name= #{tabNameBy} </if>
<if test="belongOrg3 != null and belongOrg3 != ''"> and ctli.belong_org3 = #{belongOrg3}</if>
<if test="custType != null and custType != ''"> and ctli.cust_type = #{custType}</if>
<if test="computType != null and computType != ''"> and ctli.comput_type = #{computType}</if>
<if test="authType != null and authType != ''"> and ctli.auth_type = #{authType}</if>
<if test="tabEnum != null and tabEnum != ''"> and ctli.tab_enum = #{tabEnum}</if>
<if test="endDate != null and endDate != ''"> and ctli.end_date &lt;= #{endDate}</if>
<if test="updateName != null and updateName != ''"> and su.nick_name like concat('%', #{updateName}, '%')</if>
<if test="tabId != null and tabId != ''"> and ctli.tab_id = #{tabId}</if>
<if test="id != null and id !=''"> and ctli.id = #{id}</if>
<if test="tabThresholdType!=null and tabThresholdType!='' " > and ctli.tab_threshold_type = #{tabThresholdType}</if>
<if test="loginId != null and loginId != ''">
and (
ctli.auth_type = '1' and ctli.create_by = #{loginId}
or ctli.auth_type = '3' and left(ctli.create_by,3) = left(#{loginId},3)
or ctli.auth_type = '2' and ctli.auth_user like concat('%', #{loginId}, '%')
or ctli.create_by = #{loginId}
or ctli.update_by = #{loginId} )</if>
</where>
<!-- ${params.dataScope}-->
</select>
<select id="selectCustTabListInfoById" parameterType="Long" resultMap="CustTabListInfoResult">
<include refid="selectCustTabListInfoVo"/>
where id = #{id}
</select>
<select id="selectCustTabListInfoHis" resultType="com.ruoyi.ibs.tabs.domain.vo.CustTabEditHisVo">
select ctli.create_time as update_time,concat_ws('-',su.nick_name,su.user_name) as user_name, sr.role_name
from (
select create_by, create_time
from cust_tab_list_info
where tab_id = #{tabId} and belong_org3 = #{belongOrg3}
group by create_by, create_time ) ctli
left join sys_user su on su.user_name = ctli.create_by
left join sys_user_role ssr on su.user_id = ssr.user_id
left join sys_role sr on ssr.role_id = sr.role_id
</select>
<insert id="insertCustTabListInfo" parameterType="CustTabListInfo" useGeneratedKeys="true" keyProperty="id">
insert into cust_tab_list_info
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="parentId != null">parent_id,</if>
<if test="tabName != null">tab_name,</if>
<if test="tabId != null">tab_id,</if>
<if test="belongOrg3 != null">belong_org3,</if>
<if test="tabEnum != null">tab_enum,</if>
<if test="custType != null">cust_type,</if>
<if test="computType != null">comput_type,</if>
<if test="endDate != null">end_date,</if>
<if test="authType != null">auth_type,</if>
<if test="authUser != null">auth_user,</if>
<if test="updateBy != null">update_by,</if>
<if test="potRelation !=null">pot_relation,</if>
<if test="createDept != null">create_dept,</if>
<if test="remark !=null">remark,</if>
<if test="potSql !=null " > pot_sql,</if>
<if test="treeList !=null " > tree_list,</if>
<if test="tabThresholdType !=null " > tab_threshold_type,</if>
update_time,
create_time,
<if test="createBy != null">create_by,</if>
is_delete,
is_start,
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="parentId != null">#{parentId},</if>
<if test="tabName != null">#{tabName},</if>
<if test="tabId != null">#{tabId},</if>
<if test="tabType != null">#{tabType},</if>
<if test="belongOrg3 != null">#{belongOrg3},</if>
<if test="tabEnum != null">#{tabEnum},</if>
<if test="custType != null">#{custType},</if>
<if test="computType != null">#{computType},</if>
<if test="endDate != null">#{endDate},</if>
<if test="authType != null">#{authType},</if>
<if test="authUser != null">#{authUser},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="potRelation !=null">#{potRelation},</if>
<if test="createDept != null">#{createDept},</if>
<if test="remark !=null">#{remark},</if>
<if test="potSql !=null " >#{potSql},</if>
<if test="treeList !=null " >#{treeList},</if>
<if test="tabThresholdType!=null" > #{tabThresholdType},</if>
sysdate(),
sysdate(),
<if test="createBy != null">#{createBy},</if>
'0',
'0',
</trim>
</insert>
<update id="updateCustTabListInfo" parameterType="CustTabListInfo">
update cust_tab_list_info
<trim prefix="SET" suffixOverrides=",">
<if test="parentId != null">parent_id = #{parentId},</if>
<if test="tabName != null">tab_name = #{tabName},</if>
<if test="belongOrg3 != null">belong_org3 = #{belongOrg3},</if>
<if test="tabEnum != null">tab_enum = #{tabEnum},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="isStart != null">is_start = #{isStart},</if>
</trim>
where id = #{id}
</update>
<update id="deleteCustTabListInfoById" >
update cust_tab_list_info set is_delete = '1' ,update_time = sysdate(),update_by = #{loginId}
where id = #{id} or parent_id = #{id}
</update>
<delete id="deleteCustTabListInfoByIds" parameterType="String">
delete from cust_tab_list_info where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@@ -0,0 +1,120 @@
<?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.grid.mapper.GridAdminDivisionRelateMapper">
<resultMap type="GridRegionAdminDivisionRelate" id="GridRegionAdminDivisionRelateResult">
<result property="id" column="id" />
<result property="gridId" column="grid_id" />
<result property="parentGridId" column="parent_grid_id" />
<result property="code" column="code" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="deleteFlag" column="delete_flag" />
</resultMap>
<sql id="selectGridRegionAdminDivisionRelateVo">
select id, grid_id, code, parent_grid_id, create_by, create_time, update_by, update_time, delete_flag from grid_region_admin_division_relate
</sql>
<select id="selectGridRegionAdminDivisionRelateList" parameterType="GridRegionAdminDivisionRelate" resultMap="GridRegionAdminDivisionRelateResult">
<include refid="selectGridRegionAdminDivisionRelateVo"/>
<where>
<if test="gridId != null "> and grid_id = #{gridId}</if>
<if test="code != null and code != ''"> and code = #{code}</if>
<if test="parentGridId != null and parentGridId != ''"> and parent_grid_id = #{parentGridId}</if>
<if test="deleteFlag != null and deleteFlag != ''"> and delete_flag = #{deleteFlag}</if>
</where>
</select>
<select id="selectGridRegionAdminDivisionRelateById" parameterType="Long" resultMap="GridRegionAdminDivisionRelateResult">
<include refid="selectGridRegionAdminDivisionRelateVo"/>
where id = #{id}
</select>
<insert id="insertGridRegionAdminDivisionRelate" parameterType="GridRegionAdminDivisionRelate" useGeneratedKeys="true" keyProperty="id">
insert into grid_region_admin_division_relate
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="gridId != null">grid_id,</if>
<if test="code != null">code,</if>
<if test="parentGridId != null">parent_grid_id,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="deleteFlag != null and deleteFlag != ''">delete_flag,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="gridId != null">#{gridId},</if>
<if test="code != null">#{code},</if>
<if test="parentGridId != null">#{parentGridId},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="deleteFlag != null and deleteFlag != ''">#{deleteFlag},</if>
</trim>
</insert>
<update id="updateGridRegionAdminDivisionRelate" parameterType="GridRegionAdminDivisionRelate">
update grid_region_admin_division_relate
<trim prefix="SET" suffixOverrides=",">
<if test="gridId != null">grid_id = #{gridId},</if>
<if test="code != null">code = #{code},</if>
<if test="parentGridId != null">parent_grid_id = #{parentGridId},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="deleteFlag != null and deleteFlag != ''">delete_flag = #{deleteFlag},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteGridRegionAdminDivisionRelateById" parameterType="Long">
delete from grid_region_admin_division_relate where id = #{id}
</delete>
<delete id="deleteGridRegionAdminDivisionRelateByIds" parameterType="String">
delete from grid_region_admin_division_relate where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<select id="selectGridAdminByGridId" parameterType="Long">
select code from grid_region_admin_division_relate
where grid_id = #{gridId}
</select>
<select id="getGridIdByRetailCust">
select c.* from grid_region_admin_division_relate a , cust_info_retail b ,grid_region_grid c
where a.code like concat('',b.region_code , '%') and a.grid_id = c.grid_id and c.grid_level = '2' AND b.id = #{Id} AND c.parent_grid_id = #{GridId} order by a.grid_id limit 1
</select>
<select id="getGridIdByBusiCust">
select c.* from grid_region_admin_division_relate a , cust_info_business b,grid_region_grid c
where a.code like concat('',b.region_code , '%') and a.grid_id = c.grid_id and c.grid_level = '2' AND b.id = #{Id} AND c.parent_grid_id = #{GridId} order by a.grid_id limit 1
</select>
<select id="getGridNameByRetailCust">
select c.grid_name from grid_region_admin_division_relate a , cust_info_retail b ,grid_region_grid c
where a.code like concat('',b.region_code , '%') and a.grid_id = c.grid_id and c.grid_level = '2' AND b.cust_id = #{CustId} AND c.parent_grid_id = #{GridId} order by a.grid_id limit 1
</select>
<select id="getGridNameByBusiCust">
select c.grid_name from grid_region_admin_division_relate a,cust_info_business b,grid_region_grid c
where a.code like concat('',b.region_code , '%') and a.grid_id = c.grid_id and c.grid_level = '2' AND b.cust_id = #{CustId} AND c.parent_grid_id = #{GridId} order by a.grid_id limit 1
</select>
<select id="getGridUserName" parameterType="String" resultType="java.lang.String">
select group_concat(c.nick_name) from grid_region_admin_division_relate a,grid_region_user_relate b,sys_user c
where a.grid_id =b.grid_id and b.user_name =c.user_name
and a.code = #{regionCode}
and b.user_name not in (select user_name from sys_grid_user_cust where cust_id = #{custId})
</select>
</mapper>

View File

@@ -0,0 +1,161 @@
<?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=".dao.GridMgmtAdminDivisionDao">
<resultMap type=".entity.GridMgmtAdminDivision" id="GridMgmtAdminDivisionMap">
<result property="id" column="id" jdbcType="INTEGER"/>
<result property="province" column="province" jdbcType="VARCHAR"/>
<result property="city" column="city" jdbcType="VARCHAR"/>
<result property="county" column="county" jdbcType="VARCHAR"/>
<result property="town" column="town" jdbcType="VARCHAR"/>
<result property="village" column="village" jdbcType="VARCHAR"/>
<result property="code" column="code" jdbcType="VARCHAR"/>
<result property="level" column="level" jdbcType="INTEGER"/>
<result property="grid" column="grid" jdbcType="VARCHAR"/>
</resultMap>
<!--查询单个-->
<select id="queryById" resultMap="GridMgmtAdminDivisionMap">
select idprovincecitycountytownvillagecodelevelgrid
from grid_mgmt_admin_division
where id = #{id}
</select>
<!--查询指定行数据-->
<select id="queryAllByLimit" resultMap="GridMgmtAdminDivisionMap">
select
idprovincecitycountytownvillagecodelevelgrid
from grid_mgmt_admin_division
<where>
<if test="id != null">
and id = #{id}
</if>
<if test="province != null and province != ''">
and province = #{province}
</if>
<if test="city != null and city != ''">
and city = #{city}
</if>
<if test="county != null and county != ''">
and county = #{county}
</if>
<if test="town != null and town != ''">
and town = #{town}
</if>
<if test="village != null and village != ''">
and village = #{village}
</if>
<if test="code != null and code != ''">
and code = #{code}
</if>
<if test="level != null">
and level = #{level}
</if>
<if test="grid != null and grid != ''">
and grid = #{grid}
</if>
</where>
limit #{pageable.offset}, #{pageable.pageSize}
</select>
<!--统计总行数-->
<select id="count" resultType="java.lang.Long">
select count(1)
from grid_mgmt_admin_division
<where>
<if test="id != null">
and id = #{id}
</if>
<if test="province != null and province != ''">
and province = #{province}
</if>
<if test="city != null and city != ''">
and city = #{city}
</if>
<if test="county != null and county != ''">
and county = #{county}
</if>
<if test="town != null and town != ''">
and town = #{town}
</if>
<if test="village != null and village != ''">
and village = #{village}
</if>
<if test="code != null and code != ''">
and code = #{code}
</if>
<if test="level != null">
and level = #{level}
</if>
<if test="grid != null and grid != ''">
and grid = #{grid}
</if>
</where>
</select>
<!--新增所有列-->
<insert id="insert" keyProperty="id" useGeneratedKeys="true">
insert into grid_mgmt_admin_division(provincecitycountytownvillagecodelevelgrid)
values (#{province}#{city}#{county}#{town}#{village}#{code}#{level}#{grid})
</insert>
<insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
insert into grid_mgmt_admin_division(provincecitycountytownvillagecodelevelgrid)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.province}#{entity.city}#{entity.county}#{entity.town}#{entity.village}#{entity.code}#{entity.level}#{entity.grid})
</foreach>
</insert>
<insert id="insertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
insert into grid_mgmt_admin_division(provincecitycountytownvillagecodelevelgrid)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.province}#{entity.city}#{entity.county}#{entity.town}#{entity.village}#{entity.code}#{entity.level}#{entity.grid})
</foreach>
on duplicate key update
province = values(province)city = values(city)county = values(county)town = values(town)village =
values(village)code = values(code)level = values(level)grid = values(grid)
</insert>
<!--通过主键修改数据-->
<update id="update">
update grid_mgmt_admin_division
<set>
<if test="province != null and province != ''">
province = #{province},
</if>
<if test="city != null and city != ''">
city = #{city},
</if>
<if test="county != null and county != ''">
county = #{county},
</if>
<if test="town != null and town != ''">
town = #{town},
</if>
<if test="village != null and village != ''">
village = #{village},
</if>
<if test="code != null and code != ''">
code = #{code},
</if>
<if test="level != null">
level = #{level},
</if>
<if test="grid != null and grid != ''">
grid = #{grid},
</if>
</set>
where id = #{id}
</update>
<!--通过主键删除-->
<delete id="deleteById">
delete
from grid_mgmt_admin_division
where id = #{id}
</delete>
</mapper>

View File

@@ -0,0 +1,280 @@
<?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.grid.mapper.GridRegionGridMapper">
<resultMap type="GridRegionGrid" id="GridRegionGridResult">
<result property="gridId" column="grid_id" />
<result property="gridName" column="grid_name" />
<result property="gridLevel" column="grid_level" />
<result property="gridType" column="grid_type" />
<result property="gridDutyType" column="grid_duty_type" />
<result property="parentGridId" column="parent_grid_id" />
<result property="deptId" column="dept_id" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="deleteFlag" column="delete_flag" />
</resultMap>
<resultMap type="GridSelectInfo" id="GridSelectInfoResult">
<result property="topGridId" column="parent_grid_id" />
<result property="gridId" column="grid_id" />
<result property="secGridName" column="grid_name" />
<result property="gridDutyType" column="grid_duty_type" />
<result property="gridType" column="grid_type" />
<result property="gridLevel" column="grid_level" />
<result property="custNum" column="cust_num" />
<result property="posNum" column="pos_num" />
<result property="busiNum" column="busi_num" />
<result property="secGridNum" column="sec_grid_num" />
<result property="createDept" column="create_dept"/>
</resultMap>
<sql id="selectGridRegionGridVo">
select grid_id, grid_name, grid_level, grid_type, grid_duty_type, parent_grid_id, dept_id, create_by, create_time, update_by, update_time, delete_flag from grid_region_grid
</sql>
<select id="selectGridRegionGridList" parameterType="GridRegionGrid" resultMap="GridRegionGridResult">
<include refid="selectGridRegionGridVo"/>
<where>
delete_flag = 0
<if test="gridName != null and gridName != ''"> and grid_name like concat('%', #{gridName}, '%')</if>
<if test="gridLevel != null "> and grid_level = #{gridLevel}</if>
<if test="gridDutyType != null and gridDutyType != ''"> and grid_duty_type = #{gridDutyType}</if>
<if test="parentGridId != null "> and parent_grid_id = #{parentGridId}</if>
<if test="deptId != null and deptId != ''"> and dept_id = #{deptId}</if>
</where>
</select>
<select id="selectGridRegionGridByGridId" parameterType="Long" resultMap="GridRegionGridResult">
<include refid="selectGridRegionGridVo"/>
where delete_flag = 0 and grid_id = #{gridId}
</select>
<insert id="insertGridRegionGrid" parameterType="GridRegionGrid" useGeneratedKeys="true" keyProperty="gridId">
insert into grid_region_grid
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="gridName != null">grid_name,</if>
<if test="gridLevel != null">grid_level,</if>
<if test="gridDutyType != null">grid_duty_type,</if>
<if test="parentGridId != null">parent_grid_id,</if>
<if test="deptId != null">dept_id,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="delFlag != null">del_flag,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="gridName != null">#{gridName},</if>
<if test="gridLevel != null">#{gridLevel},</if>
<if test="gridDutyType != null">#{gridDutyType},</if>
<if test="parentGridId != null">#{parentGridId},</if>
<if test="deptId != null">#{deptId},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="delFlag != null">#{delFlag},</if>
</trim>
</insert>
<update id="updateGridRegionGrid" parameterType="GridRegionGrid">
update grid_region_grid
<trim prefix="SET" suffixOverrides=",">
<if test="gridName != null">grid_name = #{gridName},</if>
<if test="gridLevel != null">grid_level = #{gridLevel},</if>
<if test="gridDutyType != null">grid_duty_type = #{gridDutyType},</if>
<if test="parentGridId != null">parent_grid_id = #{parentGridId},</if>
<if test="deptId != null">dept_id = #{deptId},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="delFlag != null">del_flag = #{delFlag},</if>
</trim>
where grid_id = #{gridId}
</update>
<select id="selectTopGrid" parameterType="gridSelectInfo" resultMap="GridSelectInfoResult">
select distinct a.grid_id,a.grid_name,a.grid_duty_type,a.grid_type,a.grid_level, d.dept_name as create_dept
from grid_region_grid a
left join sys_dept d on a.dept_id = d.dept_id
inner join (select distinct grid_id ,relate_dept_name from grid_region_user_relate
where delete_flag ='0' and (relate_dept_id in (select dept_id from sys_dept where dept_id = #{userDept} or find_in_set(#{userDept},ancestors)) or user_name = #{userDept})) b on a.grid_id = b.grid_id
<where>
<if test="gridType != null and gridType != ''"> and a.grid_type = #{gridType}</if>
<if test="gridDutyType != null and gridDutyType != ''"> and a.grid_duty_type = #{gridDutyType}</if>
<if test="belongDept != null and belongDept != ''"> and b.relate_dept_name like concat('%',#{belongDept}, '%') </if>
<if test="topGridName != null and topGridName != ''"> and a.grid_name like concat('%',#{topGridName}, '%')</if>
and a.grid_level = '1' and a.delete_flag = '0'
</where>
</select>
<select id="selectSecGrid" parameterType="gridSelectInfo" resultMap="GridSelectInfoResult">
select distinct a.grid_id,a.grid_name,a.grid_duty_type,a.grid_type,a.grid_level,a.parent_grid_id, d.dept_name as
create_dept
from grid_region_grid a
left join sys_dept d on a.dept_id = d.dept_id
inner join (select distinct grid_id,grid_name,parent_grid_id from grid_region_grid) c on a.parent_grid_id = c.grid_id
inner join (select distinct grid_id ,relate_dept_name from grid_region_user_relate
where delete_flag ='0' and (relate_dept_id in (select dept_id from sys_dept where dept_id = #{userDept} or find_in_set(#{userDept},ancestors)) or user_name = #{userDept})) b on a.grid_id = b.grid_id
<where>
<if test="gridType != null and gridType != ''"> and a.grid_type = #{gridType}</if>
<if test="gridDutyType != null and gridDutyType != ''"> and a.grid_duty_type = #{gridDutyType}</if>
<if test="belongDept != null and belongDept != ''"> and b.relate_dept_name like concat('%',#{belongDept}, '%') </if>
<if test="relationOutletList != null and relationOutletList != ''"> and b.relate_dept_name like concat('%',#{relationOutletList}, '%') </if>
<if test="relationManagerList != null and relationManagerList != ''"> and b.nick_name like concat('%',#{relationManagerList}, '%') </if>
<if test="secGridName != null and secGridName != ''"> and a.grid_name like concat('%',#{secGridName}, '%')</if>
<if test="topGridName != null and topGridName != ''"> and c.grid_name like concat('%',#{topGridName}, '%')</if>
and a.grid_level = '2' and a.delete_flag = '0'
</where>
</select>
<select id="selectTopGridList" parameterType="gridSelectInfo" resultMap="GridSelectInfoResult">
select distinct a.grid_id,a.grid_name,a.grid_duty_type,a.grid_type,a.grid_level,
sum(e.cust_num) as cust_num,sum(f.pos_num) as pos_num,sum(g.busi_num) as busi_num,b.sec_grid_num
from grid_region_grid a
inner join (select count(distinct grid_id) as sec_grid_num,any_value(relate_dept_name) as relate_dept_name,parent_grid_id from grid_region_user_relate
where delete_flag ='0' and (relate_dept_id in (select dept_id from sys_dept where dept_id = #{userDept} or find_in_set(#{userDept},ancestors)) or user_name = #{userDept}) group by parent_grid_id) b on a.grid_id = b.parent_grid_id
inner JOIN (SELECT distinct code, grid_id FROM grid_region_admin_division_relate) h ON a.grid_id = h.grid_id
LEFT JOIN (SELECT region_code, count(distinct cust_id) AS cust_num FROM cust_info_retail GROUP BY region_code) e ON h.code = e.region_code
LEFT JOIN (SELECT region_code, count(distinct cust_id) AS pos_num FROM cust_info_merchant GROUP BY region_code) f ON h.code = f.region_code
LEFT JOIN (SELECT region_code, count(distinct cust_id) AS busi_num FROM cust_info_business GROUP BY region_code) g ON h.code = g.region_code
<where>
<if test="gridType != null and gridType != ''"> and a.grid_type = #{gridType}</if>
<if test="gridDutyType != null and gridDutyType != ''"> and a.grid_duty_type = #{gridDutyType}</if>
<if test="belongDept != null and belongDept != ''"> and b.relate_dept_name like concat('%',#{belongDept}, '%') </if>
<if test="topGridName != null and topGridName != ''"> and a.grid_name like concat('%',#{topGridName}, '%')</if>
and a.grid_level = '1' and a.delete_flag = '0'
</where>
group by a.grid_id,a.grid_name,a.grid_duty_type,a.grid_type,a.grid_level
</select>
<select id="selectSecGridList" parameterType="gridSelectInfo" resultMap="GridSelectInfoResult">
select distinct a.parent_grid_id,a.grid_id,a.grid_name,a.grid_duty_type,a.grid_type,a.grid_level,
sum(e.cust_num) as cust_num,sum(f.pos_num) as pos_num,sum(g.busi_num) as busi_num
from grid_region_grid a
inner join (select distinct grid_id,relate_dept_name from grid_region_user_relate where delete_flag = '0'
and (relate_dept_id in (select dept_id from sys_dept where dept_id = #{userDept} or find_in_set(#{userDept},ancestors)) or user_name = #{userDept})) b on a.grid_id = b.grid_id
inner join (select distinct grid_id,grid_name,parent_grid_id from grid_region_grid) d on a.parent_grid_id = d.grid_id
inner join (select code,grid_id from grid_region_admin_division_relate) h on a.grid_id = h.grid_id
left join (select region_code,count(distinct cust_id) as cust_num from cust_info_retail group by region_code) e on h.code = e.region_code
left join (select region_code,count(distinct cust_id) as pos_num from cust_info_merchant group by region_code) f on h.code = f.region_code
left join (select region_code,count(distinct cust_id) as busi_num from cust_info_business group by region_code) g on h.code = g.region_code
<where>
<if test="gridType != null and gridType != ''"> and a.grid_type = #{gridType}</if>
<if test="gridDutyType != null and gridDutyType != ''"> and a.grid_duty_type = #{gridDutyType}</if>
<if test="belongDept != null and belongDept != ''"> and b.relate_dept_name like concat('%',#{belongDept}, '%')</if>
<if test="topGridName != null and topGridName != ''"> and d.grid_name like concat('%',#{topGridName}, '%')</if>
<if test="secGridName != null and secGridName != ''"> and a.grid_name like concat('%',#{secGridName}, '%')</if>
and a.grid_level = '2' and a.delete_flag = '0'
</where>
group by a.parent_grid_id,a.grid_id,a.grid_name,a.grid_duty_type,a.grid_type,a.grid_level
</select>
<select id="selectGridName" parameterType="Long" resultType="java.lang.String" >
select grid_name from grid_region_grid
where grid_id = #{gridId}
</select>
<select id="getTopGridNumByDeptId" parameterType="Long" resultType="java.lang.Long">
select count(distinct a.grid_id) from grid_region_grid a,grid_region_user_relate b
where b.relate_dept_id in
(select dept_id from sys_dept where dept_id = #{headDeptId} or find_in_set(#{headDeptId},ancestors))
and a.grid_level = '1'
and a.delete_flag = '0'
and b.delete_flag = '0'
and (a.grid_id = b.grid_id or a.grid_id =b.parent_grid_id );
</select>
<select id="getSecGridNumByDeptId" parameterType="Long" resultType="java.lang.Long">
select count(distinct a.grid_id) from grid_region_grid a,grid_region_user_relate b
where b.relate_dept_id in
(select dept_id from sys_dept where dept_id = #{headDeptId} or find_in_set(#{headDeptId},ancestors))
and a.grid_level = '2'
and a.delete_flag = '0'
and b.delete_flag = '0'
and a.grid_id = b.grid_id ;
</select>
<select id="getTopGridNumByUserId" parameterType="String" resultType="java.lang.Long">
select count(distinct a.grid_id) from grid_region_grid a,grid_region_user_relate b
where b.user_name = #{UserId}
and a.grid_level = '1'
and a.delete_flag = '0'
and b.delete_flag = '0'
and (a.grid_id = b.grid_id or a.grid_id =b.parent_grid_id );
</select>
<select id="getSecGridNumByUserId" parameterType="String" resultType="java.lang.Long">
select count(distinct a.grid_id) from grid_region_grid a,grid_region_user_relate b
where b.user_name = #{UserId}
and a.grid_level = '2'
and a.delete_flag = '0'
and b.delete_flag = '0'
and a.grid_id = b.grid_id ;
</select>
<select id="getParentGridName" parameterType="Long" resultType="java.lang.String" >
select a.grid_name from grid_region_grid a , grid_region_grid b
where a.grid_id = b.parent_grid_id and b.grid_id = #{gridId}
</select>
<select id="getSecGridName" parameterType="Long" resultType="java.lang.String">
select group_concat(grid_name) from grid_region_grid
where parent_grid_id = #{gridId}
and delete_flag = '0'
and dept_id in
(select dept_id from sys_dept where dept_id = #{userDept} or find_in_set(#{userDept}, ancestors))
</select>
<select id="getParentGridDutyType" parameterType="Long" resultType="java.lang.String" >
select a.grid_duty_type from grid_region_grid a , grid_region_grid b
where a.grid_id = b.parent_grid_id and b.grid_id = #{gridId}
</select>
<select id="selectGridDutyType" parameterType="Long" resultType="java.lang.String" >
select grid_duty_type from grid_region_grid
where grid_id = #{gridId}
</select>
<select id="getSecGridNameByRegionCode" parameterType="String" resultType="java.lang.String" >
select distinct a.grid_name from grid_region_grid a,grid_region_admin_division_relate b
where b.code = #{regionCode} and a.grid_level ='2'
and a.grid_id = b.grid_id
and a.delete_flag = '0'
and b.delete_flag = '0'
</select>
<select id="getSecGridDutyTypeByRegionCode" parameterType="String" resultType="java.lang.String" >
select distinct a.grid_duty_type from grid_region_grid a,grid_region_admin_division_relate b
where b.code = #{regionCode} and a.grid_level ='2'
and a.grid_id = b.grid_id
and a.delete_flag = '0'
and b.delete_flag = '0'
</select>
<select id="getDeptListByRegionCode" resultType="Long">
select distinct a.relate_dept_id
from grid_region_user_relate a
left join grid_region_admin_division_relate b on a.grid_id = b.grid_id
where a.relate_type = '1'
and a.delete_flag = '0'
and b.delete_flag = '0'
and b.code = #{regionCode}
</select>
<select id="getUserListByRegionCode" resultType="String">
select distinct a.nick_name
from grid_region_user_relate a
left join grid_region_admin_division_relate b on a.grid_id = b.grid_id
where a.relate_type = '1'
and a.delete_flag = '0'
and b.delete_flag = '0'
and b.code = #{regionCode}
</select>
</mapper>

View File

@@ -0,0 +1,200 @@
<?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.grid.mapper.GridRegionUserRelateMapper">
<resultMap type="GridRegionUserRelate" id="GridRegionUserRelateResult">
<result property="id" column="id" />
<result property="gridId" column="grid_id" />
<result property="relateType" column="relate_type" />
<result property="userId" column="user_id" />
<result property="userName" column="user_name" />
<result property="deptId" column="dept_id" />
<result property="deptName" column="dept_name" />
<result property="deptType" column="dept_type" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="deleteFlag" column="delete_flag" />
</resultMap>
<resultMap type="CustManageInfo" id="CustManageInfoResult">
<result property="custId" column="cust_id" />
<result property="custName" column="cust_name" />
<result property="custNo" column="cust_idc" />
<result property="belongUserId" column="user_name" />
<result property="belongUserName" column="nick_name" />
<result property="custPattern" column="cust_type" />
<result property="regionCode" column="region_code" />
</resultMap>
<sql id="selectGridRegionUserRelateVo">
select id, grid_id, relate_type, user_id, user_name, dept_id, dept_name, dept_type, create_by, create_time, update_by, update_time, delete_flag from grid_region_user_relate
</sql>
<select id="selectGridRegionUserRelateList" parameterType="GridRegionUserRelate" resultMap="GridRegionUserRelateResult">
<include refid="selectGridRegionUserRelateVo"/>
<where>
<if test="gridId != null "> and grid_id = #{gridId}</if>
<if test="relateType != null and relateType != ''"> and relate_type = #{relateType}</if>
<if test="userId != null and userId != ''"> and user_id = #{userId}</if>
<if test="userName != null and userName != ''"> and user_name like concat('%', #{userName}, '%')</if>
<if test="deptId != null "> and dept_id = #{deptId}</if>
<if test="deptName != null and deptName != ''"> and dept_name like concat('%', #{deptName}, '%')</if>
<if test="deptType != null and deptType != ''"> and dept_type = #{deptType}</if>
<if test="deleteFlag != null and deleteFlag != ''"> and delete_flag = #{deleteFlag}</if>
</where>
</select>
<select id="selectGridRegionUserRelateById" parameterType="Long" resultMap="GridRegionUserRelateResult">
<include refid="selectGridRegionUserRelateVo"/>
where id = #{id}
</select>
<insert id="insertGridRegionUserRelate" parameterType="GridRegionUserRelate" useGeneratedKeys="true" keyProperty="id">
insert into grid_region_user_relate
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="gridId != null">grid_id,</if>
<if test="relateType != null">relate_type,</if>
<if test="userId != null">user_id,</if>
<if test="userName != null">user_name,</if>
<if test="deptId != null">dept_id,</if>
<if test="deptName != null">dept_name,</if>
<if test="deptType != null">dept_type,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="deleteFlag != null and deleteFlag != ''">delete_flag,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="gridId != null">#{gridId},</if>
<if test="relateType != null">#{relateType},</if>
<if test="userId != null">#{userId},</if>
<if test="userName != null">#{userName},</if>
<if test="deptId != null">#{deptId},</if>
<if test="deptName != null">#{deptName},</if>
<if test="deptType != null">#{deptType},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="deleteFlag != null and deleteFlag != ''">#{deleteFlag},</if>
</trim>
</insert>
<update id="updateGridRegionUserRelate" parameterType="GridRegionUserRelate">
update grid_region_user_relate
<trim prefix="SET" suffixOverrides=",">
<if test="gridId != null">grid_id = #{gridId},</if>
<if test="relateType != null">relate_type = #{relateType},</if>
<if test="userId != null">user_id = #{userId},</if>
<if test="userName != null">user_name = #{userName},</if>
<if test="deptId != null">dept_id = #{deptId},</if>
<if test="deptName != null">dept_name = #{deptName},</if>
<if test="deptType != null">dept_type = #{deptType},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="deleteFlag != null and deleteFlag != ''">delete_flag = #{deleteFlag},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteGridRegionUserRelateById" parameterType="Long">
delete from grid_region_user_relate where id = #{id}
</delete>
<delete id="deleteGridRegionUserRelateByIds" parameterType="String">
delete from grid_region_user_relate where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<select id="selectGridRegionUserByGridId" parameterType="Long" resultType="java.lang.String" >
select b.nick_name from grid_region_user_relate a,sys_user b
where a.grid_id = #{gridId}
and a.delete_flag = '0'
and (a.relate_dept_id in
(select dept_id from sys_dept where dept_id = #{userDept} or find_in_set(#{userDept}, ancestors)) or
a.user_name = #{userDept})
and a.user_name = b.user_name
</select>
<select id="selectGridRegionDeptByGridId" parameterType="Long" resultType="java.lang.String">
select distinct relate_dept_name from grid_region_user_relate
where grid_id = #{gridId}
and relate_dept_type = 'branch'
and delete_flag = '0'
</select>
<select id="selectGridRegionDeptTypeByGridId" parameterType="Long" resultType="java.lang.String">
select distinct relate_dept_name from grid_region_user_relate
where grid_id = #{gridId} and (relate_dept_id in (select dept_id from sys_dept where dept_id = #{userDept} or find_in_set(#{userDept},ancestors)) or user_name = #{userDept}) and relate_dept_type ='outlet'
</select>
<select id="selectHeadDeptExist" parameterType="Long" resultType="java.lang.String">
select distinct relate_dept_name from grid_region_user_relate
where grid_id = #{gridId}
and relate_dept_type = 'head'
and delete_flag = '0'
</select>
<select id="selectGridRegionDeptByUserId" resultType="java.lang.String">
select distinct relate_dept_name from grid_region_user_relate
where user_name = #{userId} and (parent_grid_id = #{gridId} or grid_id = #{gridId})and relate_dept_type = #{deptType} limit 1
</select>
<select id="selectCustInfoByManage" parameterType="CustManageInfo" resultMap="CustManageInfoResult">
select distinct a.cust_id,a.cust_name,a.cust_idc,a.region_code,c.user_name,c.nick_name,'0' as cust_type from cust_info_retail a
inner join (select distinct code,grid_id from grid_region_admin_division_relate) b on b.code =a.region_code
inner join (select distinct grid_id,relate_dept_id,user_name,nick_name from grid_region_user_relate where delete_flag ='0'
and (relate_dept_id in (select dept_id from sys_dept where dept_id = #{userDept} or find_in_set(#{userDept},ancestors)) or user_name =#{userDept})) c
on b.grid_id = c.grid_id
where c.grid_id = #{gridId}
<if test="custName != null and custName != ''"> and a.cust_name like concat('%', #{custName}, '%') </if>
<if test="custId != null and custId != ''"> and a.cust_id like concat('%', #{custId}, '%') </if>
<if test="custNo != null and custNo != ''"> and a.cust_idc like concat('%', #{custNo}, '%') </if>
<if test="distributeTag != null and distributeTag != ''">
and case when #{distributeTag} = '0' then exists (select * from sys_grid_user_cust d where d.grid_id = #{gridId} and a.cust_id =d.cust_id and c.user_name = d.user_name)
when #{distributeTag} = '1' then not exists (select * from sys_grid_user_cust d where d.grid_id = #{gridId} and a.cust_id =d.cust_id and c.user_name = d.user_name)
else 1=1 end
</if>
union all
select distinct a.cust_id,a.cust_name,a.social_credit_code,a.region_code,c.user_name,c.nick_name,'1' as cust_type from cust_info_merchant a
inner join (select distinct code,grid_id from grid_region_admin_division_relate) b on b.code =a.region_code
inner join (select distinct grid_id,relate_dept_id,user_name,nick_name from grid_region_user_relate where delete_flag ='0'
and (relate_dept_id in (select dept_id from sys_dept where dept_id = #{userDept} or find_in_set(#{userDept},ancestors)) or user_name =#{userDept})) c
on b.grid_id = c.grid_id
where c.grid_id = #{gridId}
<if test="custName != null and custName != ''"> and a.cust_name like concat('%', #{custName}, '%') </if>
<if test="custId != null and custId != ''"> and a.cust_id like concat('%', #{custId}, '%') </if>
<if test="custNo != null and custNo != ''"> and a.social_credit_code like concat('%', #{custNo}, '%') </if>
<if test="distributeTag != null and distributeTag != ''">
and case when #{distributeTag} = '0' then exists (select * from sys_grid_user_cust d where d.grid_id = #{gridId} and a.cust_id =d.cust_id and c.user_name = d.user_name)
when #{distributeTag} = '1' then not exists (select * from sys_grid_user_cust d where d.grid_id = #{gridId} and a.cust_id =d.cust_id and c.user_name = d.user_name)
else 1=1 end
</if>
union all
select distinct a.cust_id,a.cust_name,a.social_credit_code,a.region_code,c.user_name,c.nick_name,'2' as cust_type from cust_info_business a
inner join (select distinct code,grid_id from grid_region_admin_division_relate) b on b.code =a.region_code
inner join (select distinct grid_id,relate_dept_id,user_name,nick_name from grid_region_user_relate where delete_flag ='0'
and (relate_dept_id in (select dept_id from sys_dept where dept_id = #{userDept} or find_in_set(#{userDept},ancestors)) or user_name =#{userDept})) c
on b.grid_id = c.grid_id
where c.grid_id = #{gridId}
<if test="custName != null and custName != ''"> and a.cust_name like concat('%', #{custName}, '%') </if>
<if test="custId != null and custId != ''"> and a.cust_id like concat('%', #{custId}, '%') </if>
<if test="custNo != null and custNo != ''"> and a.social_credit_code like concat('%', #{custNo}, '%') </if>
<if test="distributeTag != null and distributeTag != ''">
and case when #{distributeTag} = '0' then exists (select * from sys_grid_user_cust d where d.grid_id = #{gridId} and a.cust_id =d.cust_id and c.user_name = d.user_name)
when #{distributeTag} = '1' then not exists (select * from sys_grid_user_cust d where d.grid_id = #{gridId} and a.cust_id =d.cust_id and c.user_name = d.user_name)
else 1=1 end
</if>
</select>
</mapper>

View File

@@ -0,0 +1,96 @@
<?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.customerselect.mapper.GridSelectMapper">
<select id="getRegionGridList" resultType="GridSelectVO">
select distinct a.grid_name, a.grid_id
from grid_region_grid a
left join sys_dept b on a.dept_id = b.dept_id
left join grid_region_user_relate c on c.grid_id = a.grid_id
where a.delete_flag = '0' and c.delete_flag = '0' and a.grid_level = #{gridLevel} and a.ops_dept = #{opsDept}
<if test="deptId != null and deptId != ''">
and (a.dept_id in (select dept_id from sys_dept where dept_id = #{deptId} or find_in_set(#{deptId}, ancestors))
or
c.relate_dept_id in (select dept_id from sys_dept where dept_id = #{deptId} or find_in_set(#{deptId},ancestors)))
</if>
<if test="userName != null and userName != ''">
and c.user_name = #{userName}
</if>
</select>
<select id="getVirtualGridList" resultType="GridSelectVO">
SELECT distinct a.grid_name, a.grid_id
FROM grid_virtual_grid a
left join grid_virtual_cust_user c on c.grid_id = a.grid_id
WHERE a.delete_flag = '0' and a.ops_dept = #{opsDept}
<if test="deptId != null and deptId != ''">
and (a.dept_id in (select dept_id from sys_dept where dept_id = #{deptId} or find_in_set(#{deptId}, ancestors))
or
c.relate_dept_id in (select dept_id from sys_dept where dept_id = #{deptId} or find_in_set(#{deptId},ancestors)))
</if>
<if test="userName != null and userName != ''">
and c.user_name = #{userName}
</if>
</select>
<select id="getDrawGridList" resultType="GridSelectVO">
SELECT distinct a.grid_name, a.grid_id
FROM grid_draw_grid a
left join grid_draw_user_relate c on a.grid_id = c.grid_id
WHERE a.delete_flag = '0' and c.delete_flag = '0' and a.ops_dept = #{opsDept}
<if test="deptId != null and deptId != ''">
and (a.dept_id in (select dept_id from sys_dept where dept_id = #{deptId} or find_in_set(#{deptId}, ancestors))
or
c.relate_dept_id in (select dept_id from sys_dept where dept_id = #{deptId} or find_in_set(#{deptId},ancestors)))
</if>
<if test="userName != null and userName != ''">
and c.user_name = #{userName}
</if>
</select>
<select id="getDrawGridRelate" resultType="GridRelateVO">
select a.cust_id as cust_id,
group_concat(distinct concat(c.nick_name,'-',c.user_name)) as user_names,
group_concat(distinct d.grid_name) as grid_names,
group_concat(distinct c.relate_branch_name) as branch_names,
group_concat(distinct c.relate_outlet_name) as outlet_names
from draw_shape_cust a
left join grid_draw_shape_relate b on a.shape_id = b.shape_id
left join grid_draw_user_relate c on c.grid_id = b.grid_id
left join grid_draw_grid d on c.grid_id = d.grid_id
where a.cust_id in
<foreach collection="custIds" item="custId" open="(" separator="," close=")">
#{custId}
</foreach>
group by a.cust_id
</select>
<select id="getRegionGridRelate" resultType="GridRelateVO" >
select a.cust_id, a.nick_names as user_names, a.top_grid_name, a.sec_grid_name, a.branch_names, a.outlet_names
from grid_region_cust_user a
where cust_id in
<foreach collection="custIds" item="custId" open="(" separator="," close=")">
#{custId}
</foreach>
</select>
<select id="getVirtualGridRelate" resultType="GridRelateVO">
select cust_id,
group_concat(distinct concat(user_name,'-',nick_name)) as user_names,
group_concat(distinct relate_dept_id) as dept_ids,
group_concat(distinct b.grid_name) as grid_names
from grid_virtual_cust_user a
left join grid_virtual_grid b on a.grid_id = b.grid_id
where cust_id in
<foreach collection="custIds" item="custId" open="(" separator="," close=")">
#{custId}
</foreach>
<if test="userName != null and userName != ''">
and a.user_name = #{userName}
</if>
group by cust_id;
</select>
</mapper>

View File

@@ -0,0 +1,319 @@
<?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.customerselect.mapper.GridSummarCountMapper">
<resultMap type="GridSummarCount" id="GridSummarCountResult">
<result property="dt" column="dt" />
<result property="gridName" column="grid_name" />
<result property="gridName2" column="grid_name2" />
<result property="town" column="town" />
<result property="deptId" column="dept_id" />
<result property="outletsId" column="outlets_id" />
<result property="userName" column="user_name" />
<result property="custNum" column="cust_num" />
<result property="hqCurBalance" column="hq_cur_balance" />
<result property="bzCurBalance" column="bz_cur_balance" />
<result property="loanBalanceCny" column="loan_balance_cny" />
<result property="financeProd711Balance" column="finance_prod_711_balance" />
<result property="financeProd716Balance" column="finance_prod_716_balance" />
<result property="loanYearDailyaverage" column="loan_year_dailyaverage" />
<result property="phRat" column="ph_rat" />
<result property="qfcdRat" column="qfcd_rat" />
<result property="txRat" column="tx_rat" />
<result property="bhRat" column="bh_rat" />
<result property="yxdfgzRat" column="yxdfgz_rat" />
<result property="dkdfRat" column="dkdf_rat" />
<result property="dksfRat" column="dksf_rat" />
<result property="dkshfRat" column="dkshf_rat" />
<result property="pjbRat" column="pjb_rat" />
<result property="czbRat" column="czb_rat" />
<result property="sfbRat" column="sfb_rat" />
<result property="mrbRat" column="mrb_rat" />
<result property="szstRat" column="szst_rat" />
<result property="khRat" column="kh_rat" />
<result property="gjjsywRat" column="gjjsyw_rat" />
<result property="yqjshRat" column="yqjsh_rat" />
<result property="phNum" column="ph_num" />
<result property="qfcdNum" column="qfcd_num" />
<result property="txNum" column="tx_num" />
<result property="bhNum" column="bh_num" />
<result property="yxdfgzNum" column="yxdfgz_num" />
<result property="dkdfNum" column="dkdf_num" />
<result property="dksfNum" column="dksf_num" />
<result property="dkshfNum" column="dkshf_num" />
<result property="pjbNum" column="pjb_num" />
<result property="czbNum" column="czb_num" />
<result property="sfbNum" column="sfb_num" />
<result property="mrbNum" column="mrb_num" />
<result property="szstNum" column="szst_num" />
<result property="khNum" column="kh_num" />
<result property="gjjsywNum" column="gjjsyw_num" />
<result property="yqjshNum" column="yqjsh_num" />
<result property="regionCode" column="region_code" />
<result property="opsDept" column="ops_dept" />
</resultMap>
<sql id="selectGridSummarCountVo">
select dt, grid_name, grid_name2, town, dept_id, outlets_id, user_name, cust_num, hq_cur_balance, bz_cur_balance, loan_balance_cny, finance_prod_711_balance, finance_prod_716_balance, loan_year_dailyaverage, ph_rat, qfcd_rat, tx_rat, bh_rat, yxdfgz_rat, dkdf_rat, dksf_rat, dkshf_rat, pjb_rat, czb_rat, sfb_rat, mrb_rat, szst_rat, kh_rat, gjjsyw_rat, yqjsh_rat, ph_num, qfcd_num, tx_num, bh_num, yxdfgz_num, dkdf_num, dksf_num, dkshf_num, pjb_num, czb_num, sfb_num, mrb_num, szst_num, kh_num, gjjsyw_num, yqjsh_num, region_code, ops_dept from grid_cmpm_count_gongsi_965
</sql>
<select id="selectContinuousParams" parameterType="com.ruoyi.ibs.customerselect.domain.CustBaseInfo" resultType="map">
SELECT
dict_label AS par_key,dict_value AS par_value FROM sys_dict_data
WHERE 1=1
<choose>
<when test="custPattern == 0 or custPattern == 1">
AND dict_type = 'continuous_ds_metric'
</when>
<when test="custPattern == 2">
AND dict_type = 'continuous_dg_metric'
</when>
</choose>
</select>
<select id="selectDiscreteParams" parameterType="com.ruoyi.ibs.customerselect.domain.CustBaseInfo" resultType="map">
SELECT
dict_label AS par_key,dict_value AS par_value FROM sys_dict_data
WHERE 1=1
<if test="custPattern == 0 or custPattern == 1">
and dict_type = 'discrete_ds_metric'
</if>
<if test="custPattern == 2">
and dict_type = 'discrete_dg_metric'
</if>
</select>
<select id="selectDictLabelByDictValue" parameterType="String" resultType="String">
select dict_label from sys_dict_data where dict_value = #{dictValue} limit 1
</select>
<select id="selectGridSummarCountList" parameterType="GridSummarCount" resultMap="GridSummarCountResult">
<include refid="selectGridSummarCountVo"/>
<where>
<if test="dt != null and dt != ''"> and dt = #{dt}</if>
<if test="gridName != null and gridName != ''"> and grid_name like concat('%', #{gridName}, '%')</if>
<if test="gridName2 != null and gridName2 != ''"> and grid_name2 = #{gridName2}</if>
<if test="town != null and town != ''"> and town = #{town}</if>
<if test="deptId != null and deptId != ''"> and dept_id = #{deptId}</if>
<if test="outletsId != null and outletsId != ''"> and outlets_id = #{outletsId}</if>
<if test="userName != null and userName != ''"> and user_name like concat('%', #{userName}, '%')</if>
<if test="custNum != null "> and cust_num = #{custNum}</if>
<if test="hqCurBalance != null and hqCurBalance != ''"> and hq_cur_balance = #{hqCurBalance}</if>
<if test="bzCurBalance != null and bzCurBalance != ''"> and bz_cur_balance = #{bzCurBalance}</if>
<if test="loanBalanceCny != null and loanBalanceCny != ''"> and loan_balance_cny = #{loanBalanceCny}</if>
<if test="financeProd711Balance != null and financeProd711Balance != ''"> and finance_prod_711_balance = #{financeProd711Balance}</if>
<if test="financeProd716Balance != null and financeProd716Balance != ''"> and finance_prod_716_balance = #{financeProd716Balance}</if>
<if test="loanYearDailyaverage != null and loanYearDailyaverage != ''"> and loan_year_dailyaverage = #{loanYearDailyaverage}</if>
<if test="phRat != null and phRat != ''"> and ph_rat = #{phRat}</if>
<if test="qfcdRat != null and qfcdRat != ''"> and qfcd_rat = #{qfcdRat}</if>
<if test="txRat != null and txRat != ''"> and tx_rat = #{txRat}</if>
<if test="bhRat != null and bhRat != ''"> and bh_rat = #{bhRat}</if>
<if test="yxdfgzRat != null and yxdfgzRat != ''"> and yxdfgz_rat = #{yxdfgzRat}</if>
<if test="dkdfRat != null and dkdfRat != ''"> and dkdf_rat = #{dkdfRat}</if>
<if test="dksfRat != null and dksfRat != ''"> and dksf_rat = #{dksfRat}</if>
<if test="dkshfRat != null and dkshfRat != ''"> and dkshf_rat = #{dkshfRat}</if>
<if test="pjbRat != null and pjbRat != ''"> and pjb_rat = #{pjbRat}</if>
<if test="czbRat != null and czbRat != ''"> and czb_rat = #{czbRat}</if>
<if test="sfbRat != null and sfbRat != ''"> and sfb_rat = #{sfbRat}</if>
<if test="mrbRat != null and mrbRat != ''"> and mrb_rat = #{mrbRat}</if>
<if test="szstRat != null and szstRat != ''"> and szst_rat = #{szstRat}</if>
<if test="khRat != null and khRat != ''"> and kh_rat = #{khRat}</if>
<if test="gjjsywRat != null and gjjsywRat != ''"> and gjjsyw_rat = #{gjjsywRat}</if>
<if test="yqjshRat != null and yqjshRat != ''"> and yqjsh_rat = #{yqjshRat}</if>
<if test="phNum != null "> and ph_num = #{phNum}</if>
<if test="qfcdNum != null "> and qfcd_num = #{qfcdNum}</if>
<if test="txNum != null "> and tx_num = #{txNum}</if>
<if test="bhNum != null "> and bh_num = #{bhNum}</if>
<if test="yxdfgzNum != null "> and yxdfgz_num = #{yxdfgzNum}</if>
<if test="dkdfNum != null "> and dkdf_num = #{dkdfNum}</if>
<if test="dksfNum != null "> and dksf_num = #{dksfNum}</if>
<if test="dkshfNum != null "> and dkshf_num = #{dkshfNum}</if>
<if test="pjbNum != null "> and pjb_num = #{pjbNum}</if>
<if test="czbNum != null "> and czb_num = #{czbNum}</if>
<if test="sfbNum != null "> and sfb_num = #{sfbNum}</if>
<if test="mrbNum != null "> and mrb_num = #{mrbNum}</if>
<if test="szstNum != null "> and szst_num = #{szstNum}</if>
<if test="khNum != null "> and kh_num = #{khNum}</if>
<if test="gjjsywNum != null "> and gjjsyw_num = #{gjjsywNum}</if>
<if test="yqjshNum != null "> and yqjsh_num = #{yqjshNum}</if>
<if test="regionCode != null and regionCode != ''"> and region_code = #{regionCode}</if>
<if test="opsDept != null and opsDept != ''"> and ops_dept = #{opsDept}</if>
</where>
</select>
<select id="selectGridSummarCountByDt" parameterType="String" resultMap="GridSummarCountResult">
<include refid="selectGridSummarCountVo"/>
where dt = #{dt}
</select>
<insert id="insertGridSummarCount" parameterType="GridSummarCount">
insert into grid_cmpm_count_gongsi_965
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="dt != null">dt,</if>
<if test="gridName != null">grid_name,</if>
<if test="gridName2 != null">grid_name2,</if>
<if test="town != null">town,</if>
<if test="deptId != null">dept_id,</if>
<if test="outletsId != null">outlets_id,</if>
<if test="userName != null">user_name,</if>
<if test="custNum != null">cust_num,</if>
<if test="hqCurBalance != null">hq_cur_balance,</if>
<if test="bzCurBalance != null">bz_cur_balance,</if>
<if test="loanBalanceCny != null">loan_balance_cny,</if>
<if test="financeProd711Balance != null">finance_prod_711_balance,</if>
<if test="financeProd716Balance != null">finance_prod_716_balance,</if>
<if test="loanYearDailyaverage != null">loan_year_dailyaverage,</if>
<if test="phRat != null">ph_rat,</if>
<if test="qfcdRat != null">qfcd_rat,</if>
<if test="txRat != null">tx_rat,</if>
<if test="bhRat != null">bh_rat,</if>
<if test="yxdfgzRat != null">yxdfgz_rat,</if>
<if test="dkdfRat != null">dkdf_rat,</if>
<if test="dksfRat != null">dksf_rat,</if>
<if test="dkshfRat != null">dkshf_rat,</if>
<if test="pjbRat != null">pjb_rat,</if>
<if test="czbRat != null">czb_rat,</if>
<if test="sfbRat != null">sfb_rat,</if>
<if test="mrbRat != null">mrb_rat,</if>
<if test="szstRat != null">szst_rat,</if>
<if test="khRat != null">kh_rat,</if>
<if test="gjjsywRat != null">gjjsyw_rat,</if>
<if test="yqjshRat != null">yqjsh_rat,</if>
<if test="phNum != null">ph_num,</if>
<if test="qfcdNum != null">qfcd_num,</if>
<if test="txNum != null">tx_num,</if>
<if test="bhNum != null">bh_num,</if>
<if test="yxdfgzNum != null">yxdfgz_num,</if>
<if test="dkdfNum != null">dkdf_num,</if>
<if test="dksfNum != null">dksf_num,</if>
<if test="dkshfNum != null">dkshf_num,</if>
<if test="pjbNum != null">pjb_num,</if>
<if test="czbNum != null">czb_num,</if>
<if test="sfbNum != null">sfb_num,</if>
<if test="mrbNum != null">mrb_num,</if>
<if test="szstNum != null">szst_num,</if>
<if test="khNum != null">kh_num,</if>
<if test="gjjsywNum != null">gjjsyw_num,</if>
<if test="yqjshNum != null">yqjsh_num,</if>
<if test="regionCode != null">region_code,</if>
<if test="opsDept != null">ops_dept,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="dt != null">#{dt},</if>
<if test="gridName != null">#{gridName},</if>
<if test="gridName2 != null">#{gridName2},</if>
<if test="town != null">#{town},</if>
<if test="deptId != null">#{deptId},</if>
<if test="outletsId != null">#{outletsId},</if>
<if test="userName != null">#{userName},</if>
<if test="custNum != null">#{custNum},</if>
<if test="hqCurBalance != null">#{hqCurBalance},</if>
<if test="bzCurBalance != null">#{bzCurBalance},</if>
<if test="loanBalanceCny != null">#{loanBalanceCny},</if>
<if test="financeProd711Balance != null">#{financeProd711Balance},</if>
<if test="financeProd716Balance != null">#{financeProd716Balance},</if>
<if test="loanYearDailyaverage != null">#{loanYearDailyaverage},</if>
<if test="phRat != null">#{phRat},</if>
<if test="qfcdRat != null">#{qfcdRat},</if>
<if test="txRat != null">#{txRat},</if>
<if test="bhRat != null">#{bhRat},</if>
<if test="yxdfgzRat != null">#{yxdfgzRat},</if>
<if test="dkdfRat != null">#{dkdfRat},</if>
<if test="dksfRat != null">#{dksfRat},</if>
<if test="dkshfRat != null">#{dkshfRat},</if>
<if test="pjbRat != null">#{pjbRat},</if>
<if test="czbRat != null">#{czbRat},</if>
<if test="sfbRat != null">#{sfbRat},</if>
<if test="mrbRat != null">#{mrbRat},</if>
<if test="szstRat != null">#{szstRat},</if>
<if test="khRat != null">#{khRat},</if>
<if test="gjjsywRat != null">#{gjjsywRat},</if>
<if test="yqjshRat != null">#{yqjshRat},</if>
<if test="phNum != null">#{phNum},</if>
<if test="qfcdNum != null">#{qfcdNum},</if>
<if test="txNum != null">#{txNum},</if>
<if test="bhNum != null">#{bhNum},</if>
<if test="yxdfgzNum != null">#{yxdfgzNum},</if>
<if test="dkdfNum != null">#{dkdfNum},</if>
<if test="dksfNum != null">#{dksfNum},</if>
<if test="dkshfNum != null">#{dkshfNum},</if>
<if test="pjbNum != null">#{pjbNum},</if>
<if test="czbNum != null">#{czbNum},</if>
<if test="sfbNum != null">#{sfbNum},</if>
<if test="mrbNum != null">#{mrbNum},</if>
<if test="szstNum != null">#{szstNum},</if>
<if test="khNum != null">#{khNum},</if>
<if test="gjjsywNum != null">#{gjjsywNum},</if>
<if test="yqjshNum != null">#{yqjshNum},</if>
<if test="regionCode != null">#{regionCode},</if>
<if test="opsDept != null">#{opsDept},</if>
</trim>
</insert>
<update id="updateGridSummarCount" parameterType="GridSummarCount">
update grid_cmpm_count_gongsi_965
<trim prefix="SET" suffixOverrides=",">
<if test="gridName != null">grid_name = #{gridName},</if>
<if test="gridName2 != null">grid_name2 = #{gridName2},</if>
<if test="town != null">town = #{town},</if>
<if test="deptId != null">dept_id = #{deptId},</if>
<if test="outletsId != null">outlets_id = #{outletsId},</if>
<if test="userName != null">user_name = #{userName},</if>
<if test="custNum != null">cust_num = #{custNum},</if>
<if test="hqCurBalance != null">hq_cur_balance = #{hqCurBalance},</if>
<if test="bzCurBalance != null">bz_cur_balance = #{bzCurBalance},</if>
<if test="loanBalanceCny != null">loan_balance_cny = #{loanBalanceCny},</if>
<if test="financeProd711Balance != null">finance_prod_711_balance = #{financeProd711Balance},</if>
<if test="financeProd716Balance != null">finance_prod_716_balance = #{financeProd716Balance},</if>
<if test="loanYearDailyaverage != null">loan_year_dailyaverage = #{loanYearDailyaverage},</if>
<if test="phRat != null">ph_rat = #{phRat},</if>
<if test="qfcdRat != null">qfcd_rat = #{qfcdRat},</if>
<if test="txRat != null">tx_rat = #{txRat},</if>
<if test="bhRat != null">bh_rat = #{bhRat},</if>
<if test="yxdfgzRat != null">yxdfgz_rat = #{yxdfgzRat},</if>
<if test="dkdfRat != null">dkdf_rat = #{dkdfRat},</if>
<if test="dksfRat != null">dksf_rat = #{dksfRat},</if>
<if test="dkshfRat != null">dkshf_rat = #{dkshfRat},</if>
<if test="pjbRat != null">pjb_rat = #{pjbRat},</if>
<if test="czbRat != null">czb_rat = #{czbRat},</if>
<if test="sfbRat != null">sfb_rat = #{sfbRat},</if>
<if test="mrbRat != null">mrb_rat = #{mrbRat},</if>
<if test="szstRat != null">szst_rat = #{szstRat},</if>
<if test="khRat != null">kh_rat = #{khRat},</if>
<if test="gjjsywRat != null">gjjsyw_rat = #{gjjsywRat},</if>
<if test="yqjshRat != null">yqjsh_rat = #{yqjshRat},</if>
<if test="phNum != null">ph_num = #{phNum},</if>
<if test="qfcdNum != null">qfcd_num = #{qfcdNum},</if>
<if test="txNum != null">tx_num = #{txNum},</if>
<if test="bhNum != null">bh_num = #{bhNum},</if>
<if test="yxdfgzNum != null">yxdfgz_num = #{yxdfgzNum},</if>
<if test="dkdfNum != null">dkdf_num = #{dkdfNum},</if>
<if test="dksfNum != null">dksf_num = #{dksfNum},</if>
<if test="dkshfNum != null">dkshf_num = #{dkshfNum},</if>
<if test="pjbNum != null">pjb_num = #{pjbNum},</if>
<if test="czbNum != null">czb_num = #{czbNum},</if>
<if test="sfbNum != null">sfb_num = #{sfbNum},</if>
<if test="mrbNum != null">mrb_num = #{mrbNum},</if>
<if test="szstNum != null">szst_num = #{szstNum},</if>
<if test="khNum != null">kh_num = #{khNum},</if>
<if test="gjjsywNum != null">gjjsyw_num = #{gjjsywNum},</if>
<if test="yqjshNum != null">yqjsh_num = #{yqjshNum},</if>
<if test="regionCode != null">region_code = #{regionCode},</if>
<if test="opsDept != null">ops_dept = #{opsDept},</if>
</trim>
where dt = #{dt}
</update>
<delete id="deleteGridSummarCountByDt" parameterType="String">
delete from grid_cmpm_count_gongsi_965 where dt = #{dt}
</delete>
<delete id="deleteGridSummarCountByDts" parameterType="String">
delete from grid_cmpm_count_gongsi_965 where dt in
<foreach item="dt" collection="array" open="(" separator="," close=")">
#{dt}
</foreach>
</delete>
</mapper>

View File

@@ -0,0 +1,12 @@
<?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.grid.mapper.GridTeamBuildMapper">
<select id="selectGridTeamBuildList" resultType="GridTeamBuildListVO">
select id,relate_name,phone_num,position,town,village,outlet,grid_charger,grid_manager
from grid_team_build
</select>
</mapper>

View File

@@ -0,0 +1,154 @@
<?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.grid.mapper.GridVirtualCustomerRelateMapper">
<resultMap type="GridVirtualCustomerRelate" id="GridVirtualCustomerRelateResult">
<result property="id" column="id" />
<result property="gridId" column="grid_id" />
<result property="custType" column="cust_type" />
<result property="custId" column="cust_id" />
<result property="custName" column="cust_name" />
<result property="deptId" column="dept_id" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="deleteFlag" column="delete_flag" />
</resultMap>
<sql id="selectGridVirtualCustomerRelateVo">
select id, grid_id, cust_type, cust_id, cust_name, dept_id, create_by, create_time, update_by, update_time, delete_flag from grid_virtual_customer_relate
</sql>
<select id="selectGridVirtualCustomerRelateList" parameterType="GridVirtualCustomerRelate" resultMap="GridVirtualCustomerRelateResult">
<include refid="selectGridVirtualCustomerRelateVo"/>
<where>
<if test="gridId != null "> and grid_id = #{gridId}</if>
<if test="custType != null and custType != ''"> and cust_type = #{custType}</if>
<if test="custId != null and custId != ''"> and cust_id = #{custId}</if>
<if test="custName != null and custName != ''"> and cust_name like concat('%', #{custName}, '%')</if>
<if test="deptId != null "> and dept_id = #{deptId}</if>
<if test="deleteFlag != null and deleteFlag != ''"> and delete_flag = #{deleteFlag}</if>
</where>
</select>
<select id="selectGridVirtualCustomerRelateById" parameterType="Long" resultMap="GridVirtualCustomerRelateResult">
<include refid="selectGridVirtualCustomerRelateVo"/>
where id = #{id}
</select>
<insert id="insertGridVirtualCustomerRelate" parameterType="GridVirtualCustomerRelate" useGeneratedKeys="true" keyProperty="id">
insert into grid_virtual_customer_relate
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="gridId != null">grid_id,</if>
<if test="custType != null">cust_type,</if>
<if test="custId != null">cust_id,</if>
<if test="custName != null">cust_name,</if>
<if test="deptId != null">dept_id,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="deleteFlag != null and deleteFlag != ''">delete_flag,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="gridId != null">#{gridId},</if>
<if test="custType != null">#{custType},</if>
<if test="custId != null">#{custId},</if>
<if test="custName != null">#{custName},</if>
<if test="deptId != null">#{deptId},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="deleteFlag != null and deleteFlag != ''">#{deleteFlag},</if>
</trim>
</insert>
<update id="updateGridVirtualCustomerRelate" parameterType="GridVirtualCustomerRelate">
update grid_virtual_customer_relate
<trim prefix="SET" suffixOverrides=",">
<if test="gridId != null">grid_id = #{gridId},</if>
<if test="custType != null">cust_type = #{custType},</if>
<if test="custId != null">cust_id = #{custId},</if>
<if test="custName != null">cust_name = #{custName},</if>
<if test="deptId != null">dept_id = #{deptId},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="deleteFlag != null and deleteFlag != ''">delete_flag = #{deleteFlag},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteGridVirtualCustomerRelateById" parameterType="Long">
delete from grid_virtual_customer_relate where id = #{id}
</delete>
<delete id="deleteGridVirtualCustomerRelateByIds" parameterType="String">
delete from grid_virtual_customer_relate where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<select id="getRetailNumByGridId" parameterType="Long">
select count(*) from grid_virtual_customer_relate a,cust_info_retail b
where a.grid_id = #{gridId} and a.cust_type = '个人' and a.cust_id = b.cust_id
</select>
<select id="getMerchantNumByGridId" parameterType="Long">
select count(*) from grid_virtual_customer_relate a,cust_info_merchant b
where a.grid_id = #{gridId} and a.cust_type = '商户' and a.cust_id = b.cust_id
</select>
<select id="getBusiNumByGridId" parameterType="Long">
select count(*) from grid_virtual_customer_relate a,cust_info_business b
where a.grid_id = #{gridId} and a.cust_type = '企业' and a.cust_id = b.cust_id
</select>
<select id="selectunDisCustByVirtualList" parameterType="CustManageInfo">
select b.* from cust_info_retail a inner join grid_virtual_customer_relate b on b.cust_id =a.cust_id
where b.grid_id = #{gridId} and a.belong_user_name = ''
<if test="custName != null and custName != ''"> and a.cust_name like concat('%', #{custName}, '%') </if>
<if test="custId != null and custId != ''"> and a.cust_id like concat('%', #{custId}, '%') </if>
group by a.cust_id
union all
select b.* from cust_info_merchant a inner join grid_virtual_customer_relate b on b.cust_id =a.cust_id
where b.grid_id = #{gridId} and a.belong_user_name = ''
<if test="custName != null and custName != ''"> and a.cust_name like concat('%', #{custName}, '%') </if>
<if test="custId != null and custId != ''"> and a.cust_id like concat('%', #{custId}, '%') </if>
group by a.cust_id
union all
select b.* from cust_info_business a inner join grid_virtual_customer_relate b on b.cust_id =a.cust_id
where b.grid_id = #{gridId} and a.belong_user_name = ''
<if test="custName != null and custName != ''"> and a.cust_name like concat('%', #{custName}, '%') </if>
<if test="custId != null and custId != ''"> and a.cust_id like concat('%', #{custId}, '%') </if>
group by a.cust_id
</select>
<select id="selectCustByVirtualList" parameterType="CustManageInfo">
select b.* from cust_info_retail a inner join grid_virtual_customer_relate b on b.cust_id =a.cust_id
where b.grid_id = #{gridId}
<if test="custName != null and custName != ''"> and a.cust_name like concat('%', #{custName}, '%') </if>
<if test="custId != null and custId != ''"> and a.cust_id like concat('%', #{custId}, '%') </if>
group by a.cust_id
union all
select b.* from cust_info_merchant a inner join grid_virtual_customer_relate b on b.cust_id =a.cust_id
where b.grid_id = #{gridId}
<if test="custName != null and custName != ''"> and a.cust_name like concat('%', #{custName}, '%') </if>
<if test="custId != null and custId != ''"> and a.cust_id like concat('%', #{custId}, '%') </if>
group by a.cust_id
union all
select b.* from cust_info_business a inner join grid_virtual_customer_relate b on b.cust_id =a.cust_id
where b.grid_id = #{gridId}
<if test="custName != null and custName != ''"> and a.cust_name like concat('%', #{custName}, '%') </if>
<if test="custId != null and custId != ''"> and a.cust_id like concat('%', #{custId}, '%') </if>
group by a.cust_id
</select>
</mapper>

View File

@@ -0,0 +1,244 @@
<?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.grid.mapper.GridVirtualGridMapper">
<resultMap type="GridVirtualGrid" id="GridVirtualGridResult">
<result property="gridId" column="grid_id" />
<result property="gridName" column="grid_name" />
<result property="gridType" column="grid_type" />
<result property="hasRetail" column="has_retail" />
<result property="hasBusiness" column="has_business" />
<result property="hasRetailBusiness" column="has_retail_business" />
<result property="gridAssignType" column="grid_assign_type" />
<result property="gridDutyType" column="grid_duty_type" />
<result property="deptId" column="dept_id" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="deleteFlag" column="delete_flag" />
</resultMap>
<resultMap type="VirtualGridSelectInfo" id="VirtualGridSelectInfoResult">
<result property="gridId" column="grid_id" />
<result property="virtualGridName" column="grid_name" />
<result property="gridType" column="grid_type" />
<result property="gridDutyType" column="grid_duty_type" />
<result property="createRole" column="dept_type" />
<result property="custNum" column="cust_num" />
<result property="posNum" column="pos_num" />
<result property="busiNum" column="busi_num" />
</resultMap>
<sql id="selectGridVirtualGridVo">
select grid_id, grid_name, grid_type, has_retail, has_business, has_retail_business, grid_assign_type, grid_duty_type, dept_id, create_by, create_time, update_by, update_time, delete_flag from grid_virtual_grid
</sql>
<select id="selectGridVirtualGridList" parameterType="GridVirtualGrid" resultMap="GridVirtualGridResult">
<include refid="selectGridVirtualGridVo"/>
<where>
<if test="gridName != null and gridName != ''"> and grid_name like concat('%', #{gridName}, '%')</if>
<if test="gridType != null and gridType != ''"> and grid_type = #{gridType}</if>
<if test="hasRetail != null and hasRetail != ''"> and has_retail = #{hasRetail}</if>
<if test="hasBusiness != null and hasBusiness != ''"> and has_business = #{hasBusiness}</if>
<if test="hasRetailBusiness != null and hasRetailBusiness != ''"> and has_retail_business = #{hasRetailBusiness}</if>
<if test="gridAssignType != null and gridAssignType != ''"> and grid_assign_type = #{gridAssignType}</if>
<if test="gridDutyType != null and gridDutyType != ''"> and grid_duty_type = #{gridDutyType}</if>
<if test="deptId != null "> and dept_id = #{deptId}</if>
<if test="deleteFlag != null and deleteFlag != ''"> and delete_flag = #{deleteFlag}</if>
</where>
</select>
<select id="selectGridVirtualGridByGridId" parameterType="Long" resultMap="GridVirtualGridResult">
<include refid="selectGridVirtualGridVo"/>
where grid_id = #{gridId}
</select>
<insert id="insertGridVirtualGrid" parameterType="GridVirtualGrid" useGeneratedKeys="true" keyProperty="gridId">
insert into grid_virtual_grid
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="gridName != null">grid_name,</if>
<if test="gridType != null">grid_type,</if>
<if test="hasRetail != null">has_retail,</if>
<if test="hasBusiness != null">has_business,</if>
<if test="hasRetailBusiness != null">has_retail_business,</if>
<if test="gridAssignType != null">grid_assign_type,</if>
<if test="gridDutyType != null">grid_duty_type,</if>
<if test="deptId != null">dept_id,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="deleteFlag != null and deleteFlag != ''">delete_flag,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="gridName != null">#{gridName},</if>
<if test="gridType != null">#{gridType},</if>
<if test="hasRetail != null">#{hasRetail},</if>
<if test="hasBusiness != null">#{hasBusiness},</if>
<if test="hasRetailBusiness != null">#{hasRetailBusiness},</if>
<if test="gridAssignType != null">#{gridAssignType},</if>
<if test="gridDutyType != null">#{gridDutyType},</if>
<if test="deptId != null">#{deptId},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="deleteFlag != null and deleteFlag != ''">#{deleteFlag},</if>
</trim>
</insert>
<update id="updateGridVirtualGrid" parameterType="GridVirtualGrid">
update grid_virtual_grid
<trim prefix="SET" suffixOverrides=",">
<if test="gridName != null">grid_name = #{gridName},</if>
<if test="gridType != null">grid_type = #{gridType},</if>
<if test="hasRetail != null">has_retail = #{hasRetail},</if>
<if test="hasBusiness != null">has_business = #{hasBusiness},</if>
<if test="hasRetailBusiness != null">has_retail_business = #{hasRetailBusiness},</if>
<if test="gridAssignType != null">grid_assign_type = #{gridAssignType},</if>
<if test="gridDutyType != null">grid_duty_type = #{gridDutyType},</if>
<if test="deptId != null">dept_id = #{deptId},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="deleteFlag != null and deleteFlag != ''">delete_flag = #{deleteFlag},</if>
</trim>
where grid_id = #{gridId}
</update>
<delete id="deleteGridVirtualGridByGridIds" parameterType="String">
delete from grid_virtual_grid where grid_id in
<foreach item="gridId" collection="array" open="(" separator="," close=")">
#{gridId}
</foreach>
</delete>
<select id="selectVirtualGridList1" parameterType="GridVirtualGrid" resultMap="GridVirtualGridResult">
select a.* from grid_virtual_grid a,sys_dept b,grid_virtual_user d,sys_user e
<where>
a.dept_id =b.dept_id and a.grid_id =d.grid_id and d.user_name = e.user_name
<if test="gridType != null and gridType != ''"> and a.grid_type = #{gridType}</if>
<if test="gridDutyType != null and gridDutyType != ''"> and a.grid_duty_type = #{gridDutyType}</if>
<if test="createRole != null and createRole != ''">
and case when #{createRole} = '0' then b.dept_type ='head' else b.dept_type ='branch' end
</if>
<if test="custType != null and custType != ''">
and case when #{custType} ='1' then a.has_retail = '1'
when #{custType} ='2' then a.has_business = '1'
when #{custType} ='3' then a.has_retail_business = '1' else 1 = 1 end
</if>
<if test="virtualGridName != null and virtualGridName != ''">
and a.grid_name like concat('%', #{virtualGridName}, '%')
</if>
<if test="relationDept != null and relationDept != ''">
and d.relate_dept_name like concat('%', #{relationDept}, '%') and d.relate_dept_type = 'branch'
</if>
<if test="relationOutlet != null and relationOutlet != ''">
and d.relate_dept_name like concat('%', #{relationOutlet}, '%') and d.relate_dept_type = 'outlet'
</if>
<if test="custManager != null and custManager != ''"> and e.nick_name like concat('%', #{custManager}, '%')</if>
<if test="userDept != null and userDept != ''">
and (cast(a.dept_id as char) like concat('%', #{userDept}, '%') or d.user_name = #{userDept})
</if>
and a.delete_flag = '0'
</where>
group by a.grid_id
</select>
<select id="selectVirtualGridList" parameterType="GridVirtualGrid" resultMap="VirtualGridSelectInfoResult">
select distinct a.grid_id,a.grid_name,a.grid_type,a.grid_duty_type,a.dept_type,
count(distinct f.cust_id) as cust_num,count(distinct g.cust_id) as pos_num,count(distinct h.cust_id) as busi_num
from grid_virtual_grid a
left join grid_virtual_user d on a.grid_id =d.grid_id
left join (select distinct grid_id,cust_type,cust_id from grid_virtual_cust) f on a.grid_id = f.grid_id and f.cust_type ='0'
left join (select distinct grid_id,cust_type,cust_id from grid_virtual_cust) g on a.grid_id = g.grid_id and g.cust_type ='1'
left join (select distinct grid_id,cust_type,cust_id from grid_virtual_cust) h on a.grid_id = h.grid_id and h.cust_type ='2'
<where>
<if test="gridType != null and gridType != ''"> and a.grid_type = #{gridType}</if>
<if test="gridDutyType != null and gridDutyType != ''"> and a.grid_duty_type = #{gridDutyType}</if>
<if test="createRole != null and createRole != ''">
and case when #{createRole} = '0' then a.dept_type ='head' else a.dept_type ='branch' end
</if>
<if test="custType != null and custType != ''">
and case when #{custType} ='1' then a.has_retail = '1'
when #{custType} ='2' then a.has_business = '1'
when #{custType} ='3' then a.has_retail_business = '1' else 1 = 1 end
</if>
<if test="virtualGridName != null and virtualGridName != ''">
and a.grid_name like concat('%', #{virtualGridName}, '%')
</if>
<if test="relationDept != null and relationDept != ''">
and d.relate_dept_name like concat('%', #{relationDept}, '%') and d.relate_dept_type = 'branch'
</if>
<if test="relationOutlet != null and relationOutlet != ''">
and d.relate_dept_name like concat('%', #{relationOutlet}, '%') and d.relate_dept_type = 'outlet'
</if>
<if test="custManager != null and custManager != ''"> and d.nick_name like concat('%', #{custManager}, '%')</if>
<if test="userDept != null and userDept != ''">
and (d.relate_dept_id in (select dept_id from sys_dept where dept_id = #{userDept} or find_in_set(#{userDept},ancestors)) or d.user_name = #{userDept} or a.dept_id = #{userDept})
</if>
and a.delete_flag = '0'
</where>
group by a.grid_id,a.grid_name,a.grid_type,a.grid_duty_type,a.dept_type
</select>
<select id="selectVirtualNameByGridId" parameterType="Long" >
select grid_name from grid_virtual_grid
where grid_id = #{gridId}
</select>
<select id="selectVirtualGridDutyType" parameterType="Long" >
select grid_duty_type from grid_virtual_grid
where grid_id = #{gridId}
</select>
<select id="getGridCreateRole" parameterType="Long" >
select b.dept_type from grid_virtual_grid a,sys_dept b
where a.grid_id = #{gridId} and a.dept_id = b.dept_id
</select>
<select id="getVirtualGridNumByDeptId" parameterType="Long" resultType="java.lang.Long">
select count(*)
from (select grid_id
from grid_virtual_grid
where delete_flag = '0'
and dept_id in
(select dept_id from sys_dept where dept_id = #{deptId} or find_in_set(#{deptId}, ancestors))
union
select grid_id
from grid_virtual_cust_user
where relate_dept_id in (select dept_id
from sys_dept
where dept_id = #{deptId} or find_in_set(#{deptId}, ancestors))) as total
</select>
<select id="getVirtualGridNumByUserId" parameterType="String" resultType="java.lang.Long">
SELECT count(distinct a.grid_id)
FROM grid_virtual_grid a
WHERE a.delete_flag = '0'
AND exists(SELECT 1
from grid_virtual_cust_user b
where b.grid_id = a.grid_id
and b.user_name = #{userName}
AND not exists(select 1
from grid_virtual_cust_user_unbind c
where c.grid_id = a.grid_id
and c.cust_id = b.cust_id
and c.user_name = #{userName}
and c.delete_flag = '0'))
</select>
<select id="getVirtualType" resultType="java.lang.String">
select grid_name from grid_virtual_grid where grid_id = #{gridId} and delete_flag = '0'
and case when #{custType} = '1' then has_retail ='1'
when #{custType} = '2' then has_retail_business ='1'
when #{custType} = '3' then has_business ='1'
else 1=1 end
</select>
</mapper>

View File

@@ -0,0 +1,128 @@
<?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.grid.mapper.GridVirtualUserRelateMapper">
<resultMap type="GridVirtualUserRelate" id="GridVirtualUserRelateResult">
<result property="id" column="id" />
<result property="gridId" column="grid_id" />
<result property="relateType" column="relate_type" />
<result property="userId" column="user_id" />
<result property="userName" column="user_name" />
<result property="deptId" column="dept_id" />
<result property="deptName" column="dept_name" />
<result property="deptType" column="dept_type" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="deleteFlag" column="delete_flag" />
</resultMap>
<sql id="selectGridVirtualUserRelateVo">
select id, grid_id, relate_type, user_id, user_name, dept_id, dept_name, dept_type, create_by, create_time, update_by, update_time, delete_flag from grid_virtual_user_relate
</sql>
<select id="selectGridVirtualUserRelateList" parameterType="GridVirtualUserRelate" resultMap="GridVirtualUserRelateResult">
<include refid="selectGridVirtualUserRelateVo"/>
<where>
<if test="gridId != null "> and grid_id = #{gridId}</if>
<if test="relateType != null and relateType != ''"> and relate_type = #{relateType}</if>
<if test="userId != null and userId != ''"> and user_id = #{userId}</if>
<if test="userName != null and userName != ''"> and user_name like concat('%', #{userName}, '%')</if>
<if test="deptId != null "> and dept_id = #{deptId}</if>
<if test="deptName != null and deptName != ''"> and dept_name like concat('%', #{deptName}, '%')</if>
<if test="deptType != null and deptType != ''"> and dept_type = #{deptType}</if>
<if test="deleteFlag != null and deleteFlag != ''"> and delete_flag = #{deleteFlag}</if>
</where>
</select>
<select id="selectGridVirtualUserRelateById" parameterType="Long" resultMap="GridVirtualUserRelateResult">
<include refid="selectGridVirtualUserRelateVo"/>
where id = #{id}
</select>
<insert id="insertGridVirtualUserRelate" parameterType="GridVirtualUserRelate">
insert into grid_virtual_user_relate
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="gridId != null">grid_id,</if>
<if test="relateType != null">relate_type,</if>
<if test="userId != null">user_id,</if>
<if test="userName != null">user_name,</if>
<if test="deptId != null">dept_id,</if>
<if test="deptName != null">dept_name,</if>
<if test="deptType != null">dept_type,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="deleteFlag != null and deleteFlag != ''">delete_flag,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="gridId != null">#{gridId},</if>
<if test="relateType != null">#{relateType},</if>
<if test="userId != null">#{userId},</if>
<if test="userName != null">#{userName},</if>
<if test="deptId != null">#{deptId},</if>
<if test="deptName != null">#{deptName},</if>
<if test="deptType != null">#{deptType},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="deleteFlag != null and deleteFlag != ''">#{deleteFlag},</if>
</trim>
</insert>
<update id="updateGridVirtualUserRelate" parameterType="GridVirtualUserRelate">
update grid_virtual_user_relate
<trim prefix="SET" suffixOverrides=",">
<if test="gridId != null">grid_id = #{gridId},</if>
<if test="relateType != null">relate_type = #{relateType},</if>
<if test="userId != null">user_id = #{userId},</if>
<if test="userName != null">user_name = #{userName},</if>
<if test="deptId != null">dept_id = #{deptId},</if>
<if test="deptName != null">dept_name = #{deptName},</if>
<if test="deptType != null">dept_type = #{deptType},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="deleteFlag != null and deleteFlag != ''">delete_flag = #{deleteFlag},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteGridVirtualUserRelateById" parameterType="Long">
delete from grid_virtual_user_relate where id = #{id}
</delete>
<delete id="deleteGridVirtualUserRelateByIds" parameterType="String">
delete from grid_virtual_user_relate where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<select id="selectDeptNameByGridId" parameterType="Long" >
select distinct relate_dept_name, user_id
from grid_virtual_user_relate
where grid_id = #{gridId} and relate_dept_type ='branch' order by user_id
</select>
<select id="selectDeptTypeByGridId" parameterType="Long" >
select distinct relate_dept_name, user_id
from grid_virtual_user_relate
where grid_id = #{gridId} and relate_dept_type ='outlet' order by user_id
</select>
<select id="selectCustManagerByGridId" parameterType="Long" >
select distinct b.nick_name from grid_virtual_user_relate a ,sys_user b
where a.user_name = b.user_name and grid_id = #{gridId}
</select>
</mapper>

View File

@@ -0,0 +1,16 @@
<?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.task.mapper.ImportExportTaskMapper">
<select id="taskList" resultType="ImportExportTask">
select id,file_name,file_url,status,create_time,finish_time,user_name,error_msg
from import_export_task
where user_name = #{username}
order by finish_time desc
</select>
</mapper>

View File

@@ -0,0 +1,97 @@
<?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.dashboard.mapper.LscjAmountRulesMapper">
<resultMap type="LscjAmountRules" id="LscjAmountRulesResult">
<result property="orgId" column="org_id" />
<result property="id" column="id" />
<result property="level" column="level" />
<result property="transType" column="trans_type" />
<result property="amount" column="amount" />
<result property="createTime" column="create_time" />
</resultMap>
<sql id="selectLscjAmountRulesVo">
select id,org_id, level, trans_type, amount, create_time from lscj_amount_rules
</sql>
<select id="selectLscjAmountRulesList" parameterType="LscjAmountRules" resultMap="LscjAmountRulesResult">
<include refid="selectLscjAmountRulesVo"/>
<where>
<if test="id != null and id != ''"> and id = #{id}</if>
<if test="orgId != null and orgId!= ''" > and org_id = #{orgId}</if>
<if test=" amount != null "> and amount = #{amount}</if>
<if test=" transType != null and transType != '' "> and trans_type = #{transType}</if>
<if test="level != null and level != '' "> and level = #{level}</if>
<if test="userId != null and userId!=''"> and user_id = #{userId}</if>
<if test="startTime !=null ">and create_time &gt;= #{startTime}</if>
<if test="endTime !=null ">and create_time &lt;= #{endTime}</if>
</where>
order by id desc
limit #{size} offset #{num}
</select>
<select id="selectLscjAmountRulesListCount" parameterType="LscjAmountRules" resultType="Integer">
select count(0) from lscj_amount_rules
<where>
<if test="id != null and id != ''"> and id = #{id}</if>
<if test="orgId != null and orgId!= ''" > and org_id = #{orgId}</if>
<if test=" amount != null "> and amount = #{amount}</if>
<if test=" transType != null and transType != '' "> and trans_type = #{transType}</if>
<if test="level != null and level != '' "> and level = #{level}</if>
<if test="userId != null and userId!=''"> and user_id = #{userId}</if>
<if test="startTime !=null ">and create_time &gt;= #{startTime}</if>
<if test="endTime !=null ">and create_time &lt;= #{endTime}</if>
</where>
</select>
<select id="selectLscjAmountRulesById" parameterType="String" resultMap="LscjAmountRulesResult">
<include refid="selectLscjAmountRulesVo"/>
where id = #{id}
</select>
<insert id="insertLscjAmountRules" parameterType="LscjAmountRules">
insert into lscj_amount_rules
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="orgId != null">org_id,</if>
<if test="level != null">level,</if>
<if test="transType != null">trans_type,</if>
<if test="amount != null">amount,</if>
<if test="createTime != null">create_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="orgId != null">#{orgId},</if>
<if test="level != null">#{level},</if>
<if test="transType != null">#{transType},</if>
<if test="amount != null">#{amount},</if>
<if test="createTime !=null">#{createTime}</if>
</trim>
</insert>
<update id="updateLscjAmountRules" parameterType="LscjAmountRules">
update lscj_amount_rules
<trim prefix="SET" suffixOverrides=",">
<if test="level != null">level = #{level},</if>
<if test="transType != null">trans_type = #{transType},</if>
<if test="amount != null">amount = #{amount},</if>
<if test="createTime != null">create_time = #{createTime},</if>
</trim>
where id = #{id}
order by id
limit #{pageSize} offset #{pageNum}
</update>
<delete id="deleteLscjAmountRulesByOrgId" parameterType="String">
delete from lscj_amount_rules where id = #{orgId}
</delete>
<delete id="deleteLscjAmountRulesByIds" parameterType="String">
delete from lscj_amount_rules where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@@ -0,0 +1,93 @@
<?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.dashboard.mapper.LscjSysuserMapper">
<resultMap type="LscjSysuser" id="LscjSysuserResult">
<result property="orgId" column="org_id" />
<result property="level" column="level" />
<result property="userId" column="user_id" />
<result property="userName" column="user_name" />
<result property="id" column="id" />
<result property="createTime" column="create_time" />
</resultMap>
<sql id="selectLscjSysuserVo">
select id, org_id, level, user_id, user_name,create_time from lscj_sysuser
</sql>
<select id="selectLscjSysuserList" parameterType="LscjSysuser" resultMap="LscjSysuserResult">
select id, org_id, user_id, user_name,create_time,
case when level = '总行' then 0 when level = '支行' then 1 when level = '网点' then 2 when level = '客户经理' then 3 else level end as level
from lscj_sysuser
<where>
<if test="userName != null and userName != ''"> and user_name like concat('%', #{userName}, '%')</if>
<if test="orgId != null "> and belong_dept_id= #{orgId}</if>
<if test="userId != null "> and user_id = #{userId}</if>
<if test="startTime !=null ">and create_time &gt;= #{startTime}</if>
<if test="endTime !=null ">and create_time &lt;= #{endTime}</if>
<if test="level != null "> and level = #{level}</if>
</where>
order by create_time desc
limit #{size} offset #{num}
</select>
<select id="selectLscjSysuserListCount" parameterType="LscjSysuser" resultType="Integer">
select count(0) from lscj_sysuser
<where>
<if test="userName != null and userName != ''"> and user_name like concat('%', #{userName}, '%')</if>
<if test="orgId != null "> and belong_dept_id= #{orgId}</if>
<if test="userId != null "> and user_id = #{userId}</if>
<if test="startTime !=null ">and create_time &gt;= #{startTime}</if>
<if test="endTime !=null ">and create_time &lt;= #{endTime}</if>
<if test="level != null "> and level = #{level}</if>
</where>
</select>
<select id="selectLscjSysuserByOrgId" parameterType="String" resultMap="LscjSysuserResult">
<include refid="selectLscjSysuserVo"/>
where org_id = #{orgId}
</select>
<insert id="insertLscjSysuser" parameterType="LscjSysuser">
insert into lscj_sysuser
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="orgId != null">org_id,</if>
<if test="level != null">level,</if>
<if test="userId != null">user_id,</if>
<if test="userName != null">user_name,</if>
<if test="createTime != null">create_time,</if>
<if test="belongDeptId !=null">belong_dept_id,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="orgId != null">#{orgId},</if>
<if test="level != null">#{level},</if>
<if test="userId != null">#{userId},</if>
<if test="userName != null">#{userName},</if>
<if test="createTime != null">#{createTime},</if>
<if test="belongDeptId !=null">#{belongDeptId},</if>
</trim>
</insert>
<update id="updateLscjSysuser" parameterType="LscjSysuser">
update lscj_sysuser
<trim prefix="SET" suffixOverrides=",">
<if test="level != null">level = #{level},</if>
<if test="userId != null">user_id = #{userId},</if>
<if test="userName != null">user_name = #{userName},</if>
<if test="createTime != null">create_time = #{createTime},</if>
</trim>
where id = #{id} and org_id = #{orgId}
</update>
<delete id="deleteLscjSysuserByIds" parameterType="String">
delete from lscj_sysuser where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@@ -0,0 +1,118 @@
<?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.task.mapper.MarketTaskListMapper">
<insert id="batchInsertMarketTaskList">
insert into market_task_list
(market_task_id, cust_type, cust_id, cust_name, user_name, nick_name, dept_id, status, remark, is_reed, is_overdue, import_status, failure_reason)
values
<foreach collection="list" item="item" index="index" separator=",">
(#{item.marketTaskId}, #{item.custType}, #{item.custId}, #{item.custName}, #{item.userName}, #{item.nickName}, #{item.deptId}, #{item.status}, #{item.remark}, '0', '0', #{item.importStatus}, #{item.failureReason})
</foreach>
</insert>
<update id="updateReadTime">
update market_task_list
set is_reed = '1',
update_by = #{username},
update_time = sysdate()
where id = #{id}
</update>
<select id="selectMarketTaskLists" resultType="MarketTaskListVO">
select
mtl.id,
mtl.market_task_id,
mtl.cust_type,
mtl.cust_id,
mtl.cust_name,
mtl.user_name,
mtl.nick_name,
mtl.dept_id,
mtl.status,
mtl.remark,
mtl.is_reed,
mtl.is_overdue,
mtl.import_status,
mtl.failure_reason,
mt.market_name as marketTaskName,
mt.end_time as endTime,
mt.is_feedback as isFeedback,
d.dept_name as deptName
from market_task_list mtl
left join market_task mt on mtl.market_task_id = mt.id
left join sys_dept d on d.dept_id = mtl.dept_id
<where>
import_status = '1'
<if test="username != null and username != ''">
and mtl.user_name = #{username}
</if>
<if test="deptId != null and deptId != ''">
and mtl.dept_id = #{deptId}
</if>
<if test="dto.custInfo != null and dto.custInfo != ''">
and (mtl.cust_id like concat('%', #{dto.custInfo}, '%')
or mtl.cust_name like concat('%', #{dto.custInfo}, '%'))
</if>
<if test="dto.status != null and dto.status != ''">
and mtl.status = #{dto.status}
</if>
<if test="dto.isOverdue != null and dto.isOverdue != ''">
and mtl.is_overdue = #{dto.isOverdue}
</if>
</where>
</select>
<select id="selectAllMarketTaskLists" resultType="MarketTaskListVO">
select
mtl.id,
mtl.market_task_id,
mtl.cust_type,
mtl.cust_id,
mtl.cust_name,
mtl.user_name,
mtl.nick_name,
mtl.dept_id,
mtl.status,
mtl.remark,
mtl.is_reed,
mtl.is_overdue,
mtl.import_status,
mtl.failure_reason,
mt.market_name as marketTaskName,
mt.end_time as endTime,
mt.is_feedback as isFeedback,
d.dept_name as deptName
from market_task_list mtl
left join sys_dept d on d.dept_id = mtl.dept_id
left join market_task mt on mtl.market_task_id = mt.id
<where>
<if test="dto.marketTaskId != null and dto.marketTaskId != ''">
and mtl.market_task_id = #{dto.marketTaskId}
</if>
<if test="dto.importStatus != null and dto.importStatus != ''">
and mtl.import_status = #{dto.importStatus}
</if>
<if test="role != null and role == 'outlet'"> and (mtl.dept_id = #{deptId} or mtl.dept_id is null) </if>
<if test="role != null and role == 'branch'"> and (mtl.dept_id = #{deptId} or find_in_set(#{deptId},d.ancestors) or mtl.dept_id is null) </if>
<if test="role != null and role in {'head', 'ops', 'public', 'private'}"> and (left( d.dept_id,3) = left(#{deptId},3) or mtl.dept_id is null) </if>
<if test="dto.custInfo != null and dto.custInfo != ''">
and (mtl.cust_id like concat('%', #{dto.custInfo}, '%')
or mtl.cust_name like concat('%', #{dto.custInfo}, '%'))
</if>
<if test="dto.userInfo != null and dto.userInfo != ''">
and (mtl.user_name like concat('%', #{dto.userInfo}, '%')
or mtl.nick_name like concat('%', #{dto.userInfo}, '%'))
</if>
<if test="dto.status != null and dto.status != ''">
and mtl.status = #{dto.status}
</if>
<if test="dto.isOverdue != null and dto.isOverdue != ''">
and mtl.is_overdue = #{dto.isOverdue}
</if>
</where>
</select>
</mapper>

View File

@@ -0,0 +1,33 @@
<?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.task.mapper.MarketTaskMapper">
<select id="selectCreateStatus" resultType="java.lang.String">
select create_status from market_task where id = #{id}
</select>
<select id="selectMarketTasks" resultType="MarketTaskVO">
select mt.id, mt.market_name, mt.dept_id, mt.create_by, mt.create_time, mt.update_by, mt.update_time, mt.end_time, mt.is_feedback, mt.create_status, d.dept_name as deptName,
case when count(mtl.market_task_id) > 0 then
round(sum(case when mtl.status = '2' then 1 else 0 end) * 100.0 / count(mtl.market_task_id), 2)
else 0 end as completeRate,
case when mt.end_time is not null and NOW() > mt.end_time and count(mtl.market_task_id) > 0 then
round(sum(case when mtl.status != '0' then 1 else 0 end) * 100.0 / count(mtl.market_task_id), 2)
else 0 end as isOverdueRate
from market_task mt
left join sys_dept d on d.dept_id = mt.dept_id
left join market_task_list mtl on mt.id = mtl.market_task_id
<where>
create_status = '1'
<if test="role != null and role == 'outlet'"> and (d.dept_id = #{deptId}) </if>
<if test="role != null and role == 'branch'"> and (d.dept_id = #{deptId} or find_in_set(#{deptId},d.ancestors)) </if>
<if test="role != null and role in {'head', 'ops', 'public', 'private'}"> and (left( d.dept_id,3) = left(#{deptId},3)) </if>
<if test="marketTaskName != null and marketTaskName != ''">
and market_name like concat('%', #{marketTaskName}, '%')
</if>
</where>
GROUP BY mt.id,mt.market_name,mt.dept_id,mt.create_by,mt.create_time,mt.update_by,mt.update_time,mt.end_time,mt.is_feedback,mt.create_status,d.dept_name
</select>
</mapper>

View File

@@ -0,0 +1,108 @@
<?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.rules.mapper.RelationRuleMapper">
<resultMap type="RelationRule" id="RelationRuleResult">
<result property="id" column="id"/>
<result property="ruleId" column="rule_id"/>
<result property="ruleName" column="rule_name"/>
<result property="ruleType" column="rule_type"/>
<result property="ruleLevel" column="rule_level"/>
<result property="param" column="param"/>
<result property="updateBy" column="update_by"/>
<result property="deptId" column="dept_id"/>
<result property="updateTime" column="update_time"/>
<result property="updateCounts" column="update_counts"/>
<result property="ruleNameId" column="rule_name_id"/>
<result property="addSource" column="add_source"/>
<result property="addSourceId" column="add_source_id"/>
</resultMap>
<sql id="selectRelationRuleVo">
select id,
rule_id,
rule_name,
rule_type,
rule_level,
param,
update_by,
dept_id,
update_time,
update_counts,
rule_name_id,add_source,add_source_id
from relation_rule
</sql>
<select id="selectRelationRuleListById" parameterType="RelationRule" resultMap="RelationRuleResult">
<include refid="selectRelationRuleVo"/>
<where>
<if test="ruleId != null and ruleId != ''">and rule_id = #{ruleId}</if>
</where>
</select>
<select id="selectRelationRuleList" parameterType="RelationRule" resultMap="RelationRuleResult">
<include refid="selectRelationRuleVo"/>
<where>
status = '1'
<if test="ruleId != null and ruleId != ''">and rule_id = #{ruleId}</if>
<if test="ruleName != null and ruleName != ''">and rule_name like concat('%', #{ruleName}, '%')</if>
<if test="ruleType != null and ruleType != ''">and rule_type = #{ruleType}</if>
<if test="ruleLevel != null and ruleLevel != ''">and rule_level = #{ruleLevel}</if>
<if test="param != null and param != ''">and param = #{param}</if>
<if test="deptId != null and deptId != ''">and dept_id = #{deptId}</if>
<if test="updateCounts != null and updateCounts != ''">and update_counts = #{updateCounts}</if>
</where>
</select>
<insert id="insertRelationRule" parameterType="RelationRule" useGeneratedKeys="true" keyProperty="id">
insert into relation_rule
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="ruleId != null">rule_id,</if>
<if test="ruleName != null">rule_name,</if>
<if test="ruleType != null">rule_type,</if>
<if test="ruleLevel != null">rule_level,</if>
<if test="param != null">param,</if>
<if test="updateBy != null">update_by,</if>
<if test="deptId != null">dept_id,</if>
<if test="updateTime != null">update_time,</if>
<if test="updateCounts != null">update_counts,</if>
<if test="status != null">status,</if>
<if test="ruleNameId != null">rule_name_id,</if>
<if test="addSource != null">add_source,</if>
<if test="addSourceId != null">add_source_id,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="ruleId != null">#{ruleId},</if>
<if test="ruleName != null">#{ruleName},</if>
<if test="ruleType != null">#{ruleType},</if>
<if test="ruleLevel != null">#{ruleLevel},</if>
<if test="param != null">#{param},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="deptId != null">#{deptId},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="updateCounts != null">#{updateCounts},</if>
<if test="status != null">#{status},</if>
<if test="ruleNameId != null">#{ruleNameId},</if>
<if test="addSource != null">#{addSource},</if>
<if test="addSourceId != null">#{addSourceId},</if>
</trim>
</insert>
<update id="updateRelationRule" parameterType="RelationRule">
update relation_rule
<trim prefix="SET" suffixOverrides=",">
<if test="status != null">status = #{status},</if>
</trim>
where rule_id = #{ruleId}
</update>
<delete id="deleteRelationRuleById" parameterType="String">
update relation_rule
set status = '0'
where rule_id = #{id}
</delete>
</mapper>

View File

@@ -0,0 +1,133 @@
<?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} &lt;= 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>

View File

@@ -0,0 +1,112 @@
<?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.dashboard.mapper.TabRankingMapper">
<resultMap type="TabRanking" id="TabRankingResult">
<result property="id" column="id" />
<result property="tabId" column="tab_id" />
<result property="tabName" column="tab_name" />
<result property="level" column="level" />
<result property="rankId" column="rank_id" />
<result property="belongId" column="belong_id" />
<result property="tabValue" column="tab_value" />
<result property="dataDt" column="data_dt" />
</resultMap>
<sql id="selectTabRankingVo">
select id, tab_id, tab_name, level, rank_id, belong_id, tab_value, data_dt from tab_ranking
</sql>
<select id="selectTabRankingList" parameterType="TabRanking" resultType="TabRanking">
<include refid="selectTabRankingVo"/>
<where>
<if test="tabId != null and tabId != ''"> and tab_id = #{tabId}</if>
<if test="tabName != null and tabName != ''"> and tab_name like concat('%', #{tabName}, '%')</if>
<if test="level != null and level != ''"> and level = #{level}</if>
<if test="rankId != null "> and rank_id = #{rankId}</if>
<if test="belongId != null and belongId != ''"> and belong_id like concat('%', #{belongId}, '%')</if>
<if test="tabValue != null and tabValue != ''"> and tab_value = #{tabValue}</if>
<if test="dataDt != null "> and left(data_dt,10) = left(#{dataDt},10)</if>
<if test="custType != null and custType != ''"> and cust_type = #{custType}</if>
</where>
order by rank_id asc
</select>
<select id="selectTabRankingById" parameterType="Long" resultMap="TabRankingResult">
<include refid="selectTabRankingVo"/>
where id = #{id}
</select>
<select id="selectConmmentById" parameterType="Long" resultType="TabCommentVO">
select comment,belong_id,data_dt
from tab_comment
where ranking_id = #{id}
order by data_dt desc
</select>
<insert id="insertTabRanking" parameterType="TabRanking" useGeneratedKeys="true" keyProperty="id">
insert into tab_ranking
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="tabId != null">tab_id,</if>
<if test="tabName != null">tab_name,</if>
<if test="level != null">level,</if>
<if test="rankId != null">rank_id,</if>
<if test="belongId != null">belong_id,</if>
<if test="tabValue != null">tab_value,</if>
<if test="dataDt != null">data_dt,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="tabId != null">#{tabId},</if>
<if test="tabName != null">#{tabName},</if>
<if test="level != null">#{level},</if>
<if test="rankId != null">#{rankId},</if>
<if test="belongId != null">#{belongId},</if>
<if test="tabValue != null">#{tabValue},</if>
<if test="dataDt != null">#{dataDt},</if>
</trim>
</insert>
<insert id="insertComment" >
insert into tab_comment
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="rankingId != null">ranking_id,</if>
<if test="comment != null">comment,</if>
<if test="belongId != null">belong_id,</if>
data_dt,
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="rankingId != null">#{rankingId},</if>
<if test="comment != null">#{comment},</if>
<if test="belongId != null">#{belongId},</if>
sysdate(),
</trim>
</insert>
<update id="updateTabRanking" parameterType="TabRanking">
update tab_ranking
<trim prefix="SET" suffixOverrides=",">
<if test="tabId != null">tab_id = #{tabId},</if>
<if test="tabName != null">tab_name = #{tabName},</if>
<if test="level != null">level = #{level},</if>
<if test="rankId != null">rank_id = #{rankId},</if>
<if test="belongId != null">belong_id = #{belongId},</if>
<if test="tabValue != null">tab_value = #{tabValue},</if>
<if test="dataDt != null">data_dt = #{dataDt},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteTabRankingById" parameterType="Long">
delete from tab_ranking where id = #{id}
</delete>
<delete id="deleteTabRankingByIds" parameterType="String">
delete from tab_ranking where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@@ -0,0 +1,36 @@
<?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.dashboard.mapper.UrlRegistryMapper">
<sql id="selectUrlRegistryVo">
select id, url_path, url_name, url_type, head_id from url_registry
</sql>
<select id="selectUrlByCondition" resultType="UrlRegistry">
<include refid="selectUrlRegistryVo"/>
<where>
<if test="headId != null and headId != ''">
and head_id = #{headId}
</if>
<if test="urlType != null and urlType != ''">
and url_type = #{urlType}
</if>
<if test="urlName != null and urlName != ''">
and url_name = #{urlName}
</if>
</where>
</select>
<select id="selectUrlList" resultType="UrlRegistry">
<include refid="selectUrlRegistryVo"/>
<where>
<if test="headId != null and headId != ''">
and head_id = #{headId}
</if>
<if test="urlType != null and urlType != ''">
and url_type = #{urlType}
</if>
</where>
</select>
</mapper>

View File

@@ -0,0 +1,136 @@
<?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.task.mapper.TaskVisitRecordMapper">
<select id="getVisitRecordList" resultType="VisitRecordListVO">
select a.id as record_id,
a.campaign_name,
a.cust_name,
concat(a.nick_name, '-', a.user_name) as user_name,
a.duration,
b.sign_in_time,
b.sign_out_time,
a.cust_type
from task_visit_record a
left join task_visit_sign b on a.latest_sign = b.id
where a.user_name like concat( #{deptCode}, '%') and a.cust_id = #{custId}
order by b.sign_in_time
</select>
<select id="getVisitRecordListByCampaign" resultType="VisitRecordListVO">
select a.id as record_id,
a.campaign_name,
a.cust_name,
concat(a.nick_name, '-', a.user_name) as user_name,
a.duration,
b.sign_in_time,
b.sign_out_time,
b.sign_out_remark,
a.cust_type
from task_visit_record a
left join task_visit_sign b on a.latest_sign = b.id
where a.user_name like concat( #{deptCode}, '%') and a.cust_id = #{custId} and campaign_id = #{campaignId}
order by b.sign_in_time
</select>
<select id="getVisitRecordListByUserName" parameterType="TaskRecordDTO" resultType="VisitRecordListVO">
select a.id as record_id,
a.campaign_name,
a.cust_name,
a.cust_type,
concat(a.nick_name, '-', a.user_name) as user_name,
CONCAT(ROUND(a.duration * 60), '分钟', a.duration * 3600 % 60, '秒') AS duration,
b.sign_in_time,
b.sign_out_time
from task_visit_record a
left join task_visit_sign b on a.latest_sign = b.id
left join sys_user c on c.user_name = a.user_name
left join sys_dept d on d.dept_id = c.dept_id
where
<if test="post != null and post == 'manager'"> a.user_name = #{userName} </if>
<if test="post != null and post == 'outlet'"> d.dept_id = #{deptId} </if>
<if test="post != null and post == 'branch'"> d.dept_id = #{deptId} or find_in_set(#{deptId},d.ancestors) </if>
<if test="post != null and post == 'head'"> left( d.dept_id,3) = left(#{deptId},3) </if>
<if test="custName != null and custName != '' ">
and a.cust_name like concat('%', #{custName}, '%')
</if>
<if test="campaignName != null and campaignName != '' ">
and a.campaign_name like concat('%', #{campaignName}, '%')
</if>
<if test="visitType != null and visitType != ''">
and a.visit_type = #{visitType}
</if>
<if test="startTimeMonth != null and startTimeMonth != '' ">
and b.sign_in_time like concat(#{startTimeMonth}, '%')
</if>
order by b.sign_in_time desc
</select>
<select id="getVisitRecord" resultType="VisitRecordVO">
select a.id as record_id,
a.campaign_name,
a.cust_name,
concat(a.nick_name, '-', a.user_name) as user_name,
a.duration,
a.cust_type,
b.sign_in_time,
b.sign_in_address,
b.sign_out_time,
b.sign_out_address,
b.sign_out_remark,
a.feedback_id,
a.feedback_type,
a.feedback_template_id
from task_visit_record a
left join task_visit_sign b on a.latest_sign = b.id
where a.id = #{recordId}
</select>
<select id="getVisitRecordListAll" resultType="VisitRecordListVO">
select a.id as record_id,
a.campaign_name,
a.cust_name,
a.cust_type,
a.feedback_type,
a.feedback_id,
concat(a.nick_name, '-', a.user_name) as user_name,
CONCAT(ROUND(a.duration * 60), '分钟', a.duration * 3600 % 60, '秒') AS duration,
b.sign_in_time,
b.sign_out_time
from task_visit_record a
left join task_visit_sign b on a.latest_sign = b.id
left join sys_user c on c.user_name = a.user_name
left join sys_dept d on d.dept_id = c.dept_id
where
<if test="role != null and role == 'manager'"> a.user_name = #{userName} </if>
<if test="role != null and role == 'outlet'"> d.dept_id = #{deptId} </if>
<if test="role != null and role == 'branch'"> (d.dept_id = #{deptId} or find_in_set(#{deptId},d.ancestors)) </if>
<if test="role != null and role in {'head', 'ops', 'public', 'private'}"> left( d.dept_id,3) = left(#{deptId},3) </if>
order by b.sign_in_time desc
limit 10000
</select>
<select id="getVisitRecordListByPage" resultType="VisitRecordListVO">
select a.id as record_id,
a.campaign_name,
a.cust_name,
a.cust_type,
a.feedback_type,
a.feedback_id,
concat(a.nick_name, '-', a.user_name) as user_name,
CONCAT(ROUND(a.duration * 60), '分钟', a.duration * 3600 % 60, '秒') AS duration,
b.sign_in_time,
b.sign_out_time
from task_visit_record a
left join task_visit_sign b on a.latest_sign = b.id
left join sys_user c on c.user_name = a.user_name
left join sys_dept d on d.dept_id = c.dept_id
where
<if test="role != null and role == 'manager'"> a.user_name = #{userName} </if>
<if test="role != null and role == 'outlet'"> d.dept_id = #{deptId} </if>
<if test="role != null and role == 'branch'"> (d.dept_id = #{deptId} or find_in_set(#{deptId},d.ancestors)) </if>
<if test="role != null and role in {'head', 'ops', 'public', 'private'}"> left( d.dept_id,3) = left(#{deptId},3) </if>
order by b.sign_in_time desc
limit #{offset}, #{pageSize}
</select>
</mapper>

View File

@@ -0,0 +1,87 @@
<?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.task.mapper.VisitTaskMapper">
<select id="getVisitTaskList" parameterType="VisitTaskListDTO" resultType="VisitTaskListVO">
select
sc.campaign_name, sc.campaign_id, sc.start_time, sc.end_time, sc.task_type, sc.check_target, sc.visit_type, sc.campaign_degree, sc.cust_type, sc.remark
from sys_campaign sc
left join sys_campaign_group scg on scg.campaign_id = sc.campaign_id
left join sys_campaign_group_customer sgc on sgc.campaign_id = sc.campaign_id
left join sys_group sg on sg.group_id = scg.group_id
where sgc.user_id = #{userId}
and sc.cust_type = #{custType}
and sgc.cust_claim_status = 1
and sc.claim_end_time > current_timestamp()
<if test="campaignName != null and campaignName != ''">
and sc.campaign_name like concat('%', #{campaignName}, '%')
</if>
<if test="visitType != null and visitType != ''">
and sc.visit_type = #{visitType}
</if>
<if test="startTimeMonth != null and startTimeMonth != '' ">
and sc.start_time like concat(#{startTimeMonth}, '%')
</if>
group by sc.campaign_name, sc.campaign_id, sc.start_time, sc.end_time,sc.task_type, sc.check_target, sc.visit_type, sc.campaign_degree, sc.remark
order by sc.end_time
</select>
<select id="getVisitTargetRetailList" parameterType="VisitTargetDTO" resultType="VisitTargetVO">
select a.cust_id, a.cust_idc, a.cust_isn, a.cust_gender, a.cust_name, a.cust_phone, b.id as record_id, isnull(
b.sign_id) as sign_flag, b.feedback_id, b.feedback_type, b.feedback_template_id
from cust_info_retail a
left join (
select id, cust_id , sign_id, feedback_id, feedback_type, feedback_template_id from task_visit_record where
campaign_id = #{campaignId} and user_id = #{userId}
) b on a.cust_id = b.cust_id
where a.cust_id in (
select cust_id from sys_campaign_group_customer
where campaign_id = #{campaignId}
and user_id = #{userId}
and cust_claim_status = 1
)
<if test="custName != null and custName != ''">
and a.cust_name like concat('%', #{custName}, '%')
</if>
</select>
<select id="getVisitTargetBusinessList" parameterType="VisitTargetDTO" resultType="VisitTargetVO">
select a.cust_id, a.cust_idc, a.social_credit_code, a.cust_gender, a.cust_name, a.cust_phone, a.status, b.id as
record_id, isnull( b.sign_id) as sign_flag , b.feedback_id, b.feedback_type, b.feedback_template_id
from cust_info_business a
left join (
select id, cust_id, sign_id, feedback_id, feedback_type, feedback_template_id from task_visit_record where
campaign_id = #{campaignId} and user_id = #{userId}
) b on a.cust_id = b.cust_id
where a.cust_id in (
select cust_id from sys_campaign_group_customer
where campaign_id = #{campaignId}
and user_id = #{userId}
and cust_claim_status = 1
)
<if test="custName != null and custName != ''">
and a.cust_name like concat('%', #{custName}, '%')
</if>
</select>
<select id="getVisitTargetMerchantList" parameterType="VisitTargetDTO" resultType="VisitTargetVO">
select a.cust_id, a.cust_idc, a.social_credit_code, a.cust_gender, a.cust_name, a.cust_phone, a.status, b.id as
record_id, isnull( b.sign_id) as sign_flag , b.feedback_id, b.feedback_type, b.feedback_template_id
from cust_info_merchant a
left join (
select id, cust_id , sign_id, feedback_id, feedback_type, feedback_template_id from task_visit_record where
campaign_id = #{campaignId} and user_id = #{userId}
) b on a.cust_id = b.cust_id
where a.cust_id in (
select cust_id from sys_campaign_group_customer
where campaign_id = #{campaignId}
and user_id = #{userId}
and cust_claim_status = 1
)
<if test="custName != null and custName != ''">
and a.cust_name like concat('%', #{custName}, '%')
</if>
</select>
</mapper>

View File

@@ -0,0 +1,271 @@
<?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.task.mapper.WorkRecordMapper">
<select id="selectWorkRecordList" resultType="WorkRecordVO">
select
r.id,r.user_name,r.nick_name,r.post_id,p.post_name AS postName,r.template_id,r.frequency_type,r.start_time,r.end_time,r.status,r.remark,r.is_overdue,r.read_time,t.work_type,t.work_detail
from work_record r
left join work_template t on r.template_id = t.id
left join sys_post p on r.post_id = p.post_id
<where>
r.is_alter = 0
<if test="username != null and username != ''"> and r.user_name = #{username}</if>
<if test="dto.frequencyType != null and dto.frequencyType != ''"> and r.frequency_type = #{dto.frequencyType}</if>
<if test="dto.workType != null and dto.workType != ''"> and t.work_type = #{dto.workType}</if>
<if test="dto.postId != null and dto.postId != ''">and r.post_id = #{dto.postId}</if>
<if test="dto.validTime != null ">
and #{dto.validTime} between r.start_time and r.end_time
</if>
<if test="dto.status != null and dto.status != ''"> and r.status = #{dto.status}</if>
</where>
order by r.start_time desc, r.frequency_type, r.status, r.post_id
</select>
<select id="selectAllWorkRecordList" resultType="WorkRecordVO">
select
r.id,r.user_name,r.nick_name,r.post_id,p.post_name AS postName,r.template_id,r.frequency_type,r.start_time,r.end_time,r.status,r.remark,r.is_overdue,r.read_time,t.work_type,t.work_detail
from work_record r
left join work_template t on r.template_id = t.id
left join sys_post p on r.post_id = p.post_id
<where>
r.is_alter = 0
<if test="postIds != null and postIds.size() > 0">
AND r.post_id IN
<foreach collection="postIds" item="postId" open="(" separator="," close=")">
#{postId}
</foreach>
</if>
<if test="username != null and username != ''"> and r.user_name = #{username}</if>
<if test="dto.frequencyType != null and dto.frequencyType != ''"> and r.frequency_type = #{dto.frequencyType}</if>
<if test="dto.workType != null and dto.workType != ''"> and t.work_type = #{dto.workType}</if>
<if test="dto.postId != null and dto.postId != ''">and r.post_id = #{dto.postId}</if>
<if test="dto.validTime != null ">
and #{dto.validTime} between r.start_time and r.end_time
</if>
<if test="dto.status != null and dto.status != ''"> and r.status = #{dto.status}</if>
</where>
order by r.frequency_type, r.status, r.post_id
</select>
<update id="batchSubmitWorkRecord" parameterType="java.util.List">
<foreach collection="list" item="item" separator=";">
update work_record
<set>
<if test="item.status != null and item.status != ''">status = #{item.status},</if>
<if test="item.remark != null and item.remark != ''">remark = #{item.remark},</if>
update_time = sysdate(),
update_by = #{item.update_by}
</set>
where id = #{item.id}
</foreach>
</update>
<update id="updateOverdueRecord">
update work_record
set is_overdue = 1,
update_time = sysdate(),
update_by = 'admin'
where
end_time &lt; #{now}
and is_overdue = 0
</update>
<update id="updateReadTime">
update work_record
set read_time = sysdate(),
update_time = sysdate(),
update_by = #{username}
where
id = #{id}
</update>
<select id="selectCompleteStatus" resultType="WorkCompleteVO">
SELECT
r.user_name AS userName,
r.nick_name AS nickName,
r.post_id AS postId,
p.post_name AS postName,
r.frequency_type AS frequencyType,
COUNT(*) AS totalCount,
SUM(CASE WHEN r.status = '2' THEN 1 ELSE 0 END) AS completeCount,
CASE
WHEN COUNT(*) > 0 THEN
ROUND(SUM(CASE WHEN r.status = '2' THEN 1 ELSE 0 END) * 100.0 / COUNT(*), 2)
ELSE 0
END AS completeRate
FROM work_record r
LEFT JOIN sys_post p ON r.post_id = p.post_id
<where>
r.is_alter = 0
<if test="postIds != null and postIds.size() > 0">
AND r.post_id IN
<foreach collection="postIds" item="postId" open="(" separator="," close=")">
#{postId}
</foreach>
</if>
<if test="dto.validTime != null">
AND #{dto.validTime} BETWEEN r.start_time AND r.end_time
</if>
<if test="dto.postId != null">
AND r.post_id = #{dto.postId}
</if>
<if test="dto.frequencyType != null and dto.frequencyType != ''">
AND r.frequency_type = #{dto.frequencyType}
</if>
</where>
GROUP BY r.user_name, r.nick_name, r.post_id, p.post_name, r.frequency_type
ORDER BY completeRate DESC
</select>
<select id="selectRecordsToGenerate" resultType="WorkRecord">
select
t.post_id as postId,
u.user_name as userName,
u.nick_name as nickName,
t.id as templateId,
t.work_type as workType,
t.work_detail as workDetail,
t.frequency_type as frequencyType,
#{startTime} as startTime,
#{endTime} as endTime,
0 as isAlter,
'0' as status
from work_template t
inner join sys_user_post up on t.post_id = up.post_id
inner join sys_user u on up.user_id = u.user_id
where t.frequency_type = #{frequencyType}
and t.is_enabled = 0
and t.del_flag = 0
and not exists (
select 1 from work_record r
where r.user_name = u.user_name
and r.template_id = t.id
and r.frequency_type = #{frequencyType}
and r.start_time = #{startTime}
and r.end_time = #{endTime}
)
order by t.post_id, u.user_id
</select>
<insert id="batchInsertWorkRecord" parameterType="java.util.List" useGeneratedKeys="true" keyProperty="id">
<foreach collection="workRecordList" item="item" separator=";">
insert into work_record
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="item.postId != null">post_id,</if>
<if test="item.userName != null">user_name,</if>
<if test="item.nickName != null">nick_name,</if>
<if test="item.templateId != null">template_id,</if>
<if test="item.startTime != null">start_time,</if>
<if test="item.endTime != null">end_time,</if>
<if test="item.frequencyType != null">frequency_type,</if>
<if test="item.status != null">status,</if>
<if test="item.isAlter != null">is_alter,</if>
create_time,
is_overdue
</trim>
values
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="item.postId != null">#{item.postId},</if>
<if test="item.userName != null">#{item.userName},</if>
<if test="item.nickName != null">#{item.nickName},</if>
<if test="item.templateId != null">#{item.templateId},</if>
<if test="item.startTime != null">#{item.startTime},</if>
<if test="item.endTime != null">#{item.endTime},</if>
<if test="item.frequencyType != null">#{item.frequencyType},</if>
<if test="item.status != null">#{item.status},</if>
<if test="item.isAlter != null">#{item.isAlter},</if>
sysdate(),
0
</trim>
</foreach>
</insert>
<select id="selectAlterList" resultType="AlterVO">
select id, user_name, nick_name, alter_type, alter_detail, cust_id, cust_name, read_time, status, remark, is_feedback, cust_isn
from work_record
<where>
is_alter = 1
and user_name= #{username}
<if test="status != null and status != ''">
and status = #{status}
</if>
<if test="alterType != null and alterType != ''">
and alter_type LIKE CONCAT('%', #{alterType}, '%')
</if>
</where>
order by create_time desc, status asc
</select>
<select id="selectAlterCount" resultType="AlterCountVO">
select
count(1) as alterCount,
sum(case
when wr.status = '2'
then 1 else 0
end) as completeCount
from work_record wr
left join sys_user su on su.user_name = wr.user_name
left join sys_dept d on su.dept_id = d.dept_id
where wr.is_alter = 1
and wr.create_time &lt;= #{reportTime}
and (
<choose>
<when test="role != null and role == 'outlet'"> su.dept_id = #{deptId} </when>
<when test="role != null and role == 'branch'"> (su.dept_id = #{deptId} or find_in_set(#{deptId},d.ancestors)) </when>
<when test="role != null and role == 'private'"> (left(su.dept_id,3) = left(#{deptId},3) and wr.cust_type in ('0', '1')) </when>
<when test="role != null and role == 'public'"> (left(su.dept_id,3) = left(#{deptId},3) and wr.cust_type = '2') </when>
<when test="role != null and role == 'ops'"> left(su.dept_id,3) = left(#{deptId},3) </when>
<when test="role != null and role == 'head'"> left(su.dept_id,3) = left(#{deptId},3) </when>
</choose>)
</select>
<select id="selectAllAlterList" resultType="AlterVO">
select wr.id, wr.user_name, wr.nick_name, wr.alter_type, wr.alter_detail, wr.cust_id, wr.cust_name, wr.read_time, wr.status, wr.remark, wr.cust_type, wr.is_feedback, wr.cust_isn
from work_record wr
left join sys_user su on su.user_name = wr.user_name
left join sys_dept d on su.dept_id = d.dept_id
where wr.is_alter = 1
<if test="status != null and status != ''">
and wr.status = #{status}
</if>
<if test="alterType != null and alterType != ''">
and wr.alter_type LIKE CONCAT('%', #{alterType}, '%')
</if>
<!-- "走访异常提醒"类型直接通过用户名匹配,其他类型按角色权限处理 -->
and ((wr.alter_type = '走访异常提醒' and wr.user_name = #{username}) or
(wr.alter_type != '走访异常提醒' and (
<choose>
<when test="role != null and role == 'outlet'"> su.dept_id = #{deptId} </when>
<when test="role != null and role == 'branch'"> (su.dept_id = #{deptId} or find_in_set(#{deptId},d.ancestors)) </when>
<when test="role != null and role == 'private'"> (left(su.dept_id,3) = left(#{deptId},3) and wr.cust_type in ('0', '1')) </when>
<when test="role != null and role == 'public'"> (left(su.dept_id,3) = left(#{deptId},3) and wr.cust_type = '2') </when>
<when test="role != null and role == 'ops'"> left(su.dept_id,3) = left(#{deptId},3) </when>
<when test="role != null and role == 'head'"> left(su.dept_id,3) = left(#{deptId},3) </when>
</choose> )))
order by wr.create_time desc, wr.status asc, wr.user_name desc
</select>
<select id="selectAlterConfigList" resultType="AlterConfigVO">
select id, alter_type, prod_type, warn_role, warn_threshold, update_time, update_by, type
from alter_config
<where>
<if test="alterType != null and alterType != ''">
and alter_type like concat('%', #{alterType},'%')
</if>
</where>
</select>
<update id="updateAlterConfig">
update alter_config
<set>
<if test="warnThreshold != null">warn_threshold = #{warnThreshold},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
</set>
where id = #{id}
</update>
</mapper>

View File

@@ -0,0 +1,88 @@
<?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.task.mapper.WorkTemplateMapper">
<sql id="selectTemplateVo">
select id, post_id, work_type, work_detail, frequency_type, create_time, create_by, is_enabled, feedback
from work_template
</sql>
<insert id="insertWorkTemplate" parameterType="WorkTemplate" useGeneratedKeys="true" keyProperty="id">
insert into work_template(
<if test="postId != null">post_id,</if>
<if test="workType != null">work_type,</if>
<if test="workDetail != null">work_detail,</if>
<if test="feedback != null">feedback,</if>
<if test="frequencyType != null">frequency_type,</if>
<if test="createBy != null">create_by,</if>
<if test="isEnabled != null">is_enabled,</if>
del_flag,
create_time
)values (
<if test="postId != null">#{postId},</if>
<if test="workType != null">#{workType},</if>
<if test="workDetail != null">#{workDetail},</if>
<if test="feedback != null">#{feedback},</if>
<if test="frequencyType != null">#{frequencyType},</if>
<if test="createBy != null">#{createBy},</if>
<if test="isEnabled != null">#{isEnabled},</if>
0,
sysdate()
)
</insert>
<select id="selectWorkTemplateList" parameterType="WorkTemplateDTO" resultType="WorkTemplateVO">
select
t.id,
t.post_id,
t.work_type,
t.work_detail,
t.frequency_type,
t.create_time,
t.create_by,
t.is_enabled,
t.feedback,
p.post_name
from work_template t
left join sys_post p on t.post_id = p.post_id
<where>
t.del_flag = 0
and t.post_id in
<foreach collection="postIds" item="postId" open="(" separator="," close=")">
#{postId}
</foreach>
<if test="dto.postId != null">
and t.post_id = #{dto.postId}
</if>
<if test="dto.frequencyType != null and dto.frequencyType != ''">
and t.frequency_type = #{dto.frequencyType}
</if>
</where>
order by t.frequency_type, t.post_id
</select>
<update id="updateWorkTemplate">
update work_template
<set>
<if test="postId != null">post_id = #{postId},</if>
<if test="workType != null">work_type = #{workType},</if>
<if test="workDetail != null">work_detail = #{workDetail},</if>
<if test="feedback != null">feedback = #{feedback},</if>
<if test="frequencyType != null">frequency_type = #{frequencyType},</if>
<if test="isEnabled != null">is_enabled = #{isEnabled},</if>
</set>
where id = #{id}
</update>
<update id="deleteWorkTemplateByIds" >
update work_template
set del_flag = 2
where id in
<foreach item="id" index="index" collection="ids" open="(" separator="," close=")">
#{id}
</foreach>
</update>
</mapper>

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>

View File

@@ -0,0 +1,369 @@
<?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.custmap.mapper.CustMapMapper">
<select id="selectCustMapListByCircle" parameterType="CustMapCircleDTO" resultType="CustMapVO">
SELECT
id, cust_name, lp_name, start_date, province, city, regist_capi_show, phone_number,
address_detail, longitude, latitude,social_credit_code,new_company_flag_${dept} as new_company_flag, cust_type,
ST_Distance_Sphere(
point(longitude, latitude),
point(#{targetLng}, #{targetLat})
) AS distance
FROM
cust_info_radar
WHERE
latitude BETWEEN #{targetLat} - #{latRange} AND #{targetLat} + #{latRange}
AND longitude BETWEEN #{targetLng} - #{lngRange} AND #{targetLng} + #{lngRange}
<include refid="selectConditions"></include>
HAVING #{dist} * 1000 > distance
<include refid="orderCondition"></include>
limit #{pageIndex}, #{size}
</select>
<select id="exportCustMapListByCircle" parameterType="CustMapCircleExcelDTO" resultType="CustMapExcelVO">
SELECT
*, new_company_flag_${dept} as new_company_flag
FROM
cust_info_radar
WHERE
latitude BETWEEN #{targetLat} - #{latRange} AND #{targetLat} + #{latRange}
AND longitude BETWEEN #{targetLng} - #{lngRange} AND #{targetLng} + #{lngRange}
<include refid="selectConditions"></include>
HAVING #{dist} * 1000 > ST_Distance_Sphere(point(longitude, latitude),point(#{targetLng}, #{targetLat}))
</select>
<select id="countCustMapListByCircle" parameterType="CustMapCircleDTO" resultType="Long">
SELECT
count(distinct cust_id)
FROM
cust_info_radar
WHERE
latitude BETWEEN #{targetLat} - #{latRange} AND #{targetLat} + #{latRange}
AND longitude BETWEEN #{targetLng} - #{lngRange} AND #{targetLng} + #{lngRange}
<include refid="selectConditions"></include>
AND #{dist} * 1000 > ST_Distance_Sphere(point(longitude, latitude), point(#{targetLng}, #{targetLat}))
</select>
<select id="selectCustMapListByPolygon" parameterType="CustMapPolygonDTO" resultType="CustMapVO">
SELECT
id, cust_name, lp_name, start_date, province, city, regist_capi_show, phone_number,
address_detail, longitude, latitude,social_credit_code,new_company_flag_${dept} as new_company_flag,cust_type
FROM
cust_info_radar
WHERE
<if test=" minLat != null and minLng != null and maxLat != null and maxLng != null ">
latitude BETWEEN #{minLat} AND #{maxLat}
AND longitude BETWEEN #{minLng} AND #{maxLng}
AND
</if>
ST_Contains(ST_GeomFromText(#{wkt}), point(longitude, latitude))
<include refid="selectConditions"></include>
<include refid="orderCondition"></include>
limit #{pageIndex}, #{size}
</select>
<select id="countCustMapListByPolygon" parameterType="CustMapPolygonDTO" resultType="Long">
SELECT
count(distinct cust_id)
FROM
cust_info_radar
WHERE
latitude BETWEEN #{minLat} AND #{maxLat}
AND longitude BETWEEN #{minLng} AND #{maxLng}
AND ST_Contains(ST_GeomFromText(#{wkt}), point(longitude, latitude))
<include refid="selectConditions"></include>
</select>
<select id="exportCustMapListByPolygon" parameterType="CustMapPolygonExcelDTO" resultType="CustMapExcelVO">
SELECT
*, new_company_flag_${dept} as new_company_flag
FROM
cust_info_radar
WHERE
ST_Contains(ST_GeomFromText(#{wkt}), point(longitude, latitude))
<include refid="selectConditions"></include>
</select>
<select id="selectLngAndLat" resultType="CustMapVO">
select id,longitude,latitude
from cust_info_radar
where code is null and longitude is not null and latitude is not null
-- and id &lt; 20000
limit #{offset}, #{limit}
</select>
<update id="saveCodeToCustMap">
<foreach collection="updateDataList" item="item" separator=";">
update cust_info_radar
set code = #{item.code}
where id = #{item.id}
</foreach>
</update>
<sql id="selectConditions">
<!-- 机构类型 -->
<if test="companyTypeList != null and companyTypeList.size() > 0">
<if test="companyTypeInclude != null and companyTypeInclude">
AND company_type IN
</if>
<if test="companyTypeInclude != null and !companyTypeInclude">
AND company_type NOT IN
</if>
<foreach collection="companyTypeList" item="companyType" open="(" separator="," close=")">
#{companyType}
</foreach>
</if>
<!-- 企业规模 -->
<if test="custScaleList != null and custScaleList.size() > 0">
AND cust_scale IN
<foreach collection="custScaleList" item="custScale" open="(" separator="," close=")">
#{custScale}
</foreach>
</if>
<!-- 联系电话 -->
<if test="isPhoneNumber != null">
AND ISNULL(phone_number) = #{isPhoneNumber}
</if>
<!-- 邮箱 -->
<if test="isEmail != null">
AND ISNULL(email) = #{isEmail}
</if>
<!-- 省份地区 -->
<if test="province != null and province != ''">
AND province = #{province}
</if>
<if test="city != null and city != ''">
AND city = #{city}
</if>
<if test="county != null and county != ''">
AND county = #{county}
</if>
<if test="street != null and street != ''">
AND street = #{street}
</if>
<if test="community != null and community != ''">
AND community = #{community}
</if>
<!-- 所在行业 -->
<if test="belongBusinessList != null and belongBusinessList.size() > 0">
AND belong_business IN
<foreach collection="belongBusinessList" item="belongBusiness" open="(" separator="," close=")">
#{belongBusiness}
</foreach>
</if>
<!-- 成立年限 -->
<if test="startDateIntervalList != null and startDateIntervalList.size() > 0">
AND
<foreach collection="startDateIntervalList" item="param" open="(" separator=" OR " close=")">
start_date BETWEEN (CURDATE() - INTERVAL #{param.max} MONTH) AND (CURDATE() - INTERVAL #{param.min} MONTH)
</foreach>
</if>
<!-- 经营状态 -->
<if test="statusList != null and statusList.size() > 0">
<if test="statusInclude != null and statusInclude">
AND status IN
</if>
<if test="statusInclude != null and !statusInclude">
AND status NOT IN
</if>
<foreach collection="statusList" item="status" open="(" separator="," close=")">
#{status}
</foreach>
</if>
<!-- 注册资本 -->
<if test="registCapiCur != null and registCapiCur != ''">
AND regist_capi_cur = #{registCapiCur}
</if>
<if test="registCapiIntervalList != null and registCapiIntervalList.size() > 0">
AND
<foreach collection="registCapiIntervalList" item="param" open="(" separator=" OR " close=")">
regist_capi_value BETWEEN #{param.min} AND #{param.max}
</foreach>
</if>
<!-- 实缴资本 -->
<if test="recCapCur != null and recCapCur != ''">
AND rec_cap_cur = #{recCapCur}
</if>
<if test="recCapIntervalList != null and recCapIntervalList.size() > 0">
AND
<foreach collection="recCapIntervalList" item="param" open="(" separator=" OR " close=")">
rec_cap_value BETWEEN #{param.min} AND #{param.max}
</foreach>
</if>
<!-- 养老保险参保人数 -->
<if test="businessInfoPenInsurIntervalList != null and businessInfoPenInsurIntervalList.size() > 0">
AND
<foreach collection="businessInfoPenInsurIntervalList" item="param" open="(" separator=" OR " close=")">
business_info_pen_insur_num BETWEEN #{param.min} AND #{param.max}
</foreach>
</if>
<!-- 医疗保险参保人数 -->
<if test="businessInfoMediInsurIntervalList != null and businessInfoMediInsurIntervalList.size() > 0">
AND
<foreach collection="businessInfoMediInsurIntervalList" item="param" open="(" separator=" OR " close=")">
business_info_medi_insur_num BETWEEN #{param.min} AND #{param.max}
</foreach>
</if>
<!-- 有无进出口信息 -->
<if test="businessInfoImExportFlag != null ">
AND business_info_im_export_flag = #{businessInfoImExportFlag}
</if>
<if test="businessInfoImExportCreditGradeList != null and businessInfoImExportCreditGradeList.size() > 0">
AND business_info_im_export_credit_grade IN
<foreach collection="businessInfoImExportCreditGradeList" item="businessInfoImExportCreditGrade" open="(" separator="," close=")">
#{businessInfoImExportCreditGrade}
</foreach>
</if>
<!-- 有无政府扶持和奖励 -->
<if test="businessInfoGovSupportFlag != null ">
AND business_info_gov_support_flag = #{businessInfoGovSupportFlag}
</if>
<!-- 有无融资信息 -->
<if test="businessInfoFinaInfoFlag != null ">
AND business_info_fina_info_flag = #{businessInfoFinaInfoFlag}
</if>
<if test="businessInfoFinaRoundList != null and businessInfoFinaRoundList.size() > 0">
AND business_info_fina_round IN
<foreach collection="businessInfoFinaRoundList" item="businessInfoFinaRound" open="(" separator="," close=")">
#{businessInfoFinaRound}
</foreach>
</if>
<!-- 有无商标信息 -->
<if test="intelPropRightTrademarkInfoFlag != null ">
AND intel_prop_right_trademark_info_flag = #{intelPropRightTrademarkInfoFlag}
</if>
<!-- 有无专利信息 -->
<if test="intelPropRightPatentInfoFlag != null ">
AND intel_prop_right_patent_info_flag = #{intelPropRightPatentInfoFlag}
</if>
<!-- 有无软件著作权 -->
<if test="intelPropRightSoftCopyrightFlag != null ">
AND intel_prop_right_soft_copyright_flag = #{intelPropRightSoftCopyrightFlag}
</if>
<!-- 科技等级-类型 -->
<if test="technologyLvlTypeList != null and technologyLvlTypeList.size() > 0">
AND technology_lvl_type IN
<foreach collection="technologyLvlTypeList" item="technologyLvlType" open="(" separator="," close=")">
#{technologyLvlType}
</foreach>
</if>
<!-- 科技等级-状态 -->
<if test="technologyLvlStateList != null and technologyLvlStateList.size() > 0">
AND technology_lvl_state IN
<foreach collection="technologyLvlStateList" item="technologyLvlState" open="(" separator="," close=")">
#{technologyLvlState}
</foreach>
</if>
<!-- 科技等级-级别 -->
<if test="technologyLvlLevelList != null and technologyLvlLevelList.size() > 0">
AND technology_lvl_level IN
<foreach collection="technologyLvlLevelList" item="technologyLvlLevel" open="(" separator="," close=")">
#{technologyLvlLevel}
</foreach>
</if>
<!-- 有无上市信息 -->
<if test="capMarketListInfoFlag != null ">
AND cap_market_list_info_flag = #{capMarketListInfoFlag}
</if>
<!-- 有无失信信息 -->
<if test="riskCharDisInfoFlag != null ">
AND risk_char_dis_info_flag = #{riskCharDisInfoFlag}
</if>
<!-- 有无破产清算 -->
<if test="riskCharBankruptcyLiquiFlag != null ">
AND risk_char_bankruptcy_liqui_flag = #{riskCharBankruptcyLiquiFlag}
</if>
<!-- 有无变更记录 -->
<if test="riskCharChangeRecordFlag != null ">
AND risk_char_change_record_flag = #{riskCharChangeRecordFlag}
</if>
<!-- 有无失信被执行人 -->
<if test="riskCharDisPersonFlag != null ">
AND risk_char_dis_person_flag = #{riskCharDisPersonFlag}
</if>
<!-- 有无严重失信违法 -->
<if test="riskCharSncFlag != null ">
AND risk_char_snc_flag = #{riskCharSncFlag}
</if>
<!-- 有无限制高消费 -->
<if test="riskCharRhcFlag != null ">
AND risk_char_rhc_flag = #{riskCharRhcFlag}
</if>
<!-- 有无行政处罚 -->
<if test="operatRiskAdminPenaltyFlag != null ">
AND operat_risk_admin_penalty_flag = #{operatRiskAdminPenaltyFlag}
</if>
<!-- 有无环保处罚 -->
<if test="operatRiskEnvirPenaltyFlag != null ">
AND operat_risk_envir_penalty_flag = #{operatRiskEnvirPenaltyFlag}
</if>
<!-- 有无欠税信息 -->
<if test="operatRiskOweTaxInfoFlag != null ">
AND operat_risk_owe_tax_info_flag = #{operatRiskOweTaxInfoFlag}
</if>
<!-- 有无终末案件 -->
<if test="operatRiskFinalCaseFlag != null ">
AND operat_risk_final_case_flag = #{operatRiskFinalCaseFlag}
</if>
<!-- 有无未结案件 -->
<if test="operatRiskUnfinishCaseFlag != null ">
AND operat_risk_unfinish_case_flag = #{operatRiskUnfinishCaseFlag}
</if>
<!-- 新增企业标识 -->
<if test="newCompanyFlag != null">
AND new_company_flag_${dept} = #{newCompanyFlag}
</if>
<!-- 是否是分支机构 -->
<if test="isBranchFlag != null">
AND is_branch_flag = #{isBranchFlag}
</if>
<!-- 是否有分支机构 -->
<if test="isHasBranchFlag != null">
AND is_has_branch_flag = #{isHasBranchFlag}
</if>
<!-- 纳税信用等级 -->
<if test="nsxydjList != null and nsxydjList.size() > 0">
AND nsxydj IN
<foreach collection="nsxydjList" item="nsxydj" open="(" separator="," close=")">
#{nsxydj}
</foreach>
</if>
<!-- 税收违法 -->
<if test="isSswf != null">
AND is_sswf = #{isSswf}
</if>
<!-- 经营异常 -->
<if test="isJyyc != null">
AND is_jyyc = #{isJyyc}
</if>
<!-- 资质证书 -->
<if test="zzzsCodeList != null and zzzsCodeList.size() > 0">
AND
<foreach collection="zzzsCodeList" item="zc" open="(" separator=" or " close=")">
find_in_set(#{zc},zzzs_code)
</foreach>
</if>
<!-- 法人变更 -->
<if test="isFrbg != null">
AND is_frbg = #{isFrbg}
</if>
<!-- 股权冻结 -->
<if test="isGqdj != null">
AND is_gqdj = #{isGqdj}
</if>
</sql>
<sql id="orderCondition">
ORDER BY id
<if test="isAsc != null and isAsc">
asc
</if>
<if test="isAsc != null and !isAsc">
desc
</if>
</sql>
</mapper>

View File

@@ -0,0 +1,113 @@
<?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.datavisual.mapper.AdminRegionDataMapper">
<select id="getTownDataList" resultType="AdminRegionDataVO">
select d.dt,a.label as region_name, a.code, b.relate_depts, b.relate_grids, c.grid as wkt, d.create_time ,d.item_name, d.item_val,b.ops_dept,d.evoFlag
from (
select * from grid_admin_division where level = 4 and
<foreach collection="codeList" item="code" index="index" open="(" separator="OR" close=")">
code LIKE CONCAT(#{code}, '%')
</foreach>
) a
left join (
select left(a.code, 9) as town_code,a.ops_dept,
group_concat(distinct b.relate_dept_name) as relate_depts,
group_concat(distinct c.grid_name) as relate_grids
from grid_region_admin_division_relate a
left join grid_region_user_relate b on a.grid_id = b.grid_id
left join grid_region_grid c on a.grid_id = c.grid_id
where a.delete_flag = '0' and b.delete_flag = '0' and c.delete_flag = '0'
and c.grid_level = '1'
and a.ops_dept = #{opsDept}
<if test=" userLevel != null and userLevel != '' and userLevel =='branch'">
and b.relate_dept_id = #{deptId}
</if>
group by town_code
) b on b.town_code = a.code
left join grid_admin_division_fence c on a.id = c.id
LEFT JOIN (select dt, create_time ,item_name, item_val,ops_dept ,item_idx,code
,CASE WHEN EXISTS (SELECT 1 FROM admin_region_index WHERE code = t.code
<if test=" branchName != null and branchName != '' ">
AND branch_name like CONCAT('%',#{branchName},'%')
</if>
<if test="outletName != null and outletName != ''">
AND outlet_name like CONCAT('%',#{outletName},'%')
</if>
<if test="nickName != null and nickName != ''">
AND ( nick_name like CONCAT('%',#{nickName},'%') or user_name like CONCAT('%',#{nickName},'%') )
</if>
) THEN 'true' ELSE 'false' END AS evoFlag
from admin_region_index t
where ops_dept = #{opsDept} and item_idx = #{itemIdx} and dt = #{dt}
<if test="userLevel == 'head'"> and index_type = 'head' </if>
<if test="userLevel == 'branch'"> and index_type = 'branch' and branch_id = #{deptId} </if>
group by dt, create_time ,item_name, item_val,ops_dept ,item_idx,code
)d on a.code = d.code
where d.dt = #{dt}
</select>
<select id="getVillageDataList" resultType="AdminRegionDataVO">
select d.dt,a.label as region_name, a.code, b.relate_users, b.relate_grids, c.grid as wkt, d.create_time, d.item_name, d.item_val,b.ops_dept,d.evoFlag
from (
select * from grid_admin_division where level = 5
<!-- code !=null 总行支行查询 -->
<if test="code != null and code != ''"> and code LIKE CONCAT(#{code}, '%') </if>
) a
left join (
select a.code,a.ops_dept,
group_concat(distinct concat(b.nick_name, '-', b.user_name)) as relate_users,
group_concat(distinct c.grid_name) as relate_grids
from grid_region_admin_division_relate a
left join grid_region_user_relate b on a.grid_id = b.grid_id
left join grid_region_grid c on a.grid_id = c.grid_id
where a.delete_flag = '0' and b.delete_flag = '0' and c.delete_flag = '0'
and a.ops_dept = #{opsDept}
<if test=" userLevel != null and userLevel != '' and (userLevel == 'outlet' ) ">and b.relate_dept_id = #{deptId}</if>
<if test="code != null and code != ''"> and a.code LIKE CONCAT(#{code}, '%') </if>
<if test="managerId != null and managerId != ''">
and b.user_name = #{managerId}
</if>
<if test="managerId == null or managerId == ''">
and b.relate_dept_id in (select dept_id from sys_dept where dept_id = #{deptId} or find_in_set(#{deptId},ancestors))
</if>
and c.grid_level = '2'
group by a.code
) b on b.code = a.code
left join grid_admin_division_fence c on a.id = c.id
LEFT JOIN (select dt,create_time ,item_name, item_val,ops_dept ,item_idx,code
,CASE WHEN EXISTS (SELECT 1 FROM admin_region_index WHERE code = t.code
<if test=" branchName != null and branchName != '' ">
AND branch_name like CONCAT('%',#{branchName},'%')
</if>
<if test="outletName != null and outletName != ''">
AND outlet_name like CONCAT('%',#{outletName},'%')
</if>
<if test="nickName != null and nickName != ''">
AND ( nick_name like CONCAT('%',#{nickName},'%') or user_name like CONCAT('%',#{nickName},'%') )
</if>
) THEN 'true' ELSE 'false' END AS evoFlag
from admin_region_index t
where ops_dept = #{opsDept} and item_idx = #{itemIdx}
<if test="userLevel == 'manager'"> and user_name = #{managerId} </if>
<if test="userLevel == 'head'"> and index_type = 'head' </if>
<if test="userLevel == 'branch'"> and index_type = 'branch' and branch_id = #{deptId} </if>
<if test="userLevel == 'outlet'"> and index_type = 'outlet' and outlet_id = #{deptId} </if>
group by dt,create_time ,item_name, item_val,ops_dept ,item_idx,code
)d on a.code = d.code
where 1=1
and dt = #{dt}
<if test="userLevel == 'manager' or userLevel == 'outlet' or userLevel == 'branch'">
and b.code is not null;
</if>
</select>
<select id="getIndexDetail" resultType="AdminRegionDataVO">
select id, create_time, level, code, item_name, item_val, dept_id, ops_dept, item_idx ,branch_name, outlet_name, concat( nick_name,'-', user_name) as nick_name,index_type,head_name,
user_name, branch_id, outlet_id
from admin_region_index ari
where ari.code = #{code} and ari.ops_dept = #{opsDept} and ari.item_idx = #{itemIdx} and dt = #{dt}
order by ari.head_id, ari.branch_id,ari.outlet_id,ari.nick_name asc
</select>
</mapper>

View File

@@ -0,0 +1,24 @@
<?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.datavisual.mapper.VisitTrajectoryMapper">
<select id="getVisitTrajectory" parameterType="VisitTrajectoryDTO" resultType="VisitTrajectory">
SELECT * FROM visit_trajectory
WHERE 1=1
<if test="timeInterval != null">
AND date >= (CURDATE() - INTERVAL #{timeInterval} DAY)
</if>
<if test="date != null and date != ''">
AND date = #{date}
</if>
<if test="branchId != null">
AND branch_id = #{branchId}
</if>
<if test="outletId != null">
AND outlet_id = #{outletId}
</if>
<if test="userName != null and userName != ''">
AND user_name = #{userName}
</if>
</select>
</mapper>

View File

@@ -0,0 +1,62 @@
<?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.draw.mapper.DrawGridCustUserUnbindMapper">
<resultMap id="DrawGridCustVO" type="DrawGridCustVO">
<result property="gridId" column="grid_id"/>
<result property="gridName" column="grid_name"/>
<result property="gridDutyType" column="grid_duty_type"/>
<result property="layerId" column="layer_id"/>
<result property="shapeId" column="shape_id"/>
<result property="custId" column="cust_id"/>
<result property="custName" column="cust_name"/>
<result property="custType" column="cust_type"/>
<result property="userName" column="user_name"/>
<result property="nickName" column="nick_name"/>
<result property="branchId" column="branch_id"/>
<result property="branchName" column="branch_name"/>
<result property="outletId" column="outlet_id"/>
<result property="outletName" column="outlet_id"/>
<result property="unbindFlag" column="unbind_flag"/>
</resultMap>
<select id="getCustList" parameterType="DrawGridCustListDTO" resultMap="DrawGridCustVO">
select e.grid_id, e.grid_name, e.grid_duty_type, b.layer_id , b.shape_id , b.cust_id , b.cust_name , b.cust_type
, a.user_name, a.nick_name,
e.dept_id as branch_id, e.dept_name as branch_name, sd.dept_id as outlet_id, sd.dept_name as outlet_name,
(select count(0) from grid_draw_cust_user_unbind d where d.grid_id = #{gridId} and d.cust_id = b.cust_id and
d.user_name = a.user_name and d.delete_flag = '0') as unbind_flag
from (select * from grid_draw_user_relate where delete_flag = '0') a
left join (select * from grid_draw_shape_relate where delete_flag = '0') c on c.grid_id = a.grid_id
left join draw_shape_cust b on b.shape_id = c.shape_id
left join (select * from grid_draw_grid where delete_flag = '0') e on a.grid_id = e.grid_id
left join sys_dept sd on sd.dept_id = a.relate_dept_id and sd.dept_type = "outlet"
where a.grid_id = #{gridId}
<if test="custId != null and custId != ''">AND b.cust_id like concat('%', #{custId}, '%')</if>
<if test="custName != null and custName != ''">AND b.cust_name like concat('%', #{custName}, '%')</if>
<if test="custType != null and custType != ''">AND b.cust_type = #{custType}</if>
</select>
<select id="getCustListByManager" parameterType="DrawGridCustListDTO" resultMap="DrawGridCustVO">
select e.grid_id, e.grid_name, e.grid_duty_type, b.layer_id , b.shape_id , b.cust_id , b.cust_name , b.cust_type
, a.user_name, a.nick_name
from (select * from grid_draw_user_relate where delete_flag = '0') a
left join (select * from grid_draw_shape_relate where delete_flag = '0') c on c.grid_id = a.grid_id
left join draw_shape_cust b on b.shape_id = c.shape_id
left join (select * from grid_draw_grid where delete_flag = '0') e on a.grid_id = e.grid_id
left join sys_dept sd on sd.dept_id = a.relate_dept_id
where a.grid_id = #{gridId} and a.user_name = #{userName}
and not exists
(select 1 from grid_draw_cust_user_unbind d where d.grid_id = #{gridId} and d.cust_id = b.cust_id and
d.user_name =
a.user_name and d.delete_flag = '0')
<if test="custId != null and custId != ''">AND b.cust_id like concat('%', #{custId}, '%')</if>
<if test="custName != null and custName != ''">AND b.cust_name like concat('%', #{custName}, '%')</if>
<if test="custType != null and custType != ''">AND b.cust_type = #{custType}</if>
</select>
<select id="">
</select>
</mapper>

View File

@@ -0,0 +1,120 @@
<?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.draw.mapper.DrawGridMapper">
<resultMap id="DrawGridListVO" type="DrawGridListVO">
<result property="gridId" column="grid_id"/>
<result property="gridName" column="grid_name"/>
<result property="layerId" column="layer_id"/>
<result property="gridDutyType" column="grid_duty_type"/>
<result property="deptId" column="dept_id"/>
<result property="deptName" column="dept_name"/>
</resultMap>
<select id="getGridList" parameterType="DrawGridListDTO" resultMap="DrawGridListVO">
SELECT distinct d.*, CONCAT(su.nick_name, '-',d.create_by) as creator FROM grid_draw_grid d
left join grid_draw_user_relate u on d.grid_id = u.grid_id
left join sys_user su on su.user_name = d.create_by
WHERE d.delete_flag = '0' and u.delete_flag = '0'
AND (d.dept_id in (select dept_id from sys_dept where dept_id = #{deptId} or find_in_set(#{deptId},ancestors))
or (u.relate_dept_id in (select dept_id from sys_dept where dept_id = #{deptId} or
find_in_set(#{deptId},ancestors)))
)
<if test="gridName != null and gridName != ''">AND d.grid_name like concat('%', #{gridName}, '%')</if>
<if test="gridDutyType != null and gridDutyType != ''">AND d.grid_duty_type = #{gridDutyType}</if>
<if test="layerId != null and layerId != ''">AND d.layer_id = #{layerId}</if>
<if test="opsDept != null and opsDept != ''">AND d.ops_dept = #{opsDept}</if>
<if test="relateDeptName != null and relateDeptName != ''">
AND EXISTS(
SELECT 1 FROM grid_draw_user_relate a WHERE a.delete_flag = '0' AND a.grid_id = d.grid_id AND
a.relate_dept_name like concat('%', #{relateDeptName}, '%')
)
</if>
<if test="relateUserName != null and relateUserName != ''">
AND EXISTS(
SELECT 1 FROM grid_draw_user_relate b WHERE b.delete_flag = '0' AND b.grid_id = d.grid_id AND b.user_name
like concat('%', #{relateUserName}, '%')
)
</if>
</select>
<select id="getGridListByManager" parameterType="DrawGridListDTO" resultMap="DrawGridListVO">
SELECT d.*, CONCAT(su.nick_name, '-',d.create_by) as creator FROM grid_draw_user_relate u
LEFT JOIN (SELECT * FROM grid_draw_grid WHERE delete_flag = '0') d ON u.grid_id = d.grid_id
left join sys_user su on su.user_name = d.create_by
WHERE u.user_name = #{userName}
AND u.delete_flag = '0'
<if test="gridName != null and gridName != ''">AND d.grid_name like concat('%', #{gridName}, '%')</if>
<if test="gridDutyType != null and gridDutyType != ''">AND d.grid_duty_type = #{gridDutyType}</if>
<if test="layerId != null and layerId != ''">AND d.layer_id = #{layerId}</if>
<if test="opsDept != null and opsDept != ''">AND d.ops_dept = #{opsDept}</if>
<if test="relateUserName != null and relateUserName != ''">
AND EXISTS(
SELECT 1 FROM grid_draw_user_relate b WHERE b.delete_flag = '0' AND b.grid_id = d.grid_id AND b.user_name
like concat('%', #{relateUserName}, '%')
)
</if>
</select>
<select id="getGridCount" resultType="Long">
SELECT count(distinct d.grid_id)
from grid_draw_grid d
left join grid_draw_user_relate u on d.grid_id = u.grid_id
WHERE d.delete_flag = '0'
and u.delete_flag = '0'
<if test="opsDept != null and opsDept != ''">AND d.ops_dept = #{opsDept}</if>
AND (d.dept_id in
(select dept_id from sys_dept where dept_id = #{deptId} or find_in_set(#{deptId}, ancestors))
or u.relate_dept_id in
(select dept_id from sys_dept where dept_id = #{deptId} or find_in_set(#{deptId}, ancestors))
)
</select>
<select id="getGridCountByManager" resultType="Long">
SELECT count(distinct grid_id)
from grid_draw_user_relate
WHERE delete_flag = '0'
and user_name = #{userName}
</select>
<select id="getCustCount" resultType="Long">
select count(distinct a.cust_id)
from draw_shape_cust a
left join grid_draw_shape_relate b on a.shape_id = b.shape_id
left join grid_draw_user_relate c on b.grid_id = c.grid_id
left join grid_draw_grid d on b.grid_id = d.grid_id
where b.delete_flag = '0'
and c.delete_flag = '0'
and d.delete_flag = '0'
<if test="opsDept != null and opsDept != ''">AND d.ops_dept = #{opsDept}</if>
and a.cust_type = #{custType}
and c.relate_dept_id in
(select dept_id from sys_dept where dept_id = #{deptId} or find_in_set(#{deptId}, ancestors));
</select>
<select id="getCustCountByManager" resultType="Long">
select count(distinct a.cust_id)
from draw_shape_cust a
left join grid_draw_shape_relate b on a.shape_id = b.shape_id
left join grid_draw_user_relate c on b.grid_id = c.grid_id
where b.delete_flag = '0'
and c.delete_flag = '0'
and a.cust_type = #{custType}
and c.user_name = #{userName};
</select>
<select id="getGridListByOpsAndLayer" parameterType="LayerGridDTO" resultType="DrawGrid">
select d.*
from grid_draw_grid d
left join grid_draw_user_relate u on d.grid_id = u.grid_id
WHERE d.delete_flag = '0'
and u.delete_flag = '0'
AND d.layer_id = #{layerId}
and d.ops_dept = #{opsDept}
AND (d.dept_id in
(select dept_id from sys_dept where dept_id = #{deptId} or find_in_set(#{deptId}, ancestors))
or (u.relate_dept_id in
(select dept_id from sys_dept where dept_id = #{deptId} or find_in_set(#{deptId}, ancestors))))
</select>
</mapper>

View File

@@ -0,0 +1,50 @@
<?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.draw.mapper.DrawLayerMapper">
<select id="getLayerList" resultType="com.ruoyi.ibs.draw.domain.vo.LayerRuleVO">
select layer_id,layer_name from draw_layer
where delete_flag = 0
and layer_id in
(select layer_id from draw_shape where ops_dept = #{opsDept} and delete_flag = 0 and dept_id like concat(#{deptId},'%') group by layer_id)
</select>
<select id="getDrawLayerList" resultType="DrawLayerVO">
select dl.layer_id, dl.layer_name, dl.layer_color, ifnull(sum(ds.shape_id) = 0, 1) as disabled from draw_layer dl
left join (
select * from draw_shape where delete_flag = '0'
<if test="deptId != null and deptId != ''"> and left(dept_id,3) = left(#{deptId},3) </if>
and relate_flag = '0'
) ds on ds.layer_id = dl.layer_id
where dl.delete_flag = '0' and dl.dept_id like concat(#{deptHead},'%')
<if test="layerName != null and layerName != ''"> and dl.layer_name like concat('%', #{layerName}, '%') </if>
group by dl.layer_id, dl.layer_name
order by dl.layer_id desc
</select>
<select id="getValidDrawLayerList" resultType="DrawLayerVO">
select dl.layer_id, dl.layer_name, dl.layer_color, ifnull(sum(ds.audit_flag) = 0, 1) as disabled from draw_layer dl
left join (
select *, if(audit_status ='1', 1, 0) as audit_flag from draw_shape
where delete_flag = '0' and ops_dept = #{opsDept} and dept_id = #{deptId} and relate_flag = '0'
) ds on ds.layer_id = dl.layer_id
where dl.delete_flag = '0'
and dl.dept_id like concat(#{deptHead},'%')
group by dl.layer_id, dl.layer_name
order by disabled
</select>
<select id="queryBusinessFreqList" resultType="MapCustCountVO">
select round(iaa.longitude, 4) as lng, round(iaa.latitude, 4) as lat, count(*) as count from cust_info_business cir
left join ibs_anchor ia on cir.cust_id = ia.cust_id
left join ibs_anchor_address iaa on ia.address_id = iaa.id
where iaa.longitude is not null and length(iaa.longitude) != 0 and iaa.latitude is not null and length(iaa.latitude) != 0
group by lng, lat;
</select>
</mapper>

View File

@@ -0,0 +1,19 @@
<?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.draw.mapper.DrawShapeCustMapper">
<insert id="batchInsert">
INSERT INTO draw_shape_cust_${dept} (shape_id, layer_id, cust_id, cust_name, cust_type, address_name, province,
city, county, street, community, address_detail) VALUES
<foreach collection="custList" item="cust" separator=",">
(#{cust.shapeId}, #{cust.layerId}, #{cust.custId}, #{cust.custName}, #{cust.custType}, #{cust.addressName},
#{cust.province},#{cust.city},#{cust.county},#{cust.street},#{cust.community},#{cust.addressDetail})
</foreach>
</insert>
<delete id="batchDelete">
DELETE
FROM draw_shape_cust_${dept}
WHERE shape_id = #{shapeId}
</delete>
</mapper>

View File

@@ -0,0 +1,23 @@
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.ibs.grid.mapper.AnchorCustMapper">
<select id="selectAnchor" resultType="RegionCustVO">
select a.cust_id as cust_id, b.* from ibs_anchor a
left join
ibs_anchor_address b
on a.address_id = b.id
where a.delete_status = 0
and a.cust_id in
<foreach collection="custIds" item="id" index="index" open="(" separator="," close=")">
#{id}
</foreach>
</select>
<select id="getIndustryCode" resultType="java.lang.String">
select code from t_industry
where name = #{name}
</select>
</mapper>

View File

@@ -0,0 +1,178 @@
<?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.grid.mapper.CustInfoMapper">
<select id="countBusinessCustByCode" resultType="int">
SELECT COUNT(*) FROM cust_info_business
WHERE
<foreach collection="codeList" item="code" index="index" open="(" separator="OR" close=")" >
region_code LIKE CONCAT(#{code}, '%')
</foreach>
</select>
<select id="countRetailCustByCode" resultType="int">
SELECT COUNT(*) FROM cust_info_retail
WHERE
<foreach collection="codeList" item="code" index="index" open="(" separator="OR" close=")" >
region_code LIKE CONCAT(#{code}, '%')
</foreach>
</select>
<select id="countMerchantCustByCode" resultType="int">
SELECT COUNT(*) FROM cust_info_merchant
WHERE
<foreach collection="codeList" item="code" index="index" open="(" separator="OR" close=")">
region_code LIKE CONCAT(#{code}, '%')
</foreach>
</select>
<select id="selectRegionCustByCode" resultType="RegionCustVO">
SELECT '个人' as cust_type, cust_name, cust_id
FROM cust_info_retail
WHERE region_code LIKE CONCAT(#{code}, '%')
UNION ALL
SELECT '企业' as cust_type, cust_name, cust_id
FROM cust_info_business
WHERE region_code LIKE CONCAT(#{code}, '%')
UNION ALL
SELECT '商户' as cust_type, cust_name, cust_id
FROM cust_info_merchant
WHERE region_code LIKE CONCAT(#{code}, '%')
</select>
<select id="selectRegionRetailByCode" resultType="RegionCustVO">
SELECT '个人' as cust_type, cust_name, cust_id
FROM cust_info_retail
WHERE region_code LIKE CONCAT(#{code}, '%')
</select>
<select id="selectRegionBusinessByCode" resultType="RegionCustVO">
SELECT '企业' as cust_type, cust_name, cust_id
FROM cust_info_business
WHERE region_code LIKE CONCAT(#{code}, '%')
</select>
<select id="selectRegionMerchantByCode" resultType="RegionCustVO">
SELECT '商户' as cust_type, cust_name, cust_id
FROM cust_info_merchant
WHERE region_code LIKE CONCAT(#{code}, '%')
</select>
<select id="selectCustByCode" resultType="ShapeCustVO">
SELECT '0' as cust_type, ci.cust_name, ci.cust_id, iaa.longitude, iaa.latitude, iaa.address_name, iaa.province,
iaa.city, iaa.county, iaa.street, iaa.community, iaa.address_detail
FROM cust_info_retail_${dept} ci
LEFT JOIN ibs_anchor_${dept} ia on ci.cust_id = ia.cust_id
LEFT JOIN ibs_anchor_address_${dept} iaa on ia.address_id = iaa.id
WHERE ia.address_id != 0
<if test="codeList != null and codeList.size() > 0">
and ci.region_code in
<foreach collection="codeList" item="code" index="index" open="(" separator="," close=")">
#{code}
</foreach>
</if>
UNION ALL
SELECT '2' as cust_type, ci.cust_name, ci.cust_id, iaa.longitude, iaa.latitude, iaa.address_name, iaa.province,
iaa.city, iaa.county, iaa.street, iaa.community, iaa.address_detail
FROM cust_info_business_${dept} ci
LEFT JOIN ibs_anchor_${dept} ia on ci.cust_id = ia.cust_id
LEFT JOIN ibs_anchor_address_${dept} iaa on ia.address_id = iaa.id
WHERE ia.address_id != 0
<if test="codeList != null and codeList.size() > 0">
and ci.region_code in
<foreach collection="codeList" item="code" index="index" open="(" separator="," close=")">
#{code}
</foreach>
</if>
UNION ALL
SELECT '1' as cust_type, ci.cust_name, ci.cust_id, iaa.longitude, iaa.latitude, iaa.address_name, iaa.province,
iaa.city, iaa.county, iaa.street, iaa.community, iaa.address_detail
FROM cust_info_merchant_${dept} ci
LEFT JOIN ibs_anchor_${dept} ia on ci.cust_id = ia.cust_id
LEFT JOIN ibs_anchor_address_${dept} iaa on ia.address_id = iaa.id
WHERE ia.address_id != 0
<if test="codeList != null and codeList.size() > 0">
and ci.region_code in
<foreach collection="codeList" item="code" index="index" open="(" separator="," close=")">
#{code}
</foreach>
</if>
</select>
<select id="selectPrivateCustByCode" resultType="ShapeCustVO">
SELECT '0' as cust_type, ci.cust_name, ci.cust_id, iaa.longitude, iaa.latitude, iaa.address_name, iaa.province,
iaa.city, iaa.county, iaa.street, iaa.community, iaa.address_detail
FROM cust_info_retail_${dept} ci
LEFT JOIN ibs_anchor_${dept} ia on ci.cust_id = ia.cust_id
LEFT JOIN ibs_anchor_address_${dept} iaa on ia.address_id = iaa.id
WHERE ia.address_id != 0
<if test="codeList != null and codeList.size() > 0">
and ci.region_code in
<foreach collection="codeList" item="code" index="index" open="(" separator="," close=")">
#{code}
</foreach>
</if>
UNION ALL
SELECT '1' as cust_type, ci.cust_name, ci.cust_id, iaa.longitude, iaa.latitude, iaa.address_name, iaa.province,
iaa.city, iaa.county, iaa.street, iaa.community, iaa.address_detail
FROM cust_info_merchant_${dept} ci
LEFT JOIN ibs_anchor_${dept} ia on ci.cust_id = ia.cust_id
LEFT JOIN ibs_anchor_address_${dept} iaa on ia.address_id = iaa.id
WHERE ia.address_id != 0
<if test="codeList != null and codeList.size() > 0">
and ci.region_code in
<foreach collection="codeList" item="code" index="index" open="(" separator="," close=")">
#{code}
</foreach>
</if>
</select>
<select id="selectPublicCustByCode" resultType="ShapeCustVO">
SELECT '2' as cust_type, ci.cust_name, ci.cust_id, iaa.longitude, iaa.latitude, iaa.address_name, iaa.province,
iaa.city, iaa.county, iaa.street, iaa.community, iaa.address_detail
FROM cust_info_business_${dept} ci
LEFT JOIN ibs_anchor_${dept} ia on ci.cust_id = ia.cust_id
LEFT JOIN ibs_anchor_address_${dept} iaa on ia.address_id = iaa.id
WHERE ia.address_id != 0
<if test="codeList != null and codeList.size() > 0">
and ci.region_code in
<foreach collection="codeList" item="code" index="index" open="(" separator="," close=")">
#{code}
</foreach>
</if>
</select>
<insert id="insertToRetailByVirtualCustDTO">
INSERT INTO cust_info_retail_${dept}
(cust_id,cust_name, cust_idc, update_by, update_time, cust_phone)
VALUES
<foreach collection="list" item="item" separator=",">
(#{item.custId},#{item.custName}, #{item.custIdn}, #{updateBy}, #{updateTime}, #{item.phoneNum})
</foreach>
</insert>
<insert id="insertToMerchantByVirtualCustDTO">
INSERT INTO cust_info_merchant_${dept}
(cust_id,cust_name, social_credit_code, update_by, update_time, cust_phone)
VALUES
<foreach collection="list" item="item" separator=",">
(#{item.custId},#{item.custName}, #{item.custIdn}, #{updateBy}, #{updateTime}, #{item.phoneNum})
</foreach>
</insert>
<insert id="insertToBusinessByVirtualCustDTO">
INSERT INTO cust_info_business_${dept}
(cust_id,cust_name, social_credit_code, update_by, update_time, cust_phone)
VALUES
<foreach collection="list" item="item" separator=",">
(#{item.custId},#{item.custName}, #{item.custIdn}, #{updateBy}, #{updateTime}, #{item.phoneNum})
</foreach>
</insert>
<select id="selectExistCustByCustId" resultType="String">
select cust_id from
<if test="custType == 0">cust_info_retail_${dept}</if>
<if test="custType == 1">cust_info_merchant_${dept}</if>
<if test="custType == 2">cust_info_business_${dept}</if>
where find_in_set(cust_id ,#{custIds});
</select>
</mapper>

View File

@@ -0,0 +1,80 @@
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.ibs.grid.mapper.GridCountMapper">
<select id="selectLsCountList" resultType="com.ruoyi.ibs.grid.domain.entity.GridCmpmCountLingshou">
SELECT dt, grid_name, grid_name2, county, town, village, dept_id,dept_name, outlets_id,outlets_name,
user_name, cust_num, cur_bal_d, cur_bal_t, bal_loan, cur_bal_5_bad, cur_d_ave,
cur_t_ave, loan_ave, ph_rat, sx_rat, yxht_rat, xyk_rat, fshl_rat, sd_rat,
etc_rat, dian_rat, black_rat, bad_rat, bad_bal_rat, ph_num, sx_num, yxht_num,
xyk_num, fshl_num, sd_num, etc_num, dian_num, black_num, bad_num, region_code, ops_dept,
zf_365cnt, zf_180cnt, zf_90cnt, zf_30cnt, zf_365rt, zf_180rt, zf_90rt, zf_30rt
FROM grid_cmpm_count_lingshou
<where>
<if test=" dt != null and dt != ''">and dt = #{dt}</if>
<if test=" town != null and town != ''">and town like concat('%',concat(#{town},'%'))</if>
<if test=" village != null and village != ''">and village like concat('%',concat(#{village},'%'))</if>
<if test=" isBranch == true">and dept_id like concat('%',concat(#{deptId},'%'))</if>
<if test=" isOutlet == true">and outlets_id like concat('%',concat(#{deptId},'%'))</if>
<if test=" isManager == true">and user_name like concat('%',concat(#{userName},'%'))</if>
</where>
</select>
<select id="selectGsCountList" resultType="com.ruoyi.ibs.grid.domain.entity.GridCmpmCountGongsi">
SELECT dt, grid_name, grid_name2, town, dept_id,dept_name, outlets_id,outlets_name, user_name,
cust_num, hq_cur_balance, bz_cur_balance, loan_balance_cny, finance_prod_711_balance,ustr_count_per_m,ustr_bal_m,
finance_prod_716_balance, loan_year_dailyaverage, htqy_rat, qfcd_rat, tx_rat, bh_rat,
yxdfgz_rat, dkdf_rat, dksf_rat, dkshf_rat, pjb_rat, czb_rat, sfb_rat, mrb_rat, szst_rat,
kh_rat, gjjsyw_rat, yqjsh_rat, htqy_num, qfcd_num, tx_num, bh_num, yxdfgz_num, dkdf_num,
dksf_num, dkshf_num, pjb_num, czb_num, sfb_num, mrb_num, szst_num, kh_num, gjjsyw_num,
yqjsh_num, region_code, ops_dept,
zf_365cnt, zf_180cnt, zf_90cnt, zf_30cnt, zf_365rt, zf_180rt, zf_90rt, zf_30rt
FROM grid_cmpm_count_gongsi
<where>
dept_type = #{userRole}
<if test=" dt != null and dt != ''">and dt = #{dt}</if>
<if test=" isBranch == true">
and dept_id = #{deptId}
</if>
<if test=" isOutlet == true">
and outlets_id = #{deptId}
</if>
<if test=" isManager == true">
and user_name like concat('%',concat(#{userName},'%'))
</if>
<if test=" town != null and town != ''">and town like concat('%',concat(#{town},'%'))</if>
<if test=" village != null and village != ''">and village like concat('%',concat(#{village},'%'))</if>
</where>
</select>
<select id="selectLsCustList" resultType="com.ruoyi.ibs.grid.domain.entity.GridCustCountLingshou">
SELECT cust_name, cust_idc, cust_isn, cur_bal_d, cur_bal_t, bal_loan, cur_bal_5_bad, cur_d_ave,
cur_t_ave, loan_ave, is_ph, is_sx, is_yxht, is_xyk, fshl, is_sd, etc, dian, is_black, is_bad,
region_code, ops_dept, cust_type,
is_365zf, is_180zf, is_90zf, is_30zf
FROM grid_cust_count_lingshou
where region_code = #{regionCode}
<if test=" dt != null and dt != ''">and dt = #{dt}</if>
<if test=" custName != null and custName != ''">and cust_name like concat('%',concat(#{custName},'%'))</if>
<if test=" custIdc != null and custIdc != ''">and cust_idc like concat('%',concat(#{custIdc},'%'))</if>
</select>
<select id="selectGsCustList" resultType="com.ruoyi.ibs.grid.domain.entity.GridCustCountGongsi">
SELECT cust_name, social_credit_code, cust_isn, hq_cur_balance, bz_cur_balance, is_credit,
loan_balance_cny, loan_year_dailyaverage, is_htqy, finance_prod_716_open_flag, finance_prod_716_balance,
finance_prod_711_open_flag, finance_prod_711_balance, intl_bussiness_jcbh_open_flag, is_ustr,
ustr_count_per_m, ustr_bal_m, eleccharge_sign_flag, watercharge_sign_flag, taxdeduction_sign_flag,
pjb, czb, sfb, mrb, szst, is_open_sts, intl_bussiness_open_flag, intl_bussiness_325_open_flag, region_code, ops_dept, cust_type,
is_365zf, is_180zf, is_90zf, is_30zf
FROM grid_cust_count_gongsi
where region_code = #{regionCode}
<if test=" dt != null and dt != ''">and dt = #{dt}</if>
<if test=" isBranch == true">and dept_id like concat('%',concat(#{deptId},'%'))</if>
<if test=" isOutlet == true">and outlets_id like concat('%',concat(#{deptId},'%'))</if>
<if test=" isManager == true">and user_name like concat('%',concat(#{userName},'%'))</if>
<if test=" custName != null and custName != ''">and cust_name like concat('%',concat(#{custName},'%'))</if>
<if test=" socialCreditCode != null and socialCreditCode != ''">and social_credit_code like concat('%',concat(#{socialCreditCode},'%'))</if>
</select>
</mapper>

View File

@@ -0,0 +1,470 @@
<?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.grid.mapper.GridShapeCountMapper">
<resultMap type="GridShapeCountGongsi" id="GridShapeCountGongsiResult">
<result property="dt" column="dt" />
<result property="shapeType" column="shape_type" />
<result property="shapeId" column="shape_id" />
<result property="shapeName" column="shape_name" />
<result property="gridId" column="grid_id" />
<result property="gridName" column="grid_name" />
<result property="deptId" column="dept_id" />
<result property="deptName" column="dept_name" />
<result property="outletsId" column="outlets_id" />
<result property="outletsName" column="outlets_name" />
<result property="userName" column="user_name" />
<result property="custNum" column="cust_num" />
<result property="hqCurBalance" column="hq_cur_balance" />
<result property="bzCurBalance" column="bz_cur_balance" />
<result property="loanBalanceCny" column="loan_balance_cny" />
<result property="financeProd711Balance" column="finance_prod_711_balance" />
<result property="financeProd716Balance" column="finance_prod_716_balance" />
<result property="loanYearDailyaverage" column="loan_year_dailyaverage" />
<result property="htqyRat" column="htqy_rat" />
<result property="qfcdRat" column="qfcd_rat" />
<result property="txRat" column="tx_rat" />
<result property="bhRat" column="bh_rat" />
<result property="yxdfgzRat" column="yxdfgz_rat" />
<result property="dkdfRat" column="dkdf_rat" />
<result property="dksfRat" column="dksf_rat" />
<result property="dkshfRat" column="dkshf_rat" />
<result property="pjbRat" column="pjb_rat" />
<result property="czbRat" column="czb_rat" />
<result property="sfbRat" column="sfb_rat" />
<result property="mrbRat" column="mrb_rat" />
<result property="szstRat" column="szst_rat" />
<result property="khRat" column="kh_rat" />
<result property="gjjsywRat" column="gjjsyw_rat" />
<result property="yqjshRat" column="yqjsh_rat" />
<result property="htqyNum" column="htqy_num" />
<result property="qfcdNum" column="qfcd_num" />
<result property="txNum" column="tx_num" />
<result property="bhNum" column="bh_num" />
<result property="yxdfgzNum" column="yxdfgz_num" />
<result property="ustrCountPerM" column="ustr_count_per_m" />
<result property="ustrBalM" column="ustr_bal_m" />
<result property="dkdfNum" column="dkdf_num" />
<result property="dksfNum" column="dksf_num" />
<result property="dkshfNum" column="dkshf_num" />
<result property="pjbNum" column="pjb_num" />
<result property="czbNum" column="czb_num" />
<result property="sfbNum" column="sfb_num" />
<result property="mrbNum" column="mrb_num" />
<result property="szstNum" column="szst_num" />
<result property="khNum" column="kh_num" />
<result property="gjjsywNum" column="gjjsyw_num" />
<result property="yqjshNum" column="yqjsh_num" />
<result property="opsDept" column="ops_dept" />
</resultMap>
<resultMap type="GridShapeCountLingshou" id="GridShapeCountLingshouResult">
<result property="dt" column="dt" />
<result property="shapeType" column="shape_type" />
<result property="shapeId" column="shape_id" />
<result property="shapeName" column="shape_name" />
<result property="gridId" column="grid_id" />
<result property="gridName" column="grid_name" />
<result property="deptId" column="dept_id" />
<result property="deptName" column="dept_name" />
<result property="outletsId" column="outlets_id" />
<result property="outletsName" column="outlets_name" />
<result property="userName" column="user_name" />
<result property="custNum" column="cust_num" />
<result property="curBalD" column="cur_bal_d" />
<result property="curBalT" column="cur_bal_t" />
<result property="balLoan" column="bal_loan" />
<result property="curBal5Bad" column="cur_bal_5_bad" />
<result property="curDAve" column="cur_d_ave" />
<result property="curTAve" column="cur_t_ave" />
<result property="loanAve" column="loan_ave" />
<result property="phRat" column="ph_rat" />
<result property="sxRat" column="sx_rat" />
<result property="yxhtRat" column="yxht_rat" />
<result property="xykRat" column="xyk_rat" />
<result property="fshlRat" column="fshl_rat" />
<result property="sdRat" column="sd_rat" />
<result property="etcRat" column="etc_rat" />
<result property="dianRat" column="dian_rat" />
<result property="blackRat" column="black_rat" />
<result property="badRat" column="bad_rat" />
<result property="badBalRat" column="bad_bal_rat" />
<result property="phNum" column="ph_num" />
<result property="sxNum" column="sx_num" />
<result property="yxhtNum" column="yxht_num" />
<result property="xykNum" column="xyk_num" />
<result property="fshlNum" column="fshl_num" />
<result property="sdNum" column="sd_num" />
<result property="etcNum" column="etc_num" />
<result property="dianNum" column="dian_num" />
<result property="blackNum" column="black_num" />
<result property="badNum" column="bad_num" />
<result property="opsDept" column="ops_dept" />
</resultMap>
<resultMap type="GridShapeCustGongsi" id="GridShapeCustGongsiResult">
<result property="custName" column="cust_name" />
<result property="socialCreditCode" column="social_credit_code" />
<result property="custIsn" column="cust_isn" />
<result property="hqCurBalance" column="hq_cur_balance" />
<result property="bzCurBalance" column="bz_cur_balance" />
<result property="isCredit" column="is_credit" />
<result property="loanBalanceCny" column="loan_balance_cny" />
<result property="loanYearDailyaverage" column="loan_year_dailyaverage" />
<result property="isHtqy" column="is_htqy" />
<result property="financeProd716OpenFlag" column="finance_prod_716_open_flag" />
<result property="financeProd716Balance" column="finance_prod_716_balance" />
<result property="financeProd711OpenFlag" column="finance_prod_711_open_flag" />
<result property="financeProd711Balance" column="finance_prod_711_balance" />
<result property="intlBussinessJcbhOpenFlag" column="intl_bussiness_jcbh_open_flag" />
<result property="isUstr" column="is_ustr" />
<result property="ustrCountPerM" column="ustr_count_per_m" />
<result property="ustrBalM" column="ustr_bal_m" />
<result property="elecchargeSignFlag" column="eleccharge_sign_flag" />
<result property="waterchargeSignFlag" column="watercharge_sign_flag" />
<result property="taxdeductionSignFlag" column="taxdeduction_sign_flag" />
<result property="pjb" column="pjb" />
<result property="czb" column="czb" />
<result property="sfb" column="sfb" />
<result property="mrb" column="mrb" />
<result property="szst" column="szst" />
<result property="isOpenSts" column="is_open_sts" />
<result property="intlBussinessOpenFlag" column="intl_bussiness_open_flag" />
<result property="intlBussiness325OpenFlag" column="intl_bussiness_325_open_flag" />
<result property="shapeId" column="shape_id" />
<result property="opsDept" column="ops_dept" />
<result property="custType" column="cust_type" />
</resultMap>
<resultMap type="GridShapeCustLingshou" id="GridShapeCustLingshouResult">
<result property="custName" column="cust_name" />
<result property="custIdc" column="cust_idc" />
<result property="custIsn" column="cust_isn" />
<result property="curBalD" column="cur_bal_d" />
<result property="curBalT" column="cur_bal_t" />
<result property="balLoan" column="bal_loan" />
<result property="curBal5Bad" column="cur_bal_5_bad" />
<result property="curDAve" column="cur_d_ave" />
<result property="curTAve" column="cur_t_ave" />
<result property="loanAve" column="loan_ave" />
<result property="isPh" column="is_ph" />
<result property="isSx" column="is_sx" />
<result property="isYxht" column="is_yxht" />
<result property="isXyk" column="is_xyk" />
<result property="fshl" column="fshl" />
<result property="isSd" column="is_sd" />
<result property="etc" column="etc" />
<result property="dian" column="dian" />
<result property="isBlack" column="is_black" />
<result property="isBad" column="is_bad" />
<result property="shapeId" column="shape_id" />
<result property="opsDept" column="ops_dept" />
<result property="custType" column="cust_type" />
</resultMap>
<sql id="selectGridShapeCountGongsiVo">
select dt, shape_type, shape_id, shape_name, grid_id, grid_name, dept_id, dept_name, outlets_id, outlets_name, user_name, cust_num, hq_cur_balance, bz_cur_balance, loan_balance_cny, finance_prod_711_balance, finance_prod_716_balance, loan_year_dailyaverage, htqy_rat, qfcd_rat, tx_rat, bh_rat, yxdfgz_rat, dkdf_rat, dksf_rat, dkshf_rat, pjb_rat, czb_rat, sfb_rat, mrb_rat, szst_rat, kh_rat, gjjsyw_rat, yqjsh_rat, htqy_num, qfcd_num, tx_num, bh_num, yxdfgz_num, ustr_count_per_m, ustr_bal_m, dkdf_num, dksf_num, dkshf_num, pjb_num, czb_num, sfb_num, mrb_num, szst_num, kh_num, gjjsyw_num, yqjsh_num, ops_dept from grid_shape_count_gongsi
</sql>
<select id="selectGridShapeCountGongsiList" parameterType="GridShapeCountGongsi" resultMap="GridShapeCountGongsiResult">
select dt, shape_type, shape_id, shape_name, grid_id, grid_name, dept_id, dept_name, outlets_id, outlets_name, user_name, cust_num, hq_cur_balance, bz_cur_balance, loan_balance_cny, finance_prod_711_balance, finance_prod_716_balance, loan_year_dailyaverage, htqy_rat, qfcd_rat, tx_rat, bh_rat, yxdfgz_rat, dkdf_rat, dksf_rat, dkshf_rat, pjb_rat, czb_rat, sfb_rat, mrb_rat, szst_rat, kh_rat, gjjsyw_rat, yqjsh_rat, htqy_num, qfcd_num, tx_num, bh_num, yxdfgz_num, ustr_count_per_m, ustr_bal_m, dkdf_num, dksf_num, dkshf_num, pjb_num, czb_num, sfb_num, mrb_num, szst_num, kh_num, gjjsyw_num, yqjsh_num, ops_dept,
zf_365cnt, zf_180cnt, zf_90cnt, zf_30cnt, zf_365rt, zf_180rt, zf_90rt, zf_30rt
from grid_shape_count_gongsi
<where>
<if test=" dt != null and dt != ''">and dt = #{dt}</if>
<if test=" shapeName != null and shapeName != ''">and shape_name like concat('%',concat(#{shapeName},'%'))</if>
<if test=" shapeType != null and shapeType != ''">and shape_type like concat('%',concat(#{shapeType},'%'))</if>
<if test=" gridName != null and gridName != ''">and grid_name like concat('%',concat(#{gridName},'%'))</if>
<if test=" isBranch == true">and dept_id like concat('%',concat(#{deptId},'%'))</if>
<if test=" isOutlet == true">and outlets_id like concat('%',concat(#{deptId},'%'))</if>
<if test=" isManager == true">and user_name like concat('%',concat(#{userName},'%'))</if>
</where>
</select>
<select id="selectGridShapeCountLingshouList" parameterType="GridShapeCountLingshou" resultMap="GridShapeCountLingshouResult">
select dt, shape_type, shape_id, shape_name, grid_id, grid_name, dept_id, dept_name, outlets_id, outlets_name, user_name, cust_num, cur_bal_d, cur_bal_t, bal_loan, cur_bal_5_bad, cur_d_ave, cur_t_ave, loan_ave, ph_rat, sx_rat, yxht_rat, xyk_rat, fshl_rat, sd_rat, etc_rat, dian_rat, black_rat, bad_rat, bad_bal_rat, ph_num, sx_num, yxht_num, xyk_num, fshl_num, sd_num, etc_num, dian_num, black_num, bad_num, ops_dept,
zf_365cnt, zf_180cnt, zf_90cnt, zf_30cnt, zf_365rt, zf_180rt, zf_90rt, zf_30rt
from grid_shape_count_lingshou
<where>
<if test=" dt != null and dt != ''">and dt = #{dt}</if>
<if test=" shapeName != null and shapeName != ''">and shape_name like concat('%',concat(#{shapeName},'%'))</if>
<if test=" shapeType != null and shapeType != ''">and shape_type like concat('%',concat(#{shapeType},'%'))</if>
<if test=" gridName != null and gridName != ''">and grid_name like concat('%',concat(#{gridName},'%'))</if>
<if test=" isBranch == true">and dept_id like concat('%',concat(#{deptId},'%'))</if>
<if test=" isOutlet == true">and outlets_id like concat('%',concat(#{deptId},'%'))</if>
<if test=" isManager == true">and user_name like concat('%',concat(#{userName},'%'))</if>
</where>
</select>
<select id="selectGridShapeCountgsCustList" parameterType="GridShapeCustGongsi" resultMap="GridShapeCustGongsiResult">
select cust_name, social_credit_code, cust_isn, hq_cur_balance, bz_cur_balance, is_credit, loan_balance_cny, loan_year_dailyaverage, is_htqy, finance_prod_716_open_flag, finance_prod_716_balance, finance_prod_711_open_flag, finance_prod_711_balance, intl_bussiness_jcbh_open_flag, is_ustr, ustr_count_per_m, ustr_bal_m, eleccharge_sign_flag, watercharge_sign_flag, taxdeduction_sign_flag, pjb, czb, sfb, mrb, szst, is_open_sts, intl_bussiness_open_flag, intl_bussiness_325_open_flag, shape_id, ops_dept, cust_type,
is_365zf, is_180zf, is_90zf, is_30zf
from grid_shape_cust_gongsi
where FIND_IN_SET(#{shapeId}, shape_id) > 0
<if test=" dt != null and dt != ''">and dt = #{dt}</if>
<if test=" custName != null and custName != ''">and cust_name like concat('%',concat(#{custName},'%'))</if>
<if test=" socialCreditCode != null and socialCreditCode != ''">and social_credit_code like concat('%',concat(#{socialCreditCode},'%'))</if>
</select>
<select id="selectGridShapeCountlsCustList" parameterType="GridShapeCustLingshou" resultMap="GridShapeCustLingshouResult">
select cust_name, cust_idc, cust_isn, cur_bal_d, cur_bal_t, bal_loan, cur_bal_5_bad, cur_d_ave, cur_t_ave, loan_ave, is_ph, is_sx, is_yxht, is_xyk, fshl, is_sd, etc, dian, is_black, is_bad, shape_id, ops_dept, cust_type,
is_365zf, is_180zf, is_90zf, is_30zf
from grid_shape_cust_lingshou
where FIND_IN_SET(#{shapeId}, shape_id) > 0
<if test=" dt != null and dt != ''">and dt = #{dt}</if>
<if test=" custName != null and custName != ''">and cust_name like concat('%',concat(#{custName},'%'))</if>
<if test=" custIdc != null and custIdc != ''">and cust_idc like concat('%',concat(#{custIdc},'%'))</if>
</select>
<select id="selectGridShapeCountGongsiByDt" parameterType="String" resultMap="GridShapeCountGongsiResult">
<include refid="selectGridShapeCountGongsiVo"/>
where dt = #{dt}
</select>
<insert id="insertGridShapeCountGongsi" parameterType="GridShapeCountGongsi">
insert into grid_shape_count_gongsi
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="dt != null">dt,</if>
<if test="shapeType != null">shape_type,</if>
<if test="shapeId != null">shape_id,</if>
<if test="shapeName != null">shape_name,</if>
<if test="gridId != null">grid_id,</if>
<if test="gridName != null">grid_name,</if>
<if test="deptId != null">dept_id,</if>
<if test="deptName != null">dept_name,</if>
<if test="outletsId != null">outlets_id,</if>
<if test="outletsName != null">outlets_name,</if>
<if test="userName != null">user_name,</if>
<if test="custNum != null">cust_num,</if>
<if test="hqCurBalance != null">hq_cur_balance,</if>
<if test="bzCurBalance != null">bz_cur_balance,</if>
<if test="loanBalanceCny != null">loan_balance_cny,</if>
<if test="financeProd711Balance != null">finance_prod_711_balance,</if>
<if test="financeProd716Balance != null">finance_prod_716_balance,</if>
<if test="loanYearDailyaverage != null">loan_year_dailyaverage,</if>
<if test="htqyRat != null">htqy_rat,</if>
<if test="qfcdRat != null">qfcd_rat,</if>
<if test="txRat != null">tx_rat,</if>
<if test="bhRat != null">bh_rat,</if>
<if test="yxdfgzRat != null">yxdfgz_rat,</if>
<if test="dkdfRat != null">dkdf_rat,</if>
<if test="dksfRat != null">dksf_rat,</if>
<if test="dkshfRat != null">dkshf_rat,</if>
<if test="pjbRat != null">pjb_rat,</if>
<if test="czbRat != null">czb_rat,</if>
<if test="sfbRat != null">sfb_rat,</if>
<if test="mrbRat != null">mrb_rat,</if>
<if test="szstRat != null">szst_rat,</if>
<if test="khRat != null">kh_rat,</if>
<if test="gjjsywRat != null">gjjsyw_rat,</if>
<if test="yqjshRat != null">yqjsh_rat,</if>
<if test="htqyNum != null">htqy_num,</if>
<if test="qfcdNum != null">qfcd_num,</if>
<if test="txNum != null">tx_num,</if>
<if test="bhNum != null">bh_num,</if>
<if test="yxdfgzNum != null">yxdfgz_num,</if>
<if test="ustrCountPerM != null">ustr_count_per_m,</if>
<if test="ustrBalM != null">ustr_bal_m,</if>
<if test="dkdfNum != null">dkdf_num,</if>
<if test="dksfNum != null">dksf_num,</if>
<if test="dkshfNum != null">dkshf_num,</if>
<if test="pjbNum != null">pjb_num,</if>
<if test="czbNum != null">czb_num,</if>
<if test="sfbNum != null">sfb_num,</if>
<if test="mrbNum != null">mrb_num,</if>
<if test="szstNum != null">szst_num,</if>
<if test="khNum != null">kh_num,</if>
<if test="gjjsywNum != null">gjjsyw_num,</if>
<if test="yqjshNum != null">yqjsh_num,</if>
<if test="opsDept != null">ops_dept,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="dt != null">#{dt},</if>
<if test="shapeType != null">#{shapeType},</if>
<if test="shapeId != null">#{shapeId},</if>
<if test="shapeName != null">#{shapeName},</if>
<if test="gridId != null">#{gridId},</if>
<if test="gridName != null">#{gridName},</if>
<if test="deptId != null">#{deptId},</if>
<if test="deptName != null">#{deptName},</if>
<if test="outletsId != null">#{outletsId},</if>
<if test="outletsName != null">#{outletsName},</if>
<if test="userName != null">#{userName},</if>
<if test="custNum != null">#{custNum},</if>
<if test="hqCurBalance != null">#{hqCurBalance},</if>
<if test="bzCurBalance != null">#{bzCurBalance},</if>
<if test="loanBalanceCny != null">#{loanBalanceCny},</if>
<if test="financeProd711Balance != null">#{financeProd711Balance},</if>
<if test="financeProd716Balance != null">#{financeProd716Balance},</if>
<if test="loanYearDailyaverage != null">#{loanYearDailyaverage},</if>
<if test="htqyRat != null">#{htqyRat},</if>
<if test="qfcdRat != null">#{qfcdRat},</if>
<if test="txRat != null">#{txRat},</if>
<if test="bhRat != null">#{bhRat},</if>
<if test="yxdfgzRat != null">#{yxdfgzRat},</if>
<if test="dkdfRat != null">#{dkdfRat},</if>
<if test="dksfRat != null">#{dksfRat},</if>
<if test="dkshfRat != null">#{dkshfRat},</if>
<if test="pjbRat != null">#{pjbRat},</if>
<if test="czbRat != null">#{czbRat},</if>
<if test="sfbRat != null">#{sfbRat},</if>
<if test="mrbRat != null">#{mrbRat},</if>
<if test="szstRat != null">#{szstRat},</if>
<if test="khRat != null">#{khRat},</if>
<if test="gjjsywRat != null">#{gjjsywRat},</if>
<if test="yqjshRat != null">#{yqjshRat},</if>
<if test="htqyNum != null">#{htqyNum},</if>
<if test="qfcdNum != null">#{qfcdNum},</if>
<if test="txNum != null">#{txNum},</if>
<if test="bhNum != null">#{bhNum},</if>
<if test="yxdfgzNum != null">#{yxdfgzNum},</if>
<if test="ustrCountPerM != null">#{ustrCountPerM},</if>
<if test="ustrBalM != null">#{ustrBalM},</if>
<if test="dkdfNum != null">#{dkdfNum},</if>
<if test="dksfNum != null">#{dksfNum},</if>
<if test="dkshfNum != null">#{dkshfNum},</if>
<if test="pjbNum != null">#{pjbNum},</if>
<if test="czbNum != null">#{czbNum},</if>
<if test="sfbNum != null">#{sfbNum},</if>
<if test="mrbNum != null">#{mrbNum},</if>
<if test="szstNum != null">#{szstNum},</if>
<if test="khNum != null">#{khNum},</if>
<if test="gjjsywNum != null">#{gjjsywNum},</if>
<if test="yqjshNum != null">#{yqjshNum},</if>
<if test="opsDept != null">#{opsDept},</if>
</trim>
</insert>
<update id="updateGridShapeCountGongsi" parameterType="GridShapeCountGongsi">
update grid_shape_count_gongsi
<trim prefix="SET" suffixOverrides=",">
<if test="shapeType != null">shape_type = #{shapeType},</if>
<if test="shapeId != null">shape_id = #{shapeId},</if>
<if test="shapeName != null">shape_name = #{shapeName},</if>
<if test="gridId != null">grid_id = #{gridId},</if>
<if test="gridName != null">grid_name = #{gridName},</if>
<if test="deptId != null">dept_id = #{deptId},</if>
<if test="deptName != null">dept_name = #{deptName},</if>
<if test="outletsId != null">outlets_id = #{outletsId},</if>
<if test="outletsName != null">outlets_name = #{outletsName},</if>
<if test="userName != null">user_name = #{userName},</if>
<if test="custNum != null">cust_num = #{custNum},</if>
<if test="hqCurBalance != null">hq_cur_balance = #{hqCurBalance},</if>
<if test="bzCurBalance != null">bz_cur_balance = #{bzCurBalance},</if>
<if test="loanBalanceCny != null">loan_balance_cny = #{loanBalanceCny},</if>
<if test="financeProd711Balance != null">finance_prod_711_balance = #{financeProd711Balance},</if>
<if test="financeProd716Balance != null">finance_prod_716_balance = #{financeProd716Balance},</if>
<if test="loanYearDailyaverage != null">loan_year_dailyaverage = #{loanYearDailyaverage},</if>
<if test="htqyRat != null">htqy_rat = #{htqyRat},</if>
<if test="qfcdRat != null">qfcd_rat = #{qfcdRat},</if>
<if test="txRat != null">tx_rat = #{txRat},</if>
<if test="bhRat != null">bh_rat = #{bhRat},</if>
<if test="yxdfgzRat != null">yxdfgz_rat = #{yxdfgzRat},</if>
<if test="dkdfRat != null">dkdf_rat = #{dkdfRat},</if>
<if test="dksfRat != null">dksf_rat = #{dksfRat},</if>
<if test="dkshfRat != null">dkshf_rat = #{dkshfRat},</if>
<if test="pjbRat != null">pjb_rat = #{pjbRat},</if>
<if test="czbRat != null">czb_rat = #{czbRat},</if>
<if test="sfbRat != null">sfb_rat = #{sfbRat},</if>
<if test="mrbRat != null">mrb_rat = #{mrbRat},</if>
<if test="szstRat != null">szst_rat = #{szstRat},</if>
<if test="khRat != null">kh_rat = #{khRat},</if>
<if test="gjjsywRat != null">gjjsyw_rat = #{gjjsywRat},</if>
<if test="yqjshRat != null">yqjsh_rat = #{yqjshRat},</if>
<if test="htqyNum != null">htqy_num = #{htqyNum},</if>
<if test="qfcdNum != null">qfcd_num = #{qfcdNum},</if>
<if test="txNum != null">tx_num = #{txNum},</if>
<if test="bhNum != null">bh_num = #{bhNum},</if>
<if test="yxdfgzNum != null">yxdfgz_num = #{yxdfgzNum},</if>
<if test="ustrCountPerM != null">ustr_count_per_m = #{ustrCountPerM},</if>
<if test="ustrBalM != null">ustr_bal_m = #{ustrBalM},</if>
<if test="dkdfNum != null">dkdf_num = #{dkdfNum},</if>
<if test="dksfNum != null">dksf_num = #{dksfNum},</if>
<if test="dkshfNum != null">dkshf_num = #{dkshfNum},</if>
<if test="pjbNum != null">pjb_num = #{pjbNum},</if>
<if test="czbNum != null">czb_num = #{czbNum},</if>
<if test="sfbNum != null">sfb_num = #{sfbNum},</if>
<if test="mrbNum != null">mrb_num = #{mrbNum},</if>
<if test="szstNum != null">szst_num = #{szstNum},</if>
<if test="khNum != null">kh_num = #{khNum},</if>
<if test="gjjsywNum != null">gjjsyw_num = #{gjjsywNum},</if>
<if test="yqjshNum != null">yqjsh_num = #{yqjshNum},</if>
<if test="opsDept != null">ops_dept = #{opsDept},</if>
</trim>
where dt = #{dt}
</update>
<delete id="deleteGridShapeCountGongsiByDt" parameterType="String">
delete from grid_shape_count_gongsi where dt = #{dt}
</delete>
<delete id="deleteGridShapeCountGongsiByDts" parameterType="String">
delete from grid_shape_count_gongsi where dt in
<foreach item="dt" collection="array" open="(" separator="," close=")">
#{dt}
</foreach>
</delete>
<select id="heatMapList" parameterType="GridShapeHeatMapDTO" resultType="GridShapeCountGongsi">
select ${indexId} as indexValue,
gscg.dt, gscg.shape_type, gscg.shape_id, gscg.shape_name, gscg.grid_id, gscg.grid_name,
concat( gscg.dept_id , '-' , gscg.dept_name ) as dept_id,
gscg.dept_name,
concat( gscg.outlets_id , '-' , gscg.outlets_name ) as outlets_id,
gscg.outlets_name, gscg.user_name,
ds.shape_wkt
from ${tabName} as gscg
left join draw_shape ds on gscg.shape_id = ds.shape_id
where 1=1
<if test="dt != null "> and gscg.dt = #{dt} </if>
<if test="userLevel == 'branch'"> and gscg.dept_id = #{userCode} </if>
<if test="userLevel == 'outlet'"> and gscg.outlets_id = #{userCode} </if>
<if test="userLevel == 'manager'"> and gscg.user_name = #{userCode} </if>
<if test="branchIds != null "> and gscg.dept_id in
<foreach item="branchId" collection="branchIds" open="(" separator="," close=")">
#{branchId}
</foreach>
</if>
<if test="outletIds != null "> and gscg.outlets_id in
<foreach item="outletId" collection="branchIds" open="(" separator="," close=")">
#{outletId}
</foreach>
</if>
<if test="userName != null and userName != '' "> and gscg.user_name like concat('%',#{userName},'%') </if>
<if test="shapeType != null and shapeType != ''"> and gscg.shape_type = #{shapeType} </if>
<if test="shapeIds != null "> and gscg.shape_id in
<foreach item="shapeId" collection="shapeIds" open="(" separator="," close=")">
#{shapeId}
</foreach>
</if>
order by gscg.shape_type, gscg.shape_id, gscg.shape_name desc
</select>
<select id="selectShapeNameList" resultType="GridShapeCountGongsi">
select gscg.shape_id, gscg.shape_name
from ${tabName} as gscg
where 1=1 and shape_type = #{shapeType}
<if test="userLevel == 'branch'"> and gscg.dept_id = #{deptId} </if>
<if test="userLevel == 'outlet'"> and gscg.outlets_id = #{deptId} </if>
<if test="userLevel == 'manager'"> and gscg.user_name = #{userNameCode} </if>
group by gscg.shape_id, gscg.shape_name
order by gscg.shape_id, gscg.shape_name desc
</select>
</mapper>

View File

@@ -0,0 +1,124 @@
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.ibs.grid.mapper.GridUnionCountMapper">
<select id="selectLsCountList" resultType="com.ruoyi.ibs.grid.domain.entity.GridUnionCmpmLingshou">
SELECT dt, dept_type, ops_dept, dept_id, outlets_id, user_name, cust_num, cur_bal_d, cur_bal_t, bal_loan,
cur_bal_5_bad, cur_d_ave, cur_t_ave, loan_ave, ph_rat, sx_rat, yxht_rat, xyk_rat, fshl_rat, sd_rat, etc_rat,
dian_rat, black_rat, bad_rat, bad_bal_rat, ph_num, sx_num, yxht_num, xyk_num, fshl_num, sd_num, etc_num,
dian_num, black_num, bad_num, zf_365cnt, zf_180cnt, zf_90cnt, zf_30cnt, zf_365rt, zf_180rt, zf_90rt, zf_30rt
FROM grid_union_cmpm_lingshou
<where>
dept_type = #{userRole}
<if test=" isBranch == true">
and dept_id = #{deptId}
</if>
<if test=" isOutlet == true">
and outlets_id = #{deptId}
</if>
<if test=" isManager == true">
and user_name = #{userName}
</if>
</where>
</select>
<select id="selectGsCountList" resultType="com.ruoyi.ibs.grid.domain.entity.GridUnionCmpmGongsi">
SELECT dt, dept_type, ops_dept, dept_id, outlets_id, user_name, cust_num, hq_cur_balance, bz_cur_balance,
loan_balance_cny, finance_prod_711_balance, finance_prod_716_balance, loan_year_dailyaverage, htqy_rat,
qfcd_rat, tx_rat, bh_rat, yxdfgz_rat, dkdf_rat, dksf_rat, dkshf_rat, pjb_rat, czb_rat, sfb_rat, mrb_rat,
szst_rat, kh_rat, gjjsyw_rat, yqjsh_rat, htqy_num, qfcd_num, tx_num, bh_num, yxdfgz_num, ustr_count_per_m,
ustr_bal_m, dkdf_num, dksf_num, dkshf_num, pjb_num, czb_num, sfb_num, mrb_num, szst_num, kh_num, gjjsyw_num,
yqjsh_num, zf_365cnt, zf_180cnt, zf_90cnt, zf_30cnt, zf_365rt, zf_180rt, zf_90rt, zf_30rt
FROM grid_union_cmpm_gongsi
<where>
dept_type = #{userRole}
<if test=" isBranch == true">
and dept_id = #{deptId}
</if>
<if test=" isOutlet == true">
and outlets_id = #{deptId}
</if>
<if test=" isManager == true">
and user_name = #{userName}
</if>
</where>
</select>
<select id="selectLsCustList" resultType="com.ruoyi.ibs.grid.domain.entity.GridUnionCustLingshou">
SELECT ops_dept, dept_id, dept_name, outlets_id, outlets_name, user_name, cust_name, cust_idc, cust_isn,
cur_bal_d, cur_bal_t, bal_loan, cur_bal_5_bad, cur_d_ave, cur_t_ave, loan_ave, is_ph, is_sx, is_yxht, is_xyk,
fshl, is_sd, etc, dian, is_black, is_bad, is_365zf, is_180zf, is_90zf, is_30zf,cust_type
FROM grid_union_cust_lingshou
<where>
<if test=" dt != null and dt != ''">and dt = #{dt}</if>
<if test=" isBranch == true">and dept_id like concat('%',concat(#{deptId},'%'))</if>
<if test=" isOutlet == true">and outlets_id like concat('%',concat(#{deptId},'%'))</if>
<if test=" isManager == true">and user_name like concat('%',concat(#{userName},'%'))</if>
<if test=" custName != null and custName != ''">and cust_name like concat('%',concat(#{custName},'%'))</if>
<if test=" custIdc != null and custIdc != ''">and cust_idc like
concat('%',concat(#{custIdc},'%'))
</if>
</where>
</select>
<select id="selectGsCustList" resultType="com.ruoyi.ibs.grid.domain.entity.GridUnionCustGongsi">
SELECT ops_dept, dept_id, dept_name, outlets_id, outlets_name, user_name, cust_name, social_credit_code,
cust_isn, hq_cur_balance, bz_cur_balance, is_credit, loan_balance_cny, loan_year_dailyaverage, is_htqy,
finance_prod_716_open_flag, finance_prod_716_balance, finance_prod_711_open_flag, finance_prod_711_balance,
intl_bussiness_jcbh_open_flag, is_ustr, ustr_count_per_m, ustr_bal_m, eleccharge_sign_flag,
watercharge_sign_flag, taxdeduction_sign_flag, pjb, czb, sfb, mrb, szst, is_open_sts, intl_bussiness_open_flag,
intl_bussiness_325_open_flag, is_365zf, is_180zf, is_90zf, is_30zf,cust_type
FROM grid_union_cust_gongsi
<where>
<if test=" dt != null and dt != ''">and dt = #{dt}</if>
<if test=" isBranch == true">and dept_id like concat('%',concat(#{deptId},'%'))</if>
<if test=" isOutlet == true">and outlets_id like concat('%',concat(#{deptId},'%'))</if>
<if test=" isManager == true">and user_name like concat('%',concat(#{userName},'%'))</if>
<if test=" custName != null and custName != ''">and cust_name like concat('%',concat(#{custName},'%'))</if>
<if test=" socialCreditCode != null and socialCreditCode != ''">and social_credit_code like
concat('%',concat(#{socialCreditCode},'%'))
</if>
</where>
</select>
<select id="selectLsCustListLimit" resultType="com.ruoyi.ibs.grid.domain.entity.GridUnionCustLingshou">
SELECT ops_dept, dept_id, dept_name, outlets_id, outlets_name, user_name, cust_name, cust_idc, cust_isn,
cur_bal_d, cur_bal_t, bal_loan, cur_bal_5_bad, cur_d_ave, cur_t_ave, loan_ave, is_ph, is_sx, is_yxht, is_xyk,
fshl, is_sd, etc, dian, is_black, is_bad, is_365zf, is_180zf, is_90zf, is_30zf,cust_type
FROM grid_union_cust_lingshou
<where>
<if test=" dt != null and dt != ''">and dt = #{dt}</if>
<if test=" isBranch == true">and dept_id like concat('%',concat(#{deptId},'%'))</if>
<if test=" isOutlet == true">and outlets_id like concat('%',concat(#{deptId},'%'))</if>
<if test=" isManager == true">and user_name like concat('%',concat(#{userName},'%'))</if>
<if test=" custName != null and custName != ''">and cust_name like concat('%',concat(#{custName},'%'))</if>
<if test=" custIdc != null and custIdc != ''">and cust_idc like
concat('%',concat(#{custIdc},'%'))
</if>
</where>
limit 1000
</select>
<select id="selectGsCustListLimit" resultType="com.ruoyi.ibs.grid.domain.entity.GridUnionCustGongsi">
SELECT ops_dept, dept_id, dept_name, outlets_id, outlets_name, user_name, cust_name, social_credit_code,
cust_isn, hq_cur_balance, bz_cur_balance, is_credit, loan_balance_cny, loan_year_dailyaverage, is_htqy,
finance_prod_716_open_flag, finance_prod_716_balance, finance_prod_711_open_flag, finance_prod_711_balance,
intl_bussiness_jcbh_open_flag, is_ustr, ustr_count_per_m, ustr_bal_m, eleccharge_sign_flag,
watercharge_sign_flag, taxdeduction_sign_flag, pjb, czb, sfb, mrb, szst, is_open_sts, intl_bussiness_open_flag,
intl_bussiness_325_open_flag, is_365zf, is_180zf, is_90zf, is_30zf,cust_type
FROM grid_union_cust_gongsi
<where>
<if test=" dt != null and dt != ''">and dt = #{dt}</if>
<if test=" isBranch == true">and dept_id like concat('%',concat(#{deptId},'%'))</if>
<if test=" isOutlet == true">and outlets_id like concat('%',concat(#{deptId},'%'))</if>
<if test=" isManager == true">and user_name like concat('%',concat(#{userName},'%'))</if>
<if test=" custName != null and custName != ''">and cust_name like concat('%',concat(#{custName},'%'))</if>
<if test=" socialCreditCode != null and socialCreditCode != ''">and social_credit_code like
concat('%',concat(#{socialCreditCode},'%'))
</if>
</where>
limit 1000
</select>
</mapper>

View File

@@ -0,0 +1,24 @@
<?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.grid.mapper.GridUserMapper">
<resultMap type="GridUserVo" id="GridUserVo">
<result property="userId" column="user_id"/>
<result property="userName" column="user_name"/>
<result property="nickName" column="nick_name"/>
<result property="deptId" column="dept_id"/>
<result property="deptName" column="dept_name"/>
<result property="deptType" column="dept_type"/>
</resultMap>
<select id="selectGridUser" resultMap="GridUserVo">
select u.user_id, u.dept_id, u.user_name, u.nick_name,d.dept_name, d.dept_type from sys_user u
left join sys_dept d on u.dept_id = d.dept_id
where u.del_flag = '0'
AND u.dept_id IN
<foreach collection="deptIds" item="id" index="index" open="(" separator="," close=")">
#{id}
</foreach>
ORDER BY u.dept_id
</select>
</mapper>

View File

@@ -0,0 +1,429 @@
<?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.grid.mapper.GridVirtualCountMapper">
<resultMap type="GridVirtualCountLingshou" id="GridVirtualCountLingshouResult">
<result property="dt" column="dt" />
<result property="gridId" column="grid_id" />
<result property="gridName" column="grid_name" />
<result property="gridType" column="grid_type" />
<result property="createBy" column="create_by" />
<result property="deptType" column="dept_type" />
<result property="deptId" column="dept_id" />
<result property="deptName" column="dept_name" />
<result property="outletsId" column="outlets_id" />
<result property="outletsName" column="outlets_name" />
<result property="userName" column="user_name" />
<result property="custNum" column="cust_num" />
<result property="curBalD" column="cur_bal_d" />
<result property="curBalT" column="cur_bal_t" />
<result property="balLoan" column="bal_loan" />
<result property="curBal5Bad" column="cur_bal_5_bad" />
<result property="curDAve" column="cur_d_ave" />
<result property="curTAve" column="cur_t_ave" />
<result property="loanAve" column="loan_ave" />
<result property="phRat" column="ph_rat" />
<result property="sxRat" column="sx_rat" />
<result property="yxhtRat" column="yxht_rat" />
<result property="xykRat" column="xyk_rat" />
<result property="fshlRat" column="fshl_rat" />
<result property="sdRat" column="sd_rat" />
<result property="etcRat" column="etc_rat" />
<result property="dianRat" column="dian_rat" />
<result property="blackRat" column="black_rat" />
<result property="badRat" column="bad_rat" />
<result property="badBalRat" column="bad_bal_rat" />
<result property="phNum" column="ph_num" />
<result property="sxNum" column="sx_num" />
<result property="yxhtNum" column="yxht_num" />
<result property="xykNum" column="xyk_num" />
<result property="fshlNum" column="fshl_num" />
<result property="sdNum" column="sd_num" />
<result property="etcNum" column="etc_num" />
<result property="dianNum" column="dian_num" />
<result property="blackNum" column="black_num" />
<result property="badNum" column="bad_num" />
<result property="opsDept" column="ops_dept" />
</resultMap>
<resultMap type="GridVirtualCountGongsi" id="GridVirtualCountGongsiResult">
<result property="dt" column="dt" />
<result property="gridId" column="grid_id" />
<result property="gridName" column="grid_name" />
<result property="gridType" column="grid_type" />
<result property="createBy" column="create_by" />
<result property="deptType" column="dept_type" />
<result property="deptId" column="dept_id" />
<result property="deptName" column="dept_name" />
<result property="outletsId" column="outlets_id" />
<result property="outletsName" column="outlets_name" />
<result property="userName" column="user_name" />
<result property="custNum" column="cust_num" />
<result property="hqCurBalance" column="hq_cur_balance" />
<result property="bzCurBalance" column="bz_cur_balance" />
<result property="loanBalanceCny" column="loan_balance_cny" />
<result property="financeProd711Balance" column="finance_prod_711_balance" />
<result property="financeProd716Balance" column="finance_prod_716_balance" />
<result property="loanYearDailyaverage" column="loan_year_dailyaverage" />
<result property="htqyRat" column="htqy_rat" />
<result property="qfcdRat" column="qfcd_rat" />
<result property="txRat" column="tx_rat" />
<result property="bhRat" column="bh_rat" />
<result property="yxdfgzRat" column="yxdfgz_rat" />
<result property="dkdfRat" column="dkdf_rat" />
<result property="dksfRat" column="dksf_rat" />
<result property="dkshfRat" column="dkshf_rat" />
<result property="pjbRat" column="pjb_rat" />
<result property="czbRat" column="czb_rat" />
<result property="sfbRat" column="sfb_rat" />
<result property="mrbRat" column="mrb_rat" />
<result property="szstRat" column="szst_rat" />
<result property="khRat" column="kh_rat" />
<result property="gjjsywRat" column="gjjsyw_rat" />
<result property="yqjshRat" column="yqjsh_rat" />
<result property="htqyNum" column="htqy_num" />
<result property="qfcdNum" column="qfcd_num" />
<result property="txNum" column="tx_num" />
<result property="bhNum" column="bh_num" />
<result property="yxdfgzNum" column="yxdfgz_num" />
<result property="ustrCountPerM" column="ustr_count_per_m" />
<result property="ustrBalM" column="ustr_bal_m" />
<result property="dkdfNum" column="dkdf_num" />
<result property="dksfNum" column="dksf_num" />
<result property="dkshfNum" column="dkshf_num" />
<result property="pjbNum" column="pjb_num" />
<result property="czbNum" column="czb_num" />
<result property="sfbNum" column="sfb_num" />
<result property="mrbNum" column="mrb_num" />
<result property="szstNum" column="szst_num" />
<result property="khNum" column="kh_num" />
<result property="gjjsywNum" column="gjjsyw_num" />
<result property="yqjshNum" column="yqjsh_num" />
<result property="opsDept" column="ops_dept" />
</resultMap>
<resultMap type="GridVirtualCustGongsi" id="GridVirtualCustGongsiResult">
<result property="custName" column="cust_name" />
<result property="socialCreditCode" column="social_credit_code" />
<result property="custIsn" column="cust_isn" />
<result property="hqCurBalance" column="hq_cur_balance" />
<result property="bzCurBalance" column="bz_cur_balance" />
<result property="isCredit" column="is_credit" />
<result property="loanBalanceCny" column="loan_balance_cny" />
<result property="loanYearDailyaverage" column="loan_year_dailyaverage" />
<result property="isHtqy" column="is_htqy" />
<result property="financeProd716OpenFlag" column="finance_prod_716_open_flag" />
<result property="financeProd716Balance" column="finance_prod_716_balance" />
<result property="financeProd711OpenFlag" column="finance_prod_711_open_flag" />
<result property="financeProd711Balance" column="finance_prod_711_balance" />
<result property="intlBussinessJcbhOpenFlag" column="intl_bussiness_jcbh_open_flag" />
<result property="isUstr" column="is_ustr" />
<result property="ustrCountPerM" column="ustr_count_per_m" />
<result property="ustrBalM" column="ustr_bal_m" />
<result property="elecchargeSignFlag" column="eleccharge_sign_flag" />
<result property="waterchargeSignFlag" column="watercharge_sign_flag" />
<result property="taxdeductionSignFlag" column="taxdeduction_sign_flag" />
<result property="pjb" column="pjb" />
<result property="czb" column="czb" />
<result property="sfb" column="sfb" />
<result property="mrb" column="mrb" />
<result property="szst" column="szst" />
<result property="isOpenSts" column="is_open_sts" />
<result property="intlBussinessOpenFlag" column="intl_bussiness_open_flag" />
<result property="intlBussiness325OpenFlag" column="intl_bussiness_325_open_flag" />
<result property="opsDept" column="ops_dept" />
<result property="custType" column="cust_type" />
<result property="gridId" column="grid_id" />
<result property="gridName" column="grid_name" />
<result property="gridType" column="grid_type" />
<result property="deptType" column="dept_type" />
<result property="deptId" column="dept_id" />
<result property="deptName" column="dept_name" />
<result property="outletsId" column="outlets_id" />
<result property="outletsName" column="outlets_name" />
<result property="userName" column="user_name" />
</resultMap>
<resultMap type="GridVirtualCustLingshou" id="GridVirtualCustLingshouResult">
<result property="custName" column="cust_name" />
<result property="custIdc" column="cust_idc" />
<result property="custIsn" column="cust_isn" />
<result property="curBalD" column="cur_bal_d" />
<result property="curBalT" column="cur_bal_t" />
<result property="balLoan" column="bal_loan" />
<result property="curBal5Bad" column="cur_bal_5_bad" />
<result property="curDAve" column="cur_d_ave" />
<result property="curTAve" column="cur_t_ave" />
<result property="loanAve" column="loan_ave" />
<result property="isPh" column="is_ph" />
<result property="isSx" column="is_sx" />
<result property="isYxht" column="is_yxht" />
<result property="isXyk" column="is_xyk" />
<result property="fshl" column="fshl" />
<result property="isSd" column="is_sd" />
<result property="etc" column="etc" />
<result property="dian" column="dian" />
<result property="isBlack" column="is_black" />
<result property="isBad" column="is_bad" />
<result property="opsDept" column="ops_dept" />
<result property="custType" column="cust_type" />
<result property="gridId" column="grid_id" />
<result property="gridName" column="grid_name" />
<result property="gridType" column="grid_type" />
<result property="deptType" column="dept_type" />
<result property="deptId" column="dept_id" />
<result property="deptName" column="dept_name" />
<result property="outletsId" column="outlets_id" />
<result property="outletsName" column="outlets_name" />
<result property="userName" column="user_name" />
</resultMap>
<sql id="selectGridVirtualCountLingshouVo">
select dt, grid_name, grid_type, create_by, dept_id, dept_name, outlets_id, outlets_name, user_name, cust_num, cur_bal_d, cur_bal_t, bal_loan, cur_bal_5_bad, cur_d_ave, cur_t_ave, loan_ave, ph_rat, sx_rat, yxht_rat, xyk_rat, fshl_rat, sd_rat, etc_rat, dian_rat, black_rat, bad_rat, bad_bal_rat, ph_num, sx_num, yxht_num, xyk_num, fshl_num, sd_num, etc_num, dian_num, black_num, bad_num, ops_dept from grid_virtual_count_lingshou
</sql>
<select id="selectGridVirtualCountLingshouList" resultMap="GridVirtualCountLingshouResult">
SELECT ls.dt, ls.grid_id, ls.grid_name, ls.dept_type, ls.dept_id, ls.dept_name, ls.outlets_id, ls.outlets_name, ls.user_name, ls.cust_num, ls.cur_bal_d, ls.cur_bal_t, ls.bal_loan, ls.cur_bal_5_bad, ls.cur_d_ave, ls.cur_t_ave, ls.loan_ave, ls.ph_rat, ls.sx_rat, ls.yxht_rat, ls.xyk_rat, ls.fshl_rat, ls.sd_rat, ls.etc_rat, ls.dian_rat, ls.black_rat, ls.bad_rat, ls.bad_bal_rat, ls.ph_num, ls.sx_num, ls.yxht_num, ls.xyk_num, ls.fshl_num, ls.sd_num, ls.etc_num, ls.dian_num, ls.black_num, ls.bad_num, ls.ops_dept
,concat(su.nick_name,'-',ls.create_by) as create_by,
CASE
WHEN ls.grid_type = 1 THEN '菜场'
WHEN ls.grid_type = 2 THEN '政府单位'
WHEN ls.grid_type = 3 THEN '事业单位'
WHEN ls.grid_type = 4 THEN '社区'
WHEN ls.grid_type = 5 THEN '商圈'
WHEN ls.grid_type = 6 THEN '企业'
WHEN ls.grid_type = 7 THEN '市场园区'
WHEN ls.grid_type = 8 THEN '教育'
WHEN ls.grid_type = 9 THEN '其他'
ELSE ls.grid_type
END AS grid_type,
ls.zf_365cnt, ls.zf_180cnt, ls.zf_90cnt, ls.zf_30cnt, ls.zf_365rt, ls.zf_180rt, ls.zf_90rt, ls.zf_30rt
FROM grid_virtual_count_lingshou ls
left join sys_user su on ls.create_by = su.user_name
<where>
<if test=" dt != null and dt != ''">and ls.dt = #{dt}</if>
<if test=" gridName != null and gridName != ''">and ls.grid_name like concat('%',concat(#{gridName},'%'))</if>
<if test=" gridType != null and gridType != ''">and ls.grid_type like concat('%',concat(#{gridType},'%'))</if>
<if test=" isHead == true">and ls.dept_type = 'grid'</if>
<if test=" isBranch == true">and ls.dept_id like concat('%',concat(#{deptId},'%')) and dept_type = 'branch'</if>
<if test=" isOutlet == true">and ls.outlets_id like concat('%',concat(#{deptId},'%')) and dept_type = 'outlet'</if>
<if test=" isManager == true">and ls.user_name like concat('%',concat(#{userName},'%')) and dept_type = 'manager'</if>
</where>
</select>
<select id="selectGridVirtualCountGongsiList" resultMap="GridVirtualCountGongsiResult">
SELECT gs.dt, gs.grid_id, gs.grid_name, gs.dept_type, gs.dept_id, gs.dept_name, gs.outlets_id, gs.outlets_name, gs.user_name, gs.cust_num, gs.hq_cur_balance, gs.bz_cur_balance, gs.loan_balance_cny, gs.finance_prod_711_balance, gs.finance_prod_716_balance, gs.loan_year_dailyaverage, gs.htqy_rat, gs.qfcd_rat, gs.tx_rat, gs.bh_rat, gs.yxdfgz_rat, gs.dkdf_rat, gs.dksf_rat, gs.dkshf_rat, gs.pjb_rat, gs.czb_rat, gs.sfb_rat, gs.mrb_rat, gs.szst_rat, gs.kh_rat, gs.gjjsyw_rat, gs.yqjsh_rat, gs.htqy_num, gs.qfcd_num, gs.tx_num, gs.bh_num, gs.yxdfgz_num, gs.ustr_count_per_m, gs.ustr_bal_m, gs.dkdf_num, gs.dksf_num, gs.dkshf_num, gs.pjb_num, gs.czb_num, gs.sfb_num, gs.mrb_num, gs.szst_num, gs.kh_num, gs.gjjsyw_num, gs.yqjsh_num, gs.ops_dept
,concat(su.nick_name,'-',gs.create_by) as create_by,
CASE
WHEN gs.grid_type = 1 THEN '菜场'
WHEN gs.grid_type = 2 THEN '政府单位'
WHEN gs.grid_type = 3 THEN '事业单位'
WHEN gs.grid_type = 4 THEN '社区'
WHEN gs.grid_type = 5 THEN '商圈'
WHEN gs.grid_type = 6 THEN '企业'
WHEN gs.grid_type = 7 THEN '市场园区'
WHEN gs.grid_type = 8 THEN '教育'
WHEN gs.grid_type = 9 THEN '其他'
ELSE gs.grid_type
END AS grid_type,
gs.zf_365cnt, gs.zf_180cnt, gs.zf_90cnt, gs.zf_30cnt, gs.zf_365rt, gs.zf_180rt, gs.zf_90rt, gs.zf_30rt
FROM grid_virtual_count_gongsi gs
left join sys_user su on gs.create_by = su.user_name
<where>
<if test=" dt != null and dt != ''">and gs.dt = #{dt}</if>
<if test=" gridName != null and gridName != ''">and gs.grid_name like concat('%',concat(#{gridName},'%'))</if>
<if test=" gridType != null and gridType != ''">and gs.grid_type like concat('%',concat(#{gridType},'%'))</if>
<if test=" isHead == true">and gs.dept_type = 'grid'</if>
<if test=" isBranch == true">and gs.dept_id like concat('%',concat(#{deptId},'%')) and dept_type = 'branch'</if>
<if test=" isOutlet == true">and gs.outlets_id like concat('%',concat(#{deptId},'%')) and dept_type = 'outlet'</if>
<if test=" isManager == true">and gs.user_name like concat('%',concat(#{userName},'%')) and dept_type = 'manager'</if>
</where>
</select>
<select id="selectGridVirtualCountgsCustList" resultMap="GridVirtualCustGongsiResult">
select cust_name, social_credit_code, cust_isn, hq_cur_balance, bz_cur_balance, is_credit, loan_balance_cny, loan_year_dailyaverage, is_htqy, finance_prod_716_open_flag, finance_prod_716_balance, finance_prod_711_open_flag, finance_prod_711_balance, intl_bussiness_jcbh_open_flag, is_ustr, ustr_count_per_m, ustr_bal_m, eleccharge_sign_flag, watercharge_sign_flag, taxdeduction_sign_flag, pjb, czb, sfb, mrb, szst, is_open_sts, intl_bussiness_open_flag, intl_bussiness_325_open_flag, ops_dept, cust_type, grid_id, grid_name, grid_type, dept_type, dept_id, dept_name, outlets_id, outlets_name, user_name,
is_365zf, is_180zf, is_90zf, is_30zf
from grid_virtual_cust_gongsi
<where>
<if test=" dt != null and dt != ''">and dt = #{dt}</if>
<if test=" gridId != null and gridId != ''">and FIND_IN_SET(#{gridId}, grid_id) > 0</if>
<if test=" custName != null and custName != ''">and cust_name like concat('%',concat(#{custName},'%'))</if>
<if test=" socialCreditCode != null and socialCreditCode != ''">and social_credit_code like concat('%',#{socialCreditCode},'%')</if>
<if test=" isBranch == true">and dept_id like concat('%',concat(#{deptId},'%'))</if>
<if test=" isOutlet == true">and outlets_id like concat('%',concat(#{deptId},'%'))</if>
<if test=" isManager == true">and user_name like concat('%',concat(#{userName},'%'))</if>
</where>
</select>
<select id="selectGridVirtualCountlsCustList" resultMap="GridVirtualCustLingshouResult">
select cust_name, cust_idc, cust_isn, cur_bal_d, cur_bal_t, bal_loan, cur_bal_5_bad, cur_d_ave, cur_t_ave, loan_ave, is_ph, is_sx, is_yxht, is_xyk, fshl, is_sd, etc, dian, is_black, is_bad, ops_dept, cust_type, grid_id, grid_name, grid_type, dept_type, dept_id, dept_name, outlets_id, outlets_name, user_name,
is_365zf, is_180zf, is_90zf, is_30zf
from grid_virtual_cust_lingshou
<where>
<if test=" dt != null and dt != ''">and dt = #{dt}</if>
<if test=" gridId != null and gridId != ''">and FIND_IN_SET(#{gridId}, grid_id) > 0</if>
<if test=" custName != null and custName != ''">and cust_name like concat('%',concat(#{custName},'%'))</if>
<if test=" custIdc != null and custIdc != ''">and cust_idc like concat('%',#{custIdc},'%')</if>
<if test=" isBranch == true">and dept_id like concat('%',concat(#{deptId},'%'))</if>
<if test=" isOutlet == true">and outlets_id like concat('%',concat(#{deptId},'%'))</if>
<if test=" isManager == true">and user_name like concat('%',concat(#{userName},'%'))</if>
</where>
</select>
<select id="selectGridVirtualCountLingshouByDt" parameterType="String" resultMap="GridVirtualCountLingshouResult">
<include refid="selectGridVirtualCountLingshouVo"/>
where dt = #{dt}
</select>
<insert id="insertGridVirtualCountLingshou" parameterType="GridVirtualCountLingshou">
insert into grid_virtual_count_lingshou
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="dt != null">dt,</if>
<if test="gridName != null">grid_name,</if>
<if test="gridType != null">grid_type,</if>
<if test="createBy != null">create_by,</if>
<if test="deptId != null">dept_id,</if>
<if test="deptName != null">dept_name,</if>
<if test="outletsId != null">outlets_id,</if>
<if test="outletsName != null">outlets_name,</if>
<if test="userName != null">user_name,</if>
<if test="custNum != null">cust_num,</if>
<if test="curBalD != null">cur_bal_d,</if>
<if test="curBalT != null">cur_bal_t,</if>
<if test="balLoan != null">bal_loan,</if>
<if test="curBal5Bad != null">cur_bal_5_bad,</if>
<if test="curDAve != null">cur_d_ave,</if>
<if test="curTAve != null">cur_t_ave,</if>
<if test="loanAve != null">loan_ave,</if>
<if test="phRat != null">ph_rat,</if>
<if test="sxRat != null">sx_rat,</if>
<if test="yxhtRat != null">yxht_rat,</if>
<if test="xykRat != null">xyk_rat,</if>
<if test="fshlRat != null">fshl_rat,</if>
<if test="sdRat != null">sd_rat,</if>
<if test="etcRat != null">etc_rat,</if>
<if test="dianRat != null">dian_rat,</if>
<if test="blackRat != null">black_rat,</if>
<if test="badRat != null">bad_rat,</if>
<if test="badBalRat != null">bad_bal_rat,</if>
<if test="phNum != null">ph_num,</if>
<if test="sxNum != null">sx_num,</if>
<if test="yxhtNum != null">yxht_num,</if>
<if test="xykNum != null">xyk_num,</if>
<if test="fshlNum != null">fshl_num,</if>
<if test="sdNum != null">sd_num,</if>
<if test="etcNum != null">etc_num,</if>
<if test="dianNum != null">dian_num,</if>
<if test="blackNum != null">black_num,</if>
<if test="badNum != null">bad_num,</if>
<if test="opsDept != null">ops_dept,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="dt != null">#{dt},</if>
<if test="gridName != null">#{gridName},</if>
<if test="gridType != null">#{gridType},</if>
<if test="createBy != null">#{createBy},</if>
<if test="deptId != null">#{deptId},</if>
<if test="deptName != null">#{deptName},</if>
<if test="outletsId != null">#{outletsId},</if>
<if test="outletsName != null">#{outletsName},</if>
<if test="userName != null">#{userName},</if>
<if test="custNum != null">#{custNum},</if>
<if test="curBalD != null">#{curBalD},</if>
<if test="curBalT != null">#{curBalT},</if>
<if test="balLoan != null">#{balLoan},</if>
<if test="curBal5Bad != null">#{curBal5Bad},</if>
<if test="curDAve != null">#{curDAve},</if>
<if test="curTAve != null">#{curTAve},</if>
<if test="loanAve != null">#{loanAve},</if>
<if test="phRat != null">#{phRat},</if>
<if test="sxRat != null">#{sxRat},</if>
<if test="yxhtRat != null">#{yxhtRat},</if>
<if test="xykRat != null">#{xykRat},</if>
<if test="fshlRat != null">#{fshlRat},</if>
<if test="sdRat != null">#{sdRat},</if>
<if test="etcRat != null">#{etcRat},</if>
<if test="dianRat != null">#{dianRat},</if>
<if test="blackRat != null">#{blackRat},</if>
<if test="badRat != null">#{badRat},</if>
<if test="badBalRat != null">#{badBalRat},</if>
<if test="phNum != null">#{phNum},</if>
<if test="sxNum != null">#{sxNum},</if>
<if test="yxhtNum != null">#{yxhtNum},</if>
<if test="xykNum != null">#{xykNum},</if>
<if test="fshlNum != null">#{fshlNum},</if>
<if test="sdNum != null">#{sdNum},</if>
<if test="etcNum != null">#{etcNum},</if>
<if test="dianNum != null">#{dianNum},</if>
<if test="blackNum != null">#{blackNum},</if>
<if test="badNum != null">#{badNum},</if>
<if test="opsDept != null">#{opsDept},</if>
</trim>
</insert>
<update id="updateGridVirtualCountLingshou" parameterType="GridVirtualCountLingshou">
update grid_virtual_count_lingshou
<trim prefix="SET" suffixOverrides=",">
<if test="gridName != null">grid_name = #{gridName},</if>
<if test="gridType != null">grid_type = #{gridType},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="deptId != null">dept_id = #{deptId},</if>
<if test="deptName != null">dept_name = #{deptName},</if>
<if test="outletsId != null">outlets_id = #{outletsId},</if>
<if test="outletsName != null">outlets_name = #{outletsName},</if>
<if test="userName != null">user_name = #{userName},</if>
<if test="custNum != null">cust_num = #{custNum},</if>
<if test="curBalD != null">cur_bal_d = #{curBalD},</if>
<if test="curBalT != null">cur_bal_t = #{curBalT},</if>
<if test="balLoan != null">bal_loan = #{balLoan},</if>
<if test="curBal5Bad != null">cur_bal_5_bad = #{curBal5Bad},</if>
<if test="curDAve != null">cur_d_ave = #{curDAve},</if>
<if test="curTAve != null">cur_t_ave = #{curTAve},</if>
<if test="loanAve != null">loan_ave = #{loanAve},</if>
<if test="phRat != null">ph_rat = #{phRat},</if>
<if test="sxRat != null">sx_rat = #{sxRat},</if>
<if test="yxhtRat != null">yxht_rat = #{yxhtRat},</if>
<if test="xykRat != null">xyk_rat = #{xykRat},</if>
<if test="fshlRat != null">fshl_rat = #{fshlRat},</if>
<if test="sdRat != null">sd_rat = #{sdRat},</if>
<if test="etcRat != null">etc_rat = #{etcRat},</if>
<if test="dianRat != null">dian_rat = #{dianRat},</if>
<if test="blackRat != null">black_rat = #{blackRat},</if>
<if test="badRat != null">bad_rat = #{badRat},</if>
<if test="badBalRat != null">bad_bal_rat = #{badBalRat},</if>
<if test="phNum != null">ph_num = #{phNum},</if>
<if test="sxNum != null">sx_num = #{sxNum},</if>
<if test="yxhtNum != null">yxht_num = #{yxhtNum},</if>
<if test="xykNum != null">xyk_num = #{xykNum},</if>
<if test="fshlNum != null">fshl_num = #{fshlNum},</if>
<if test="sdNum != null">sd_num = #{sdNum},</if>
<if test="etcNum != null">etc_num = #{etcNum},</if>
<if test="dianNum != null">dian_num = #{dianNum},</if>
<if test="blackNum != null">black_num = #{blackNum},</if>
<if test="badNum != null">bad_num = #{badNum},</if>
<if test="opsDept != null">ops_dept = #{opsDept},</if>
</trim>
where dt = #{dt}
</update>
<delete id="deleteGridVirtualCountLingshouByDt" parameterType="String">
delete from grid_virtual_count_lingshou where dt = #{dt}
</delete>
<delete id="deleteGridVirtualCountLingshouByDts" parameterType="String">
delete from grid_virtual_count_lingshou where dt in
<foreach item="dt" collection="array" open="(" separator="," close=")">
#{dt}
</foreach>
</delete>
</mapper>

View File

@@ -0,0 +1,84 @@
<?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.grid.mapper.VirtualCustMapper">
<resultMap type="VirtualCust" id="GridVirtualCustResult">
<result property="id" column="id" />
<result property="gridId" column="grid_id" />
<result property="custType" column="cust_type" />
<result property="custId" column="cust_id" />
<result property="custIdType" column="cust_id_type" />
<result property="custIdn" column="cust_idn" />
<result property="custIsn" column="cust_isn" />
<result property="custName" column="cust_name" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="deleteFlag" column="delete_flag" />
</resultMap>
<sql id="selectGridVirtualCustVo">
select id, grid_id, cust_type, cust_id, cust_id_type, cust_idn, cust_isn, cust_name, create_by, create_time, update_by, update_time, delete_flag from grid_virtual_cust
</sql>
<select id="getCustNumByGridId" resultType="java.lang.Long">
select count(distinct a.cust_id)
from grid_virtual_cust a
where a.grid_id = #{gridId}
and a.cust_type = #{custType}
</select>
<select id="getCustNumByGridIdAndDept" resultType="java.lang.Long">
select COUNT(distinct a.cust_id)
from grid_virtual_cust_user a
left join (select * from grid_virtual_cust where delete_flag = '0') b on a.cust_id = b.cust_id and a.grid_id =
b.grid_id
where a.relate_dept_id in (select dept_id from sys_dept where dept_id = #{deptId} or find_in_set(#{deptId},
ancestors))
and a.grid_id = #{gridId}
and b.cust_type = #{custType}
and not exists(select 1 from grid_virtual_cust_user_unbind c
where c.grid_id = a.grid_id
and a.cust_id = c.cust_id
and c.user_name = a.user_name
and c.delete_flag = '0');
</select>
<select id="getCustNumByVitualDeptId" resultType="java.lang.Long">
select count(distinct a.cust_id) from grid_virtual_cust a
inner join grid_virtual_cust_user b
on a.grid_id =b.grid_id
where (b.relate_dept_id in
(select dept_id from sys_dept where dept_id = #{headDeptId} or find_in_set(#{headDeptId},ancestors)) or b.user_name = #{headDeptId})
and a.cust_type = #{custType} and a.delete_flag = '0'
</select>
<select id="getCustNumByDeptId" resultType="java.lang.Long">
select count(distinct a.cust_id) from grid_virtual_cust a
inner join grid_virtual_cust_user b on a.grid_id =b.grid_id
left join grid_virtual_grid c on a.grid_id = c.grid_id
where (b.relate_dept_id in (select dept_id from sys_dept where dept_id = #{deptId} or
find_in_set(#{deptId},ancestors)) or b.user_name = #{deptId})
and a.cust_type = #{custType} and a.delete_flag = '0' and c.delete_flag = '0'
<if test="opsDept != null and opsDept != ''">and c.ops_dept = #{opsDept}</if>
</select>
<select id="getVirtualCustNumByUserName" resultType="Long">
select count(distinct a.cust_id)
from grid_virtual_cust_user a
left join grid_virtual_cust b on a.cust_id = b.cust_id
where b.delete_flag = '0'
and b.cust_type = #{custType}
and a.user_name = #{userName}
and not exists(select 1
from grid_virtual_cust_user_unbind c
where c.grid_id = a.grid_id
and c.cust_id = a.cust_id
and c.user_name = a.user_name
and c.delete_flag = "0")
</select>
</mapper>

View File

@@ -0,0 +1,198 @@
<?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.grid.mapper.VirtualCustUserMapper">
<resultMap type="VirtualCustUser" id="GridVirtualCustUserResult">
<result property="id" column="id" />
<result property="gridId" column="grid_id" />
<result property="custId" column="cust_id" />
<result property="userName" column="user_name" />
<result property="nickName" column="nick_name" />
<result property="relateDeptId" column="relate_dept_id" />
<result property="relateDeptName" column="relate_dept_name" />
<result property="relateFlag" column="relate_flag" />
</resultMap>
<resultMap type="CustManageInfo" id="CustManageInfoResult">
<result property="custId" column="cust_id" />
<result property="custName" column="cust_name" />
<result property="custNo" column="cust_idn" />
<result property="belongUserId" column="user_name" />
<result property="belongUserName" column="nick_name" />
<result property="custPattern" column="cust_type" />
<result property="virtualGridName" column="grid_name" />
<result property="virtualGridDutyType" column="grid_duty_type" />
<result property="createRole" column="dept_type" />
<result property="belongBranchName" column="branch_name" />
<result property="belongOutletName" column="outlet_name" />
</resultMap>
<resultMap id="VirtualGridCustVO" type="VirtualGridCustVO">
<result property="gridId" column="grid_id"/>
<result property="gridName" column="grid_name"/>
<result property="createDeptName" column="create_dept_name"/>
<result property="gridDutyType" column="grid_duty_type"/>
<result property="custId" column="cust_id"/>
<result property="custIdn" column="cust_idn"/>
<result property="custName" column="cust_name"/>
<result property="custType" column="cust_type"/>
<result property="userName" column="user_name"/>
<result property="nickName" column="nick_name"/>
<result property="unbindFlag" column="unbind_flag"/>
</resultMap>
<sql id="selectGridVirtualCustUserVo">
select id, grid_id, cust_id, user_name, nick_name, relate_dept_id, relate_dept_name, relate_flag from grid_virtual_cust_user
</sql>
<select id="selectVirtualCustInfoByManage" parameterType="CustManageInfo" resultMap="CustManageInfoResult">
select distinct
b.cust_id,b.cust_name,b.cust_idn,a.user_name,a.nick_name,b.cust_type,c.grid_name,c.grid_duty_type,c.dept_type,d.dept_name
as branch_name,e.dept_name as outlet_name
from grid_virtual_cust_user a
inner join grid_virtual_cust b on a.grid_id = b.grid_id and a.cust_id = b.cust_id
inner join grid_virtual_grid c on a.grid_id = c.grid_id
left join (select distinct dept_id, dept_name, dept_type from sys_dept) d on a.relate_dept_id = d.dept_id and
d.dept_type = 'branch'
left join (select distinct dept_id, dept_name, dept_type from sys_dept) e on a.relate_dept_id = e.dept_id and
e.dept_type = 'outlet'
where a.grid_id = #{gridId}
<if test="custPattern != null and custPattern != ''">
and b.cust_type = #{custPattern}
</if>
<if test="custId != null and custId != ''"> and a.cust_id like concat('%', #{custId}, '%') </if>
<if test="custName != null and custName != ''"> and b.cust_name like concat('%', #{custName}, '%') </if>
<if test="custNo != null and custNo != ''"> and b.cust_idn like concat('%', #{custNo}, '%') </if>
<if test="distributeTag != null and distributeTag != ''"> and a.relate_flag = #{distributeTag} </if>
</select>
<select id="getCustList" parameterType="GridCustListDTO" resultMap="VirtualGridCustVO">
select a.grid_id , b.grid_name, c.dept_name as create_dept_name, b.grid_duty_type ,f.*, d.cust_type, a.user_name, a.nick_name, concat(su.nick_name, '-', b.create_by) as creator,
(select count(0) from grid_virtual_cust_user_unbind e where e.grid_id = a.grid_id and e.cust_id = a.cust_id and
e.user_name = a.user_name and e.delete_flag = '0') as unbind_flag
from grid_virtual_cust_user a
left join (select * from grid_virtual_grid where delete_flag = '0') b on a.grid_id = b.grid_id
left join sys_dept c on b.dept_id = c.dept_id
left join (select * from grid_virtual_cust where delete_flag = '0') d on a.cust_id = d.cust_id and a.grid_id =
d.grid_id
left join sys_user su on su.user_name = b.create_by
<if test="custType == 0">
left join (select cust_id,cust_name,cust_idc as cust_idn,cust_isn,cust_phone as lp_tel,cust_gender from cust_info_retail)f
on a.cust_id = f.cust_id
</if>
<if test="custType == 1">
left join (select cust_id,cust_name,social_credit_code as cust_idn,cust_idc as lp_idc,status,lp_name,cust_phone as lp_tel from cust_info_merchant)f
on a.cust_id = f.cust_id
</if>
<if test="custType == 2">
left join (select cust_id,cust_name,social_credit_code as cust_idn,cust_idc as lp_idc,status,lp_name,cust_phone as lp_tel from cust_info_business)f
on a.cust_id = f.cust_id
</if>
where
a.grid_id = #{gridId}
and a.relate_dept_id in (select dept_id from sys_dept where dept_id = #{deptId} or
find_in_set(#{deptId},ancestors))
<if test="custId != null and custId != ''">AND a.cust_id like concat('%', #{custId}, '%')</if>
<if test="custName != null and custName != ''">AND d.cust_name like concat('%', #{custName}, '%')</if>
<if test="custType != null and custType != ''">AND d.cust_type = #{custType}</if>
</select>
<select id="getCustListByManager" parameterType="GridCustListDTO" resultMap="VirtualGridCustVO">
select a.grid_id , b.grid_name, c.dept_name as create_dept_name, b.grid_duty_type , f.* , d.cust_type, a.user_name, a.nick_name, concat(su.nick_name, '-', b.create_by) as creator
from grid_virtual_cust_user a
left join (select * from grid_virtual_grid where delete_flag = '0') b on a.grid_id = b.grid_id
left join sys_user su on su.user_name = b.create_by
left join sys_dept c on b.dept_id = c.dept_id
left join (select * from grid_virtual_cust where delete_flag = '0') d on a.cust_id = d.cust_id and a.grid_id = d.grid_id
<if test="custType == 0">
left join (select cust_id,cust_name,cust_idc as cust_idn,cust_isn,cust_phone as lp_tel,cust_gender from cust_info_retail)f
on a.cust_id = f.cust_id
</if>
<if test="custType == 1">
left join (select cust_id,cust_name,social_credit_code as cust_idn,cust_idc as lp_idc,status,lp_name,cust_phone as lp_tel from cust_info_merchant)f
on a.cust_id = f.cust_id
</if>
<if test="custType == 2">
left join (select cust_id,cust_name,social_credit_code as cust_idn,cust_idc as lp_idc,status,lp_name,cust_phone as lp_tel from cust_info_business)f
on a.cust_id = f.cust_id
</if>
where
a.grid_id = #{gridId}
<if test="userName != null and userName != ''">
and a.user_name = #{userName}
</if>
<if test="deptId != null">
and a.relate_dept_id in (select dept_id from sys_dept where dept_id = #{deptId} or
find_in_set(#{deptId},ancestors))
</if>
and not exists(
select 1 from grid_virtual_cust_user_unbind e where e.grid_id = a.grid_id and e.cust_id = a.cust_id and
e.user_name = a.user_name and e.delete_flag = '0'
)
<if test="custId != null and custId != ''">AND a.cust_id like concat('%', #{custId}, '%')</if>
<if test="custName != null and custName != ''">AND d.cust_name like concat('%', #{custName}, '%')</if>
<if test="custType != null and custType != ''">AND d.cust_type = #{custType}</if>
</select>
<select id="getCountByGridIdAndUserName" resultType="Long">
select COUNT(distinct a.cust_id)
from grid_virtual_cust_user a
left join (select * from grid_virtual_cust where delete_flag = '0') b
on a.cust_id = b.cust_id and a.grid_id = b.grid_id
where a.user_name = #{userName}
and a.grid_id = #{gridId}
and b.cust_type = #{custType}
and not exists(select 1
from grid_virtual_cust_user_unbind c
where c.grid_id = a.grid_id
and a.cust_id = c.cust_id
and c.delete_flag = '0');
</select>
<select id="getUnrelateCustList" parameterType="GridCustListDTO" resultMap="VirtualGridCustVO">
select a.grid_id , b.grid_name, c.dept_name as create_dept_name, b.grid_duty_type , f.* , d.cust_type, a.user_name, a.nick_name
from grid_virtual_cust_user a
left join (select * from grid_virtual_grid where delete_flag = '0') b on a.grid_id = b.grid_id
left join sys_dept c on b.dept_id = c.dept_id
left join (select * from grid_virtual_cust where delete_flag = '0') d on a.cust_id = d.cust_id and a.grid_id =
d.grid_id
<if test="custType == 0">
left join (select cust_id,cust_name,cust_idc as cust_idn,cust_isn,cust_phone as lp_tel,cust_gender from cust_info_retail)f
on a.cust_id = f.cust_id
</if>
<if test="custType == 1">
left join (select cust_id,cust_name,social_credit_code as cust_idn,cust_idc as lp_idc,status,lp_name,cust_phone as lp_tel from cust_info_merchant)f
on a.cust_id = f.cust_id
</if>
<if test="custType == 2">
left join (select cust_id,cust_name,social_credit_code as cust_idn,cust_idc as lp_idc,status,lp_name,cust_phone as lp_tel from cust_info_business)f
on a.cust_id = f.cust_id
</if>
where a.grid_id = #{gridId} and a.user_name is null and a.relate_dept_id is null
<if test="custId != null and custId != ''">AND a.cust_id like concat('%', #{custId}, '%')</if>
<if test="custName != null and custName != ''">AND d.cust_name like concat('%', #{custName}, '%')</if>
<if test="custType != null and custType != ''">AND d.cust_type = #{custType}</if>
</select>
<select id="selectVirtualCustUserList" resultMap="GridVirtualCustUserResult">
select id, grid_id, cust_id, user_name, nick_name, relate_dept_id, relate_dept_name from grid_virtual_cust_user
<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>
</mapper>

View File

@@ -0,0 +1,22 @@
<?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.grid.mapper.VirtualGridRuleMapper">
<resultMap type="VirtualGridRule" id="GridVirtualRuleResult">
<result property="id" column="id" />
<result property="gridId" column="grid_id" />
<result property="relateType" column="relate_type" />
<result property="ruleOrder" column="rule_order" />
<result property="ruleKey" column="rule_key" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="deleteFlag" column="delete_flag" />
</resultMap>
<sql id="selectGridVirtualRuleVo">
select id, grid_id, relate_type, rule_order, rule_key, create_by, create_time, delete_flag from grid_virtual_rule
</sql>
</mapper>

View File

@@ -0,0 +1,38 @@
<?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.grid.mapper.VirtualUserMapper">
<resultMap type="VirtualUser" id="GridVirtualUserResult">
<result property="id" column="id" />
<result property="gridId" column="grid_id" />
<result property="relateType" column="relate_type" />
<result property="userId" column="user_id" />
<result property="userName" column="user_name" />
<result property="relateDeptId" column="relate_dept_id" />
<result property="relateDeptName" column="relate_dept_name" />
<result property="relateDeptType" column="relate_dept_type" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="deleteFlag" column="delete_flag" />
</resultMap>
<sql id="selectGridVirtualUserVo">
select id, grid_id, relate_type, user_id, user_name, relate_dept_id, relate_dept_name, relate_dept_type, create_by, create_time, update_by, update_time, delete_flag from grid_virtual_user
</sql>
<select id="selectDeptNameByGridId" resultType="java.lang.String" >
select user_name, group_concat(relate_dept_name)
from grid_virtual_user
where grid_id = #{gridId} and relate_dept_type = #{deptType} order by user_name
</select>
<select id="selectCustManagerByGridId" parameterType="Long" resultType="java.lang.String" >
select group_concat(distinct b.nick_name) from grid_virtual_user a ,sys_user b
where a.user_name = b.user_name and a.grid_id = #{gridId}
</select>
</mapper>

View File

@@ -0,0 +1,12 @@
<?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.grid.mapper.RegionAdminDivisionRelateMapper">
<select id="selectCodeByDept" resultType="String">
select distinct code from grid_region_admin_division_relate a
left join grid_region_grid b on a.grid_id = b.grid_id
where b.delete_flag = '0' and a.delete_flag = '0' and b.grid_level = 1 and b.dept_id like concat(#{deptCode}, '%')
</select>
</mapper>

View File

@@ -0,0 +1,124 @@
<?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.grid.mapper.RegionCustUserMapper">
<select id="selectCustByCode" resultType="CustVO">
SELECT '0' as cust_type, ci.cust_name, ci.cust_id, ci.region_code as code
FROM cust_info_retail_${dept} ci
WHERE ci.region_code in
<foreach collection="codeList" item="code" index="index" open="(" separator="," close=")">
#{code}
</foreach>
UNION ALL
SELECT '2' as cust_type, ci.cust_name, ci.cust_id, ci.region_code as code
FROM cust_info_business_${dept} ci
WHERE ci.region_code in
<foreach collection="codeList" item="code" index="index" open="(" separator="," close=")">
#{code}
</foreach>
UNION ALL
SELECT '1' as cust_type, ci.cust_name, ci.cust_id, ci.region_code as code
FROM cust_info_merchant_${dept} ci
WHERE ci.region_code in
<foreach collection="codeList" item="code" index="index" open="(" separator="," close=")">
#{code}
</foreach>
</select>
<select id="selectPrivateCustByCode" resultType="CustVO">
SELECT '0' as cust_type, ci.cust_name, ci.cust_id, ci.region_code as code
FROM cust_info_retail_${dept} ci
WHERE ci.region_code in
<foreach collection="codeList" item="code" index="index" open="(" separator="," close=")">
#{code}
</foreach>
UNION ALL
SELECT '1' as cust_type, ci.cust_name, ci.cust_id, ci.region_code as code
FROM cust_info_merchant_${dept} ci
WHERE ci.region_code in
<foreach collection="codeList" item="code" index="index" open="(" separator="," close=")">
#{code}
</foreach>
</select>
<select id="selectPublicCustByCode" resultType="CustVO">
SELECT '2' as cust_type, ci.cust_name, ci.cust_id, ci.region_code as code
FROM cust_info_business_${dept} ci
WHERE ci.region_code in
<foreach collection="codeList" item="code" index="index" open="(" separator="," close=")">
#{code}
</foreach>
</select>
<insert id="batchInsert">
INSERT INTO grid_region_cust_user_${dept} (top_grid_id, top_grid_name, top_grid_duty_type, sec_grid_id, code,
region_name,
ops_dept, creator, creator_id, creator_name, create_dept_id, create_dept_name,
cust_id, cust_name, cust_type, user_names, nick_names, branch_ids, branch_names, outlet_ids, outlet_names)
VALUES
<foreach collection="custList" item="cust" separator=",">
(#{cust.topGridId},#{cust.topGridName},#{cust.topGridDutyType}, #{cust.secGridId},#{cust.code},
#{cust.regionName},#{cust.opsDept},
#{cust.creator},#{cust.creatorId},#{cust.creatorName},#{cust.createDeptId},#{cust.createDeptName},
#{cust.custId},#{cust.custName},#{cust.custType},#{cust.userNames},#{cust.nickNames},#{cust.branchIds},#{cust.branchNames},#{cust.outletIds},#{cust.outletNames})
</foreach>
</insert>
<update id="batchUpdate">
UPDATE grid_region_cust_user_${dept}
SET sec_grid_id = #{secGridId}, sec_grid_name = #{secGridName}, sec_grid_duty_type = #{secGridDutyType},
user_names = #{userNames}, nick_names = #{nickNames},
outlet_ids = #{outletIds}, outlet_names = #{outletNames}
WHERE code IN
<foreach collection="codeList" item="code" index="index" open="(" separator="," close=")">
#{code}
</foreach>
AND top_grid_id = #{topGridId}
</update>
<delete id="batchDeleteTopGrid">
DELETE
FROM grid_region_cust_user_${dept}
WHERE top_grid_id = #{gridId}
</delete>
<update id="batchDeleteSecGrid">
UPDATE grid_region_cust_user_${dept}
SET sec_grid_id = null, sec_grid_name = null, user_names = null, nick_names = null, outlet_ids = null, outlet_names = null
WHERE sec_grid_id = #{gridId}
</update>
<delete id="deleteByCustIdInSecGrid">
DELETE
FROM grid_region_cust_user_${dept}
WHERE cust_id IN
<foreach collection="deleteList" item="custId" index="index" open="(" separator="," close=")">
#{custId}
</foreach>
AND sec_grid_id = #{secGridId}
</delete>
<select id="checkCustInSecGrid" resultType="Long">
SELECT count(1)
FROM grid_region_cust_user_${dept}
WHERE cust_id = #{custId}
AND sec_grid_id = #{secGridId}
</select>
<select id="countCustInTopGrid" resultType="Long">
SELECT count(1)
FROM grid_region_cust_user
WHERE top_grid_id = #{gridId}
AND cust_type = #{custType}
</select>
<select id="countCustInSecGrid" resultType="Long">
SELECT count(1)
FROM grid_region_cust_user
WHERE sec_grid_id = #{gridId}
AND cust_type = #{custType}
</select>
</mapper>

View File

@@ -0,0 +1,342 @@
<?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.grid.mapper.RegionGridMapper">
<select id="getSelectedRegionCodes" resultType="String">
select distinct r.code
from grid_region_admin_division_relate r
left join grid_region_grid g
on r.grid_id = g.grid_id
where g.dept_id like concat( left(#{deptId}, 3), '%')
and g.grid_level = #{gridLevel}
and g.ops_dept = #{opsDept}
<if test="gridId != null and gridId != ''">and g.grid_id != #{gridId}</if>
and g.delete_flag = '0'
and r.delete_flag = '0'
</select>
<select id="getDeptListByRegionCode" resultType="Long">
select distinct a.relate_dept_id
from grid_region_user_relate a
left join grid_region_admin_division_relate b on a.grid_id = b.grid_id
where a.relate_type = '1'
and a.delete_flag = '0'
and b.delete_flag = '0'
and b.code = #{regionCode}
and b.ops_dept = #{opsDept}
</select>
<select id="getUserListByRegionCode" resultType="String">
select distinct concat(a.nick_name, '-', a.user_name)
from grid_region_user_relate a
left join grid_region_admin_division_relate b on a.grid_id = b.grid_id
where a.relate_type = '1'
and a.delete_flag = '0'
and b.delete_flag = '0'
and b.code = #{regionCode}
and b.ops_dept = #{opsDept}
</select>
<select id="getUserUnbindList" resultType="RegionUnbindVo">
select a.grid_id,
a.user_name,
a.nick_name,
a.relate_dept_name,
(select count(*)
from grid_region_cust_user_unbind d
where d.grid_id = a.grid_id
and d.user_name = a.user_name
and d.cust_id = #{custId}
and d.delete_flag = '0') as unbind_flag
from grid_region_user_relate a
where a.relate_type = '1'
and a.delete_flag = '0'
and a.grid_id = #{gridId}
</select>
<select id="getSecGridIdByCode" resultType="RegionGrid">
select a.*
from grid_region_grid a
left join grid_region_admin_division_relate b on b.grid_id = a.grid_id
where b.parent_grid_id = #{gridId}
and b.code = #{code}
and b.delete_flag = '0'
and a.delete_flag = '0'
</select>
<select id="getRetailCust" parameterType="GridCustListDTO" resultType="RegionGridCustVO">
select a.cust_id,a.cust_name,a.cust_idc as cust_idn,a.region_code,'0' as cust_type from cust_info_retail a
where a.region_code in (select distinct code from grid_region_admin_division_relate where grid_id = #{gridId} and delete_flag = '0')
<if test="custName != null and custName != ''">and a.cust_name like concat('%', #{custName}, '%')</if>
<if test="custId != null and custId != ''">and a.cust_id like concat('%', #{custId}, '%')</if>
</select>
<select id="getRetailCustFromTopByManager" parameterType="GridCustListDTO" resultType="RegionGridCustVO">
select a.cust_id,a.cust_name,a.cust_idc as cust_idn,a.region_code,'0' as cust_type, concat(d.town,'-',d.village) as region_name from cust_info_retail a
left join (select distinct code,grid_id, parent_grid_id from grid_region_admin_division_relate where delete_flag
= '0' ) b on b.code =a.region_code
left join (select grid_id,parent_grid_id,relate_dept_id,user_name,nick_name from grid_region_user_relate where
delete_flag ='0') c on c.grid_id = b.grid_id
left join grid_admin_division d on d.code = a.region_code
where c.parent_grid_id = #{gridId} and c.user_name = #{userName}
<if test="custName != null and custName != ''">and a.cust_name like concat('%', #{custName}, '%')</if>
<if test="custId != null and custId != ''">and a.cust_id like concat('%', #{custId}, '%')</if>
</select>
<select id="getRetailCustFromSecByManager" parameterType="GridCustListDTO" resultType="RegionGridCustVO">
select a.cust_id,a.cust_name,a.cust_idc as cust_idn,a.region_code,'0' as cust_type from cust_info_retail a
where a.region_code in (
select distinct code from grid_region_admin_division_relate a
left join grid_region_user_relate b on a.grid_id = b.grid_id
where a.delete_flag = '0' and b.delete_flag = '0' and b.user_name = #{userName} and a.grid_id = #{gridId}
)
<if test="custName != null and custName != ''">and a.cust_name like concat('%', #{custName}, '%')</if>
<if test="custId != null and custId != ''">and a.cust_id like concat('%', #{custId}, '%')</if>
</select>
<select id="getMerchantCust" parameterType="GridCustListDTO" resultType="RegionGridCustVO">
select a.cust_id,a.cust_name,a.social_credit_code as cust_idn,a.region_code,'1' as cust_type from cust_info_merchant a
where a.region_code in (select distinct code from grid_region_admin_division_relate where grid_id = #{gridId} and delete_flag = '0')
<if test="custName != null and custName != ''">and a.cust_name like concat('%', #{custName}, '%')</if>
<if test="custId != null and custId != ''">and a.cust_id like concat('%', #{custId}, '%')</if>
</select>
<select id="getMerchantCustFromTopByManager" parameterType="GridCustListDTO" resultType="RegionGridCustVO">
select a.cust_id,a.cust_name,a.social_credit_code as cust_idn,a.region_code,'1' as cust_type , concat(d.town,'-',d.village) as region_name from cust_info_merchant a
left join (select distinct code,grid_id, parent_grid_id from grid_region_admin_division_relate where delete_flag
= '0' ) b on b.code =a.region_code
left join (select grid_id,parent_grid_id,relate_dept_id,user_name,nick_name from grid_region_user_relate where
delete_flag ='0') c on c.grid_id = b.grid_id
left join grid_admin_division d on d.code = a.region_code
where c.parent_grid_id = #{gridId} and c.user_name = #{userName}
<if test="custName != null and custName != ''">and a.cust_name like concat('%', #{custName}, '%')</if>
<if test="custId != null and custId != ''">and a.cust_id like concat('%', #{custId}, '%')</if>
</select>
<select id="getMerchantCustFromSecByManager" parameterType="GridCustListDTO" resultType="RegionGridCustVO">
select a.cust_id,a.cust_name,a.social_credit_code as cust_idn,a.region_code,'1' as cust_type from cust_info_merchant a
where a.region_code in (
select distinct code from grid_region_admin_division_relate a
left join grid_region_user_relate b on a.grid_id = b.grid_id
where a.delete_flag = '0' and b.delete_flag = '0' and b.user_name = #{userName} and a.grid_id = #{gridId}
)
<if test="custName != null and custName != ''">and a.cust_name like concat('%', #{custName}, '%')</if>
<if test="custId != null and custId != ''">and a.cust_id like concat('%', #{custId}, '%')</if>
</select>
<select id="getBusinessCust" parameterType="GridCustListDTO" resultType="RegionGridCustVO">
select a.cust_id,a.cust_name,a.social_credit_code as cust_idn,a.region_code,'2' as cust_type from cust_info_business a
where a.region_code in (select distinct code from grid_region_admin_division_relate where grid_id = #{gridId} and delete_flag = '0')
<if test="custName != null and custName != ''">and a.cust_name like concat('%', #{custName}, '%')</if>
<if test="custId != null and custId != ''">and a.cust_id like concat('%', #{custId}, '%')</if>
</select>
<select id="getBusinessCustFromTopByManager" parameterType="GridCustListDTO" resultType="RegionGridCustVO">
select a.cust_id,a.cust_name,a.social_credit_code as cust_idn,a.region_code,'2' as cust_type, concat(d.town,'-',d.village) as region_name
from cust_info_business a
left join (select distinct code,grid_id, parent_grid_id from grid_region_admin_division_relate where delete_flag
= '0' ) b on b.code =a.region_code
left join (select grid_id,parent_grid_id,relate_dept_id,user_name,nick_name from grid_region_user_relate where
delete_flag ='0') c on c.grid_id = b.grid_id
left join grid_admin_division d on d.code = a.region_code
where c.parent_grid_id = #{gridId} and c.user_name = #{userName}
<if test="custName != null and custName != ''">and a.cust_name like concat('%', #{custName}, '%')</if>
<if test="custId != null and custId != ''">and a.cust_id like concat('%', #{custId}, '%')</if>
</select>
<select id="getBusinessCustFromSecByManager" parameterType="GridCustListDTO" resultType="RegionGridCustVO">
select a.cust_id,a.cust_name,a.social_credit_code as cust_idn,a.region_code,'2' as cust_type from cust_info_business a
where a.region_code in (
select distinct code from grid_region_admin_division_relate a
left join grid_region_user_relate b on a.grid_id = b.grid_id
where a.delete_flag = '0' and b.delete_flag = '0' and b.user_name = #{userName} and a.grid_id = #{gridId}
)
<if test="custName != null and custName != ''">and a.cust_name like concat('%', #{custName}, '%')</if>
<if test="custId != null and custId != ''">and a.cust_id like concat('%', #{custId}, '%')</if>
</select>
<select id="getTopGridList" parameterType="RegionGridListDTO" resultType="RegionGridListVO">
select distinct a.grid_name , a.grid_duty_type , a.grid_id, a.dept_id , b.dept_name as create_dept_name,
a.ops_dept, CONCAT(e.nick_name, '-',a.create_by) as creator, a.update_time from grid_region_grid a
left join sys_dept b on a.dept_id = b.dept_id
left join sys_user e on a.create_by = e.user_name
left join grid_region_user_relate c on c.grid_id = a.grid_id
<if test="relateBranchName != null and relateBranchName != ''">left join grid_region_user_relate d on d.grid_id
= a.grid_id
</if>
where a.delete_flag = '0' and a.grid_level = '1' and c.delete_flag = '0'
and (a.dept_id in (select dept_id from sys_dept where dept_id = #{deptId} or find_in_set(#{deptId}, ancestors))
or
c.relate_dept_id in (select dept_id from sys_dept where dept_id = #{deptId} or
find_in_set(#{deptId},ancestors)))
<if test="opsDept != null and opsDept != ''">and a.ops_dept = #{opsDept}</if>
<if test="gridDutyType != null and gridDutyType != ''">and a.grid_duty_type = #{gridDutyType}</if>
<if test="relateBranchName != null and relateBranchName != ''">
and d.delete_flag = '0' and d.relate_dept_type = 'branch'
and d.relate_dept_name like concat('%',#{relateBranchName}, '%')
</if>
<if test="gridName != null and gridName != ''">and a.grid_name like concat('%',#{gridName}, '%')</if>
ORDER BY a.update_time DESC
</select>
<select id="getSecGridList" parameterType="RegionGridListDTO" resultType="RegionGridListVO">
select distinct a.grid_name ,a.parent_grid_id, a.grid_duty_type , a.grid_id, a.dept_id , b.dept_name as
create_dept_name, CONCAT(c.nick_name, '-',a.create_by) as creator, d.grid_name as parent_grid_name, a.ops_dept,
a.update_time
from grid_region_grid a
left join sys_dept b on a.dept_id = b.dept_id
left join sys_user c on a.create_by = c.user_name
left join grid_region_grid d on a.parent_grid_id = d.grid_id
left join grid_region_user_relate h on h.grid_id = a.grid_id
<if test="relateBranchName != null and relateBranchName != ''">left join grid_region_user_relate e on e.grid_id
= a.grid_id
</if>
<if test="relateOutletName != null and relateOutletName != ''">left join grid_region_user_relate f on f.grid_id
= a.grid_id
</if>
<if test="relateUserName != null and relateUserName != ''">left join grid_region_user_relate g on g.grid_id =
a.grid_id
</if>
where a.delete_flag = '0' and a.grid_level = '2' and h.delete_flag = '0'
and (a.dept_id in (select dept_id from sys_dept where dept_id = #{deptId} or find_in_set(#{deptId}, ancestors))
or h.relate_dept_id in (select dept_id from sys_dept where dept_id = #{deptId} or find_in_set(#{deptId},
ancestors))
)
<if test="opsDept != null and opsDept != ''">and a.ops_dept = #{opsDept}</if>
<if test="gridDutyType != null and gridDutyType != ''">and a.grid_duty_type = #{gridDutyType}</if>
<if test="relateBranchName != null and relateBranchName != ''">
and e.delete_flag = '0' and e.relate_dept_type = 'branch'
and e.relate_dept_name like concat('%',#{relateBranchName}, '%')
</if>
<if test="relateOutletName != null and relateOutletName != ''">
and f.delete_flag = '0' and f.relate_dept_type = 'outlet'
and f.relate_dept_name like concat('%',#{relateOutletName}, '%')
</if>
<if test="relateUserName != null and relateUserName != ''">
and g.delete_flag = '0' and g.relate_type = '1'
and g.user_name like concat('%',#{relateUserName}, '%')
</if>
<if test="gridName != null and gridName != ''">and a.grid_name like concat('%',#{gridName}, '%')</if>
<if test="parentGridName != null and parentGridName != ''">and d.grid_name like concat('%',#{parentGridName},
'%')
</if>
ORDER BY a.update_time DESC
</select>
<select id="getSecGridListByManager" parameterType="RegionGridListDTO" resultType="RegionGridListVO">
select distinct a.grid_name ,a.parent_grid_id, a.grid_duty_type , a.grid_id, a.dept_id , b.dept_name as
create_dept_name, CONCAT(c.nick_name, '-',a.create_by) as creator, d.grid_name as parent_grid_name, a.ops_dept,
a.update_time
from grid_region_grid a
left join sys_dept b on a.dept_id = b.dept_id
left join sys_user c on a.create_by = c.user_name
left join grid_region_grid d on a.parent_grid_id = d.grid_id
left join grid_region_user_relate h on h.grid_id = a.grid_id
<if test="relateBranchName != null and relateBranchName != ''">left join grid_region_user_relate e on e.grid_id
= a.grid_id
</if>
<if test="relateOutletName != null and relateOutletName != ''">left join grid_region_user_relate f on f.grid_id
= a.grid_id
</if>
<if test="relateUserName != null and relateUserName != ''">left join grid_region_user_relate g on g.grid_id =
a.grid_id
</if>
where a.delete_flag = '0' and a.grid_level = '2' and h.delete_flag = '0'
and h.user_name = #{userName}
<if test="opsDept != null and opsDept != ''">and a.ops_dept = #{opsDept}</if>
<if test="gridDutyType != null and gridDutyType != ''">and a.grid_duty_type = #{gridDutyType}</if>
<if test="relateBranchName != null and relateBranchName != ''">
and e.delete_flag = '0' and e.relate_dept_type = 'branch'
and e.relate_dept_name like concat('%',#{relateBranchName}, '%')
</if>
<if test="relateOutletName != null and relateOutletName != ''">
and f.delete_flag = '0' and f.relate_dept_type = 'outlet'
and f.relate_dept_name like concat('%',#{relateOutletName}, '%')
</if>
<if test="relateUserName != null and relateUserName != ''">
and g.delete_flag = '0' and g.relate_type = '1'
and g.user_name like concat('%',#{relateUserName}, '%')
</if>
<if test="gridName != null and gridName != ''">and a.grid_name like concat('%',#{gridName}, '%')</if>
<if test="parentGridName != null and parentGridName != ''">and d.grid_name like concat('%',#{parentGridName},
'%')
</if>
ORDER BY a.update_time DESC
</select>
<select id="getGridCountByDeptId" resultType="Long">
select count(DISTINCT a.grid_id)
from grid_region_grid a
left join grid_region_user_relate c on c.grid_id = a.grid_id
where a.delete_flag = '0'
<if test="opsDept != null and opsDept != ''">and a.ops_dept = #{opsDept}</if>
and a.grid_level = #{gridLevel}
and c.delete_flag = '0'
and (a.dept_id in
(select dept_id from sys_dept where dept_id = #{deptId} or find_in_set(#{deptId}, ancestors))
or
c.relate_dept_id in
(select dept_id from sys_dept where dept_id = #{deptId} or find_in_set(#{deptId}, ancestors))
)
</select>
<select id="getSecGridCountByUserName" resultType="Long">
select count(distinct a.grid_id)
from grid_region_grid a
left join grid_region_user_relate b on b.grid_id = a.grid_id
where a.delete_flag = '0'
and a.grid_level = '2'
and b.delete_flag = '0'
and b.user_name = #{userName}
</select>
<select id="getCodeByDeptId" resultType="String">
select distinct b.code
from grid_region_admin_division_relate b
left join grid_region_grid a on b.grid_id = a.grid_id
left join grid_region_user_relate c on c.grid_id = a.grid_id
where a.delete_flag = '0'
and a.grid_level = '1'
and c.delete_flag = '0'
and b.delete_flag = '0'
<if test="opsDept != null and opsDept != ''">and b.ops_dept = #{opsDept}</if>
and (a.dept_id in
(select dept_id from sys_dept where dept_id = #{deptId} or find_in_set(#{deptId}, ancestors))
or c.relate_dept_id in
(select dept_id from sys_dept where dept_id = #{deptId} or find_in_set(#{deptId}, ancestors))
)
</select>
<select id="getCodeByOutletId" resultType="String">
select distinct b.code
from grid_region_admin_division_relate b
left join grid_region_grid a on b.grid_id = a.grid_id
left join grid_region_user_relate c on c.grid_id = a.grid_id
where a.delete_flag = '0'
and a.grid_level = '2'
and c.delete_flag = '0'
and b.delete_flag = '0'
and (a.dept_id in
(select dept_id from sys_dept where dept_id = #{deptId} or find_in_set(#{deptId}, ancestors))
or c.relate_dept_id in
(select dept_id from sys_dept where dept_id = #{deptId} or find_in_set(#{deptId}, ancestors))
)
</select>
<select id="selectTopGridByName" resultType="RegionGrid">
select * from grid_region_grid grg
left join grid_region_user_relate grur on grur.grid_id = grg.grid_id
where grur.relate_type = 2 and grur.relate_dept_id = #{deptId} and grg.grid_name = #{gridName};
</select>
<select id="getRegionNamesByGridId" resultType="String">
select concat(b.town, '-', b.village) from grid_region_admin_division_relate a
left join grid_admin_division b on a.code = b.code
where a.delete_flag = '0' and a.grid_id = #{gridId}
</select>
<select id="getSecGridIdByTopGridId" resultType="Long">
select grid_id from grid_region_grid where parent_grid_id = #{gridId} and grid_level = '2' and delete_flag = '0'
</select>
</mapper>

View File

@@ -0,0 +1,15 @@
<?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.grid.mapper.RegionGridTransferMapper">
<select id="getGridRegionTransferListByTopGrid" resultType="GridRegionTransfer">
select a.*
from grid_region_transfer a
left join grid_region_grid b on a.prev_grid_id = b.grid_id
left join grid_region_grid c on a.next_grid_id = c.grid_id
where b.parent_grid_id = #{gridId}
or c.parent_grid_id = #{gridId}
order by a.create_time desc
</select>
</mapper>

View File

@@ -0,0 +1,170 @@
<?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.grid.mapper.SysGridUserCustMapper">
<resultMap type="SysGridUserCust" id="SysGridUserCustResult">
<result property="id" column="id" />
<result property="deptBranchId" column="dept_branch_id" />
<result property="deptOutletId" column="dept_outlet_id" />
<result property="custType" column="cust_type" />
<result property="custId" column="cust_id" />
<result property="custName" column="cust_name" />
<result property="regionCode" column="region_code" />
<result property="gridType" column="grid_type" />
<result property="gridId" column="grid_id" />
<result property="parentGridId" column="parent_grid_id" />
<result property="userName" column="user_name" />
<result property="relationStatus" column="relation_status" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="updateDept" column="update_dept" />
</resultMap>
<resultMap type="CustManageSelectDTO" id="CustManageSelectDTOResult">
<result property="custId" column="cust_id" />
<result property="custName" column="cust_name" />
<result property="userId" column="user_name" />
<result property="userName" column="nick_name" />
<result property="outletId" column="dept_branch_id" />
<result property="branchId" column="dept_outlet_id" />
<result property="custType" column="cust_type" />
</resultMap>
<sql id="selectSysGridUserCustVo">
select id, dept_branch_id, dept_outlet_id, cust_type, cust_id, cust_name, region_code, grid_type, grid_id, parent_grid_id, user_name, relation_status, update_by, update_time, update_dept from sys_grid_user_cust
</sql>
<select id="selectSysGridUserCustList" parameterType="SysGridUserCust" resultMap="SysGridUserCustResult">
<include refid="selectSysGridUserCustVo"/>
<where>
<if test="deptBranchId != null and deptBranchId != ''"> and dept_branch_id = #{deptBranchId}</if>
<if test="deptOutletId != null and deptOutletId != ''"> and dept_outlet_id = #{deptOutletId}</if>
<if test="custId != null and custId != ''"> and cust_id = #{custId}</if>
<if test="custName != null and custName != ''"> and cust_name like concat('%', #{custName}, '%')</if>
<if test="regionCode != null and regionCode != ''"> and region_code = #{regionCode}</if>
<if test="gridType != null and gridType != ''"> and grid_type = #{gridType}</if>
<if test="gridTopId != null and gridTopId != ''"> and grid_top_id = #{gridTopId}</if>
<if test="gridSecId != null and gridSecId != ''"> and grid_sec_id = #{gridSecId}</if>
<if test="userName != null and userName != ''"> and user_name like concat('%', #{userName}, '%')</if>
<if test="relationStatus != null and relationStatus != ''"> and relation_status = #{relationStatus}</if>
<if test="updateDept != null and updateDept != ''"> and update_dept = #{updateDept}</if>
</where>
</select>
<select id="selectSysGridUserCustById" parameterType="Long" resultMap="SysGridUserCustResult">
<include refid="selectSysGridUserCustVo"/>
where id = #{id}
</select>
<insert id="insertSysGridUserCust" parameterType="SysGridUserCust" useGeneratedKeys="true" keyProperty="id">
insert into sys_grid_user_cust
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="deptBranchId != null">dept_branch_id,</if>
<if test="deptOutletId != null">dept_outlet_id,</if>
<if test="custId != null">cust_id,</if>
<if test="custName != null">cust_name,</if>
<if test="regionCode != null">region_code,</if>
<if test="gridType != null">grid_type,</if>
<if test="gridTopId != null">grid_top_id,</if>
<if test="gridSecId != null">grid_sec_id,</if>
<if test="userName != null">user_name,</if>
<if test="relationStatus != null">relation_status,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="updateDept != null">update_dept,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="deptBranchId != null">#{deptBranchId},</if>
<if test="deptOutletId != null">#{deptOutletId},</if>
<if test="custId != null">#{custId},</if>
<if test="custName != null">#{custName},</if>
<if test="regionCode != null">#{regionCode},</if>
<if test="gridType != null">#{gridType},</if>
<if test="gridTopId != null">#{gridTopId},</if>
<if test="gridSecId != null">#{gridSecId},</if>
<if test="userName != null">#{userName},</if>
<if test="relationStatus != null">#{relationStatus},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="updateDept != null">#{updateDept},</if>
</trim>
</insert>
<update id="updateSysGridUserCust" parameterType="SysGridUserCust">
update sys_grid_user_cust
<trim prefix="SET" suffixOverrides=",">
<if test="deptBranchId != null">dept_branch_id = #{deptBranchId},</if>
<if test="deptOutletId != null">dept_outlet_id = #{deptOutletId},</if>
<if test="custId != null">cust_id = #{custId},</if>
<if test="custName != null">cust_name = #{custName},</if>
<if test="regionCode != null">region_code = #{regionCode},</if>
<if test="gridType != null">grid_type = #{gridType},</if>
<if test="gridTopId != null">grid_top_id = #{gridTopId},</if>
<if test="gridSecId != null">grid_sec_id = #{gridSecId},</if>
<if test="userName != null">user_name = #{userName},</if>
<if test="relationStatus != null">relation_status = #{relationStatus},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="updateDept != null">update_dept = #{updateDept},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteSysGridUserCustById" parameterType="Long">
delete from sys_grid_user_cust where id = #{id}
</delete>
<delete id="deleteSysGridUserCustByIds" parameterType="String">
delete from sys_grid_user_cust where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<select id="selectOutletNameByCustId" parameterType="String">
select group_concat(distinct b.dept_name) from sys_grid_user_cust a , sys_dept b
where a.dept_outlet_id = b.dept_id and a.cust_id =#{custId} and a.dept_branch_id =#{deptBranchId} and a.relation_status = '0'
</select>
<select id="selectManageByCust" parameterType="String">
select group_concat(distinct b.nick_name) from sys_grid_user_cust a , sys_user b
where a.user_name = b.user_name and a.cust_id =#{custId} and a.relation_status = '0'
<if test="deptBranchId != null and deptBranchId != ''"> and dept_branch_id = #{deptBranchId}</if>
</select>
<select id="selectCustInfoByManage" parameterType="CustManageInfo">
select * from sys_grid_user_cust
where (grid_id = #{gridId} or parent_grid_id = #{gridId}) and grid_type =#{gridPattern}
<if test="custPattern != null and custPattern != ''"> and cust_type = #{custPattern}</if>
<if test="custNo != null and custNo != ''"> and cust_id like concat('%', #{custNo}, '%')</if>
<if test="custName != null and custName != ''"> and cust_name like concat('%', #{custName}, '%')</if>
<if test="distributeTag != null and distributeTag != ''"> and
CASE WHEN #{distributeTag} = '0' THEN relation_status = '0' ELSE relation_status in('1','2') END
</if>
group by dept_branch_id,cust_id
</select>
<select id="updateRetailManage" parameterType="String">
update sys_grid_user_cust set relation_status = #{operationType}
where dept_branch_id = #{belongUserId} and cust_id = #{custId} and grid_type = #{gridPattern}
</select>
<select id="selectManageInfoByCust" resultMap="CustManageSelectDTOResult">
select a.cust_id,a.cust_name,a.user_name,b.nick_name,a.dept_branch_id,a.dept_outlet_id,a.cust_type from sys_grid_user_cust a,sys_user b,sys_dept c
where a.grid_id = #{gridId} and a.grid_type =#{gridPattern} and a.relation_status ='0'
and a.cust_id in
<foreach item="custId" index="index" collection="custIds" open="(" separator="," close=")">
#{custId}
</foreach>
and a.user_name = b.user_name and (a.dept_branch_id = c.dept_id or a.dept_outlet_id = c.dept_id)
<if test="userName != null and userName != ''">
and (b.nick_name like concat('%', #{userName}, '%')
or b.user_name like concat('%', #{userName}, '%')
or c.dept_name like concat('%', #{userName}, '%'))
</if>
group by a.cust_id
</select>
</mapper>

View File

@@ -0,0 +1,104 @@
<?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.grid.mapper.VirtualGridMapper">
<select id="getGridList" parameterType="VirtualGridListDTO" resultType="VirtualGridListVO">
SELECT distinct a.* , CONCAT(u.nick_name, '-',a.create_by ) as creator FROM grid_virtual_grid a
<if test="relateUserName != null and relateUserName != ''">
LEFT JOIN grid_virtual_user b on a.grid_id = b.grid_id
</if>
left join grid_virtual_cust_user c on c.grid_id = a.grid_id
left join sys_user u on u.user_name = a.create_by
WHERE a.delete_flag = '0'
<if test="opsDept != null and opsDept != ''">and a.ops_dept = #{opsDept}</if>
AND (a.dept_id in (select dept_id from sys_dept where dept_id = #{deptId} or find_in_set(#{deptId},ancestors))
or c.relate_dept_id in (select dept_id from sys_dept where dept_id = #{deptId} or
find_in_set(#{deptId},ancestors))
)
<if test="gridType != null and gridType != ''">and a.grid_type = #{gridType}</if>
<if test="gridDutyType != null and gridDutyType != ''">and a.grid_duty_type = #{gridDutyType}</if>
<if test="gridName != null and gridName != ''">AND a.grid_name like concat('%', #{gridName}, '%')</if>
<if test="relateUserName != null and relateUserName != ''">
and b.delete_flag = '0' AND b.user_name like concat('%', #{relateUserName}, '%')
</if>
<if test="custType != null and custType != ''">
and case when #{custType} ='0' then a.has_retail = '1'
when #{custType} ='2' then a.has_business = '1'
when #{custType} ='1' then a.has_retail_business = '1'
end
</if>
ORDER BY a.update_time DESC
</select>
<select id="getGridListByManager" parameterType="VirtualGridListDTO" resultType="VirtualGridListVO">
SELECT a.* ,CONCAT(u.nick_name, '-',a.create_by ) as creator FROM grid_virtual_grid a
<if test="relateUserName != null and relateUserName != ''">LEFT JOIN grid_virtual_user c on a.grid_id =
c.grid_id
</if>
left join sys_user u on u.user_name = a.create_by
WHERE a.delete_flag = '0'
<if test="opsDept != null and opsDept != ''">and a.ops_dept = #{opsDept}</if>
AND exists( SELECT 1 from grid_virtual_cust_user b
where b.grid_id = a.grid_id and b.user_name = #{userName}
AND not exists( select 1 from grid_virtual_cust_user_unbind c
where c.grid_id = a.grid_id and c.cust_id = b.cust_id and c.user_name = #{userName} and c.delete_flag = '0'
)
)
<if test="gridType != null and gridType != ''">and a.grid_type = #{gridType}</if>
<if test="gridDutyType != null and gridDutyType != ''">and a.grid_duty_type = #{gridDutyType}</if>
<if test="gridName != null and gridName != ''">AND a.grid_name like concat('%', #{gridName}, '%')</if>
<if test="relateUserName != null and relateUserName != ''">and c.delete_flag = '0' AND c.user_name like
concat('%', #{relateUserName}, '%')
</if>
<if test="deptType != null and deptType != ''">
and case when #{deptType} = '0' then a.dept_type ='head' else a.dept_type ='branch' end
</if>
<if test="custType != null and custType != ''">
and case when #{custType} ='0' then a.has_retail = '1'
when #{custType} ='2' then a.has_business = '1'
when #{custType} ='1' then a.has_retail_business = '1'
else 1 = 1 end
</if>
ORDER BY a.update_time DESC
</select>
<select id="getVirtualGridNumByDeptId" parameterType="Long" resultType="java.lang.Long">
SELECT count(distinct a.grid_id) FROM grid_virtual_grid a
left join grid_virtual_cust_user c on c.grid_id = a.grid_id
WHERE a.delete_flag = '0'
<if test="opsDept != null and opsDept != ''">and a.ops_dept = #{opsDept}</if>
AND (a.dept_id in (select dept_id from sys_dept where dept_id = #{deptId} or find_in_set(#{deptId},ancestors))
or c.relate_dept_id in (select dept_id from sys_dept where dept_id = #{deptId} or
find_in_set(#{deptId},ancestors)))
</select>
<select id="getVirtualGridNumByUserId" parameterType="String" resultType="java.lang.Long">
SELECT count(distinct a.grid_id)
FROM grid_virtual_grid a
WHERE a.delete_flag = '0'
AND exists(SELECT 1
from grid_virtual_cust_user b
where b.grid_id = a.grid_id
and b.user_name = #{userName}
AND not exists(select 1
from grid_virtual_cust_user_unbind c
where c.grid_id = a.grid_id
and c.cust_id = b.cust_id
and c.user_name = #{userName}
and c.delete_flag = '0'))
</select>
<select id="searchVirtualGrid" resultType="VirtualGridVO">
SELECT distinct a.* FROM grid_virtual_grid a
LEFT JOIN grid_virtual_cust_user c on a.grid_id = c.grid_id
WHERE a.delete_flag = '0' and a.ops_dept = #{opsDept}
<if test="gridName != null and gridName != ''">AND a.grid_name like concat('%', #{gridName}, '%')</if>
AND (a.dept_id in (select dept_id from sys_dept where dept_id = #{deptId} or find_in_set(#{deptId},ancestors))
or c.relate_dept_id in (select dept_id from sys_dept where dept_id = #{deptId} or
find_in_set(#{deptId},ancestors)))
</select>
</mapper>

View File

@@ -0,0 +1,334 @@
<?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.grid.mapper.AnchorMapper">
<select id="selectAnchorList" resultType="com.ruoyi.ibs.grid.domain.vo.AnchorVo">
select
a.id as id,
a.legal_id as legalId,
a.cust_id as custId,
a.anchor_name as anchorName,
a.belong_business as belongBusiness,
a.cust_status as custStatus,
a.cust_address_status as custAddressStatus,
b.address as address,
b.source as source,
b.province as province,
b.city as city,
b.county as county,
b.address_name as addressName,
b.street as street,
b.community as community,
b.address_detail as addressDetail,
a.status as status,
a.anchor_remark as anchorRemark,
b.longitude as longitude,
b.latitude as latitude
from ibs_anchor a
left join
(select id,
source,
address,
province,
city,
county,
address_name,
street,
community,
address_detail,
longitude,
latitude
from
ibs_anchor_address
where address_status=1
and delete_status = 0) b
on a.address_id = b.id
where a.delete_status = 0
and a.cust_type = #{custType}
<if test=" isHead == false">and a.update_org = #{deptId}</if>
<if test=" anchorName != null and anchorName != ''">and a.anchor_name like
concat('%',concat(#{anchorName},'%'))
</if>
<if test=" street != null and street != ''">and b.street like concat('%',concat(#{street},'%'))</if>
<if test=" community != null and community != ''">and b.community like concat('%',concat(#{community},'%'))
</if>
<if test=" source != null and source != ''">and b.source like concat('%',concat(#{source},'%'))</if>
<if test=" custAddressStatus != null and custAddressStatus != ''">and a.cust_address_status =
#{custAddressStatus}
</if>
<if test=" custStatus != null and custStatus != ''">and a.cust_status = #{custStatus}</if>
<if test=" status != null and status != ''">and a.status = #{status}</if>
</select>
<select id="selectAnchorList_COUNT" resultType="Long">
select 999999999
</select>
<select id="selectAnchorListWithRegion" resultType="com.ruoyi.ibs.grid.domain.vo.AnchorVo">
select a.id as id,
a.anchor_name as anchorName,
a.belong_business as belongBusiness,
a.cust_status as cust_status,
a.cust_address_status,
b.source as source,,
b.address_name as addressName,
b.street as street,
b.community as community,
b.address_detail as addressDetail,
a.status as status,
a.anchor_remark as anchorRemark,
b.longitude as longitude,
b.latitude as latitude
from ibs_anchor a
left join
(select id, address_name,street,community,address_detail,longitude,latitude,region_code,source
from ibs_anchor_address
where address_status = 1
and delete_status = 0 ) b on a.address_id = b.id
left join grid_region_admin_division_relate c on b.region_code = c.code
left join grid_region_user_relate d on c.grid_id = d.grid_id
where d.user_name = #{userid}
and a.delete_status = 0
and a.cust_type = #{custType}
<if test=" anchorName != null and anchorName != ''">and a.anchor_name like
concat('%',concat(#{anchorName},'%'))
</if>
<if test=" street != null and street != ''">and street like concat('%',concat(#{street},'%'))</if>
<if test=" community != null and community != ''">and community like concat('%',concat(#{community},'%'))</if>
<if test=" source != null and source != ''">and a.source like concat('%',concat(#{source},'%'))</if>
<if test=" custAddressStatus != null and custAddressStatus != ''">and a.cust_address_status =
#{custAddressStatus}
</if>
<if test=" custStatus != null and custStatus != ''">and a.cust_status = #{custStatus}</if>
</select>
<select id="selectAuditList" resultType="com.ruoyi.ibs.grid.domain.vo.AuditVo">
select
a.id as id,
concat(c.nick_name,'-',c.user_name) as nickName,
a.update_time as update_time,
b.anchor_name as anchorName,
b.belong_business as belongBusiness,
b.source as source,
b.cust_status as custStatus,
b.cust_address_status as custAddressStatus,
a.type as type,
a.address_name as addressName,
a.address as address,
a.address_now as addressNow,
a.province_now as provinceNow,
a.city_now as cityNow,
a.county_now as countyNow,
a.street_now as streetNow,
a.community_now as communityNow,
a.address_detail_now as addressDetailNow,
a.address_remark as addressRemark,
a.region_code as region_code
from ibs_anchor_address a
left join ibs_anchor b on a.anchor_id = b.legal_id
left join sys_user c on a.update_by = c.user_name
where a.address_status = 0
and a.delete_status = 0
and b.delete_status = 0
and b.cust_type = #{custType}
<if test=" isHead == false">and b.update_org = #{deptId}</if>
<if test=" custAddressStatus != null and custAddressStatus != ''">and a.cust_address_status =
#{custAddressStatus}
</if>
<if test=" custStatus != null and custStatus != ''">and a.cust_status = #{custStatus}</if>
</select>
<select id="selectAuditList_COUNT" resultType="Long">
select 999999999
</select>
<select id="selectIgnoreList" resultType="com.ruoyi.ibs.grid.domain.vo.IgnoreVo">
select
a.id as id,
a.update_time as update_time,
b.anchor_name as anchorName,
b.belong_business as belongBusiness,
a.source as source,
a.type as type,
a.address_name as addressName,
a.address_remark as addressRemark,
a.address as address,
a.address_now as addressNow
from ibs_anchor_address a
left join ibs_anchor b on a.anchor_id = b.legal_id
where a.address_status = 2
and a.delete_status = 0
and b.delete_status = 0
and b.cust_type = #{custType}
<if test=" isHead == false">and b.update_org = #{deptId}</if>
<if test=" custAddressStatus != null and custAddressStatus != ''">and a.cust_address_status =
#{custAddressStatus}
</if>
<if test=" custStatus != null and custStatus != ''">and a.cust_status = #{custStatus}</if>
</select>
<select id="selectIgnoreList_COUNT" resultType="Long">
select 999999999
</select>
<update id="delIgnore">
update ibs_anchor_address set delete_status = 1 where id = #{id}
</update>
<update id="delAddressByLegalId">
update ibs_anchor_address set delete_status = 1 where anchor_id = #{legalId}
</update>
<update id="delAnchorByLegalId">
update ibs_anchor set delete_status = 1 where legal_id = #{legalId}
</update>
<update id="delAnchor">
update ibs_anchor set delete_status = 1 where id = #{id}
</update>
<select id="selectAnchorDetail" resultType="com.ruoyi.ibs.grid.domain.vo.AnchorDetail">
select
id,
legal_id,
anchor_name,
cust_type,
belong_business,
anchor_remark
from ibs_anchor where id = #{anchorid}
</select>
<select id="selectAnchorAddressList" resultType="com.ruoyi.ibs.grid.domain.vo.AddressDetail">
select
a.id as id,
a.address_name as addressName,
a.address as address,
a.source as source,
a.longitude as longitude,
a.latitude as latitude
from ibs_anchor_address a
left join ibs_anchor b on a.anchor_id = b.legal_id
where b.id = #{anchorid}
and a.delete_status = 0
and a.address_status = 1
</select>
<select id="selectCustAddressList" resultType="com.ruoyi.ibs.grid.domain.vo.AddressDetail">
select
a.id as id,
a.address_name as addressName,
a.address as address,
a.source as source,
a.longitude as longitude,
a.latitude as latitude
from ibs_anchor_address a
left join ibs_anchor b on a.anchor_id = b.legal_id
where b.legal_id = #{legalId}
and a.delete_status = 0
and a.address_status = 1
</select>
<select id="selectAnchorAddressListByCustId" resultType="com.ruoyi.ibs.grid.domain.vo.AddressDetail">
select a.id as id,
a.address_name as addressName,
a.address as address,
a.source as source,
a.longitude as longitude,
a.latitude as latitude
from ibs_anchor_address a
left join ibs_anchor b on a.anchor_id = b.legal_id
where b.cust_id = #{custId}
and a.delete_status = 0
and a.address_status = 1
</select>
<update id="reAudit">
update ibs_anchor_address set address_status = 0 where id = #{id}
</update>
<update id="setIgnore">
update ibs_anchor_address set address_status = 2 where id = #{id}
</update>
<update id="updateAnchor">
update ibs_anchor
set
anchor_name = #{anchorName},
anchor_remark = #{anchorRemark},
belong_business = #{belongBusiness},
cust_type = #{custType}
where legal_id = #{legalId}
</update>
<update id="updateAnchor2">
update ibs_anchor
set
address_id = #{addressid}
where legal_id = #{legalId}
</update>
<select id="selectAddressDetailById" resultType="com.ruoyi.ibs.grid.domain.vo.AddressDetail">
select
id,
address_name,
address,
source,
longitude,
latitude
from ibs_anchor_address
where id = #{id}
</select>
<select id="selectChangeAnchor" resultType="java.lang.String">
select
a.id as id
from ibs_anchor_address a
left join ibs_anchor b on a.anchor_id = b.legal_id
where a.address_status = 0
and a.delete_status = 0
and b.delete_status = 0
and b.cust_type = #{custType}
<if test=" isHead == false ">and a.update_by = #{userid}</if>
</select>
<select id="selectLaLu" resultType="com.ruoyi.ibs.grid.domain.vo.LaLuVo">
select b.latitude as lat,b.longitude as lng from ibs_anchor a
left join ibs_anchor_address b on a.address_id = b.id
where cust_id = #{custId}
and a.delete_status = 0
</select>
<select id="selectBusinessCust" resultType="java.lang.String">
select id from cust_info_business where social_credit_code = #{legal_id}
</select>
<select id="selectMerchantCust" resultType="java.lang.String">
select id from cust_info_merchant where social_credit_code = #{legal_id}
</select>
<select id="selectRetailCust" resultType="java.lang.String">
select id from cust_info_retail where cust_idc = #{legal_id}
</select>
<update id="updateAnchorByCust">
update ibs_anchor
set
anchor_name = #{anchorName},
belong_business = #{belongBusiness}
where legal_id = #{legalId}
</update>
<select id="selectCountCust" resultType="java.lang.Long">
select count(*) from ibs_anchor
where delete_status = 0
and cust_status = 1
and cust_type = #{custType}
<if test=" isHead == false ">and update_by = #{userid}</if>
</select>
<select id="selectCountCustAddress" resultType="java.lang.Long">
select count(*) from ibs_anchor
where delete_status = 0
and cust_address_status = 1
and cust_type = #{custType}
<if test=" isHead == false ">and update_by = #{userid}</if>
</select>
</mapper>

View File

@@ -0,0 +1,373 @@
<?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.CampaignCountMapper">
<resultMap type="CampaignCount" id="CampaignCountResult">
<result property="dt" column="dt" />
<result property="deptId" column="dept_id" />
<result property="deptName" column="dept_name" />
<result property="userId" column="user_id" />
<result property="userName" column="user_name" />
<result property="createCampNumYear" column="create_camp_num_year" />
<result property="pushCampNumYear" column="push_camp_num_year" />
<result property="otherCampNumYear" column="other_camp_num_year" />
<result property="createCampNumMonth" column="create_camp_num_month" />
<result property="pushCampNumMonth" column="push_camp_num_month" />
<result property="otherCampNumMonth" column="other_camp_num_month" />
<result property="createCampNumWeek" column="create_camp_num_week" />
<result property="pushCampNumWeek" column="push_camp_num_week" />
<result property="otherCampNumWeek" column="other_camp_num_week" />
<result property="sumType" column="sum_type" />
<result property="custType" column="cust_type" />
</resultMap>
<resultMap type="VisitCampaignCount" id="VisitCampaignCountResult">
<result property="id" column="id" />
<result property="campaignId" column="campaign_id" />
<result property="custNum" column="cust_num" />
<result property="pushSuccessNum" column="push_success_num" />
<result property="allocateRate" column="allocate_rate" />
<result property="issuedNum" column="issued_num" />
<result property="claimNum" column="claim_num" />
<result property="validVisitNum" column="valid_visit_num" />
<result property="visitRate" column="visit_rate" />
<result property="loanSignRate" column="loan_sign_rate" />
<result property="increaseDepositAmount" column="increase_deposit_amount" />
<result property="pushClientId" column="push_client_id" />
<result property="custType" column="cust_type" />
<result property="dispatchNum" column="dispatch_num" />
<result property="userName" column="user_name" />
</resultMap>
<resultMap type="VisitCampaignComment" id="VisitCampaignCommentResult">
<result property="id" column="id" />
<result property="campaignId" column="campaign_id" />
<result property="deptId" column="dept_id" />
<result property="userId" column="user_id" />
<result property="nickName" column="nick_name" />
<result property="comment" column="comment" />
<result property="outletsId" column="outlets_id" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
</resultMap>
<sql id="selectCampaignCountVo">
select dt, dept_id, dept_name, user_id, user_name, create_camp_num_year, push_camp_num_year, other_camp_num_year, create_camp_num_month, push_camp_num_month, other_camp_num_month, create_camp_num_week, push_camp_num_week, other_camp_num_week, sum_type, cust_type from campaign_count
</sql>
<select id="selectCampaignCountList" parameterType="CampaignCount" resultMap="CampaignCountResult">
select dt, dept_id, dept_name, user_id, user_name, create_camp_num_year, push_camp_num_year, other_camp_num_year, create_camp_num_month, push_camp_num_month, other_camp_num_month, create_camp_num_week, push_camp_num_week, other_camp_num_week, sum_type, cust_type
from campaign_count
where 1=1
<if test="sumType == 0 or sumType == 1 or sumType == 2 or sumType == 3">
and dept_id = concat(left(#{deptId}, 3), '000')
</if>
<if test="sumType == 5 ">
and dept_id = #{deptId}
</if>
<if test="sumType == -1 ">
and dept_id = #{userId}
</if>
<if test="dt != null and dt != ''"> and dt = #{dt}</if>
<if test="custType != null "> and cust_type = #{custType}</if>
</select>
<select id="selectVisitCampaignCountList" parameterType="VisitCampaignCount" resultMap="VisitCampaignCountResult">
select vc.id, vc.campaign_id, vc.cust_num, vc.push_success_num, vc.allocate_rate, vc.issued_num, vc.claim_num, vc.valid_visit_num, vc.visit_rate, vc.loan_sign_rate, vc.increase_deposit_amount, vc.push_client_id, vc.cust_type,vc.dispatch_num,vc.visited_num,
sc.campaign_name,sc.start_time,sc.end_time,sc.claim_start_time,sc.claim_end_time,sc.claim_type,sc.create_role
from visit_campaign_count vc
left join sys_campaign sc on vc.campaign_id = sc.campaign_id
where vc.dept_type = '0'
<if test="campaignId != null and campaignId != ''"> and vc.campaign_id = #{campaignId}</if>
<if test="campaignName != null and campaignName != ''"> AND sc.campaign_name like concat('%', #{campaignName}, '%')</if>
<if test="startTime != null "> and sc.start_time &gt;= date_format(#{startTime}, '%Y-%m-%d')</if>
<if test="endTime != null "> and sc.end_time &lt;= date_format(#{endTime}, '%Y-%m-%d')</if>
<if test="deptId != null "> and sc.dept_id = #{deptId}</if>
<if test="custType != null "> and vc.cust_type = #{custType}</if>
<if test="createRole != null "> and sc.create_role = #{createRole}</if>
</select>
<select id="selectVisitCampaignBranchList" parameterType="VisitCampaignCount" resultMap="VisitCampaignCountResult">
select distinct vc.id, vc.campaign_id, vc.cust_num, vc.push_success_num, vc.allocate_rate, vc.issued_num, vc.claim_num, vc.valid_visit_num, vc.visit_rate, vc.loan_sign_rate, vc.increase_deposit_amount, vc.push_client_id, vc.cust_type,vc.dispatch_num,vc.visited_num,
sc.campaign_name,sc.start_time,sc.end_time,sc.claim_start_time,sc.claim_end_time,sc.claim_type,sc.create_role,vc.allocate_status as org_distribute_status,
vc.dept_id,dep.dept_name,
CASE
WHEN sc.create_role = '5' THEN '我创建的'
ELSE '总行推送的'
END AS campsource
from visit_campaign_count vc
left join sys_campaign sc on vc.campaign_id = sc.campaign_id
left join sys_dept dep on vc.dept_id = dep.dept_id
left join (
select distinct campaign_id,org_distribute_status,dept_id from sys_campaign_group_customer as scgc
where ((scgc.push_user_level = 'branch' or (scgc.push_user_level = 'head' and scgc.user_id is null)) or scgc.create_role = '5')
<if test="campaignId != null and campaignId != ''"> and scgc.campaign_id = #{campaignId}</if>
and scgc.push_status = '1'
)scgc2 on scgc2.campaign_id = vc.campaign_id and scgc2.dept_id=vc.dept_id
where
vc.dept_type = '1'
<if test="campaignId != null and campaignId != ''"> and vc.campaign_id = #{campaignId}</if>
<if test="campaignName != null and campaignName != ''"> AND sc.campaign_name like concat('%', #{campaignName}, '%')</if>
<if test="deptId != null "> and vc.dept_id = #{deptId}</if>
<if test="startTime != null "> and sc.start_time &gt;= date_format(#{startTime}, '%Y-%m-%d')</if>
<if test="endTime != null "> and sc.end_time &lt;= date_format(#{endTime}, '%Y-%m-%d')</if>
<if test="custType != null "> and vc.cust_type = #{custType}</if>
<choose>
<when test="campsource == '我创建的'">
and sc.create_role = '5'
</when>
<when test="campsource == '总行推送的'">
and sc.create_role != '5'
</when>
</choose>
</select>
<select id="selectVisitCampaignCountCheckList" parameterType="VisitCampaignCount" resultMap="VisitCampaignCountResult">
select distinct vc.id, vc.campaign_id, vc.cust_num, vc.push_success_num, vc.allocate_rate, vc.issued_num, vc.claim_num, vc.valid_visit_num, vc.visit_rate, vc.loan_sign_rate, vc.increase_deposit_amount, vc.push_client_id, vc.cust_type,vc.dispatch_num,
sc.campaign_name,sc.start_time,sc.end_time,sc.claim_start_time,sc.claim_end_time,sc.claim_type,sc.create_role,vc.allocate_status as org_distribute_status,
vc.dept_id,
case when substr(dep.dept_id,-3) = '000' then ''
else dep.dept_name end as dept_name,
CASE
WHEN sc.create_role = '5' THEN '我创建的'
ELSE '总行推送的'
END AS campsource
from visit_campaign_count vc
left join sys_campaign sc on vc.campaign_id = sc.campaign_id
left join sys_dept dep on vc.dept_id = dep.dept_id
left join (
select distinct campaign_id,org_distribute_status,dept_id from sys_campaign_group_customer as scgc
where ((scgc.push_user_level = 'branch' or (scgc.push_user_level = 'head' and scgc.user_id is null)) or scgc.create_role = '5')
<if test="campaignId != null and campaignId != ''"> and scgc.campaign_id = #{campaignId}</if>
and scgc.push_status = '1'
)scgc2 on scgc2.campaign_id = vc.campaign_id and scgc2.dept_id=vc.dept_id
where
vc.dept_type = '1'
<if test="campaignId != null and campaignId != ''"> and vc.campaign_id = #{campaignId}</if>
<if test="campaignName != null and campaignName != ''"> AND sc.campaign_name like concat('%', #{campaignName}, '%')</if>
<if test="startTime != null "> and sc.start_time = #{startTime}</if>
<if test="endTime != null "> and sc.end_time = #{endTime}</if>
<if test="custType != null "> and vc.cust_type = #{custType}</if>
<choose>
<when test="campsource == '我创建的'">
and sc.create_role = '5'
</when>
<when test="campsource == '总行推送的'">
and sc.create_role != '5'
</when>
</choose>
</select>
<select id="selectOutletList" parameterType="VisitCampaignCount" resultMap="VisitCampaignCountResult">
select
distinct vc.id,vc.campaign_id,vc.cust_num,vc.push_success_num,vc.allocate_rate,vc.issued_num,vc.claim_num,vc.valid_visit_num,vc.visit_rate,vc.loan_sign_rate,vc.increase_deposit_amount,vc.push_client_id,vc.cust_type,vc.dispatch_num,vc.visited_num,
sc.campaign_name,sc.start_time,sc.end_time,sc.claim_start_time,sc.claim_end_time,sc.claim_type,sc.create_role,su.user_name as user_id,
case
when dep2.dept_type = 'head' then dep.dept_id
when dep2.dept_type is null then dep.dept_id
when dep2.dept_type ='bureau' then dep.dept_id
else dep2.dept_id
end as dept_id,
case
when dep2.dept_type = 'head' then ''
when dep2.dept_type is null then ''
when dep2.dept_type ='bureau' then ''
else dep.dept_name
end as outlets,
case
when dep2.dept_type = 'head' then ''
when dep2.dept_type is null then ''
when dep2.dept_type ='bureau' then ''
else dep.dept_id
end as outlets_id,
case
when dep2.dept_type = 'head' then dep.dept_name
else dep2.dept_name
end as dept_name,
concat( su.nick_name, '-', su.user_name ) as nick_name,
case
when sc.create_role = '5' then '支行下发的'
else '总行下发的'
end as campsource
from
visit_campaign_count vc left join sys_campaign sc on
vc.campaign_id = sc.campaign_id left join sys_user su on
vc.dept_id = su.user_name
left join sys_dept dep on vc.dept_id = dep.dept_id
left join sys_dept dep2 on dep.parent_id = dep2.dept_id
where
vc.dept_type = '2'
<if test="campaignId != null and campaignId != ''"> and vc.campaign_id = #{campaignId}</if>
<choose>
<when test="deptId != null and deptId.toString().endsWith('000')">
AND dep.dept_id = #{deptId}
</when>
<when test="deptId != null">
AND (dep.dept_id = #{deptId} OR dep2.dept_id = #{deptId})
</when>
</choose>
<if test="campaignName != null and campaignName != ''"> AND sc.campaign_name like concat('%', #{campaignName}, '%')</if>
<if test="startTime != null "> and sc.start_time &gt;= date_format(#{startTime}, '%Y-%m-%d')</if>
<if test="endTime != null "> and sc.end_time &lt;= date_format(#{endTime}, '%Y-%m-%d')</if>
<if test="custType != null "> and vc.cust_type = #{custType}</if>
<choose>
<when test="campsource == '支行下发的'">
and sc.create_role = '5'
</when>
<when test="campsource == '总行下发的'">
and sc.create_role != '5'
</when>
</choose>
</select>
<select id="selectPersonList" parameterType="VisitCampaignCount" resultMap="VisitCampaignCountResult">
select
distinct vc.id,vc.campaign_id,vc.cust_num,vc.push_success_num,vc.allocate_rate,vc.issued_num,vc.claim_num,vc.valid_visit_num,vc.visit_rate,vc.loan_sign_rate,vc.increase_deposit_amount,vc.push_client_id,vc.cust_type,vc.dispatch_num,vc.visited_num,
vc.start_time,vc.end_time,sc.claim_type,su.user_name as user_id,
case when left(vc.campaign_id,7)='appoint' then '预约任务' else sc.campaign_name end as campaign_name,
case when left(vc.campaign_id,7)='appoint' then vc.start_time else sc.claim_start_time end as claim_start_time,
case when left(vc.campaign_id,7)='appoint' then vc.end_time else sc.claim_end_time end as claim_end_time,
case when left(vc.campaign_id,7)='appoint' then '-1' else sc.create_role end as create_role ,
case
when dep2.dept_type = 'head' then dep.dept_id
else dep2.dept_id
end as dept_id,
case
when dep2.dept_type = 'head' then ''
else dep.dept_name
end as outlets,
case
when dep2.dept_type = 'head' then dep.dept_name
else dep2.dept_name
end as dept_name,
concat( su.nick_name, '-', su.user_name ) as nick_name,
case
when sc.create_role = '5' then '支行下发的'
else '总行下发的'
end as campsource
from
visit_campaign_count vc left join sys_campaign sc on
vc.campaign_id = sc.campaign_id left join sys_user su on
vc.dept_id = su.user_name
left join sys_dept dep on su.dept_id = dep.dept_id
left join sys_dept dep2 on dep.parent_id = dep2.dept_id
where
vc.dept_type = '3'
<if test="campaignId != null and campaignId != ''"> and vc.campaign_id = #{campaignId}</if>
<if test="campaignName != null and campaignName != ''"> AND sc.campaign_name like concat('%', #{campaignName}, '%')</if>
<choose>
<when test="outletsId != null">
AND (dep.dept_id = #{outletsId} OR dep2.dept_id = #{outletsId})
</when>
<otherwise>
<if test="deptId != null and personType == 'branch' and deptId.toString().endsWith('000')">
AND dep.dept_id = #{deptId}
</if>
<if test="deptId != null and personType == 'branch'">
AND (dep.dept_id = #{deptId} OR dep2.dept_id = #{deptId})
</if>
<if test="deptId != null and personType == 'outlet'">
AND (dep.dept_id = #{deptId})
</if>
</otherwise>
</choose>
<if test="userId != null " >and vc.dept_id =#{userId} </if>
<if test="startTime != null "> and sc.start_time &gt;= date_format(#{startTime}, '%Y-%m-%d')</if>
<if test="endTime != null "> and sc.end_time &lt;= date_format(#{endTime}, '%Y-%m-%d')</if>
<if test="custType != null "> and vc.cust_type = #{custType}</if>
<choose>
<when test="campsource == '支行下发的'">
and sc.create_role = '5'
</when>
<when test="campsource == '总行下发的'">
and sc.create_role != '5'
</when>
</choose>
</select>
<select id="selectCommentList" parameterType="VisitCampaignComment" resultMap="VisitCampaignCommentResult">
select id, campaign_id, dept_id, user_id, nick_name, comment, outlets_id, create_by, create_time, update_by, update_time from visit_campaign_comment
<where>
<if test="campaignId != null and campaignId != ''"> and campaign_id = #{campaignId}</if>
<if test="deptId != null "> and dept_id = #{deptId}</if>
<if test="userId != null "> and user_id = #{userId}</if>
<if test="nickName != null and nickName != ''"> and nick_name like concat('%', #{nickName}, '%')</if>
<if test="comment != null and comment != ''"> and comment = #{comment}</if>
<if test="outletsId != null "> and outlets_id = #{outletsId}</if>
</where>
</select>
<insert id="insertVisitCampaignComment" parameterType="VisitCampaignComment" useGeneratedKeys="true" keyProperty="id">
insert into visit_campaign_comment
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="campaignId != null">campaign_id,</if>
<if test="deptId != null">dept_id,</if>
<if test="userId != null">user_id,</if>
<if test="nickName != null">nick_name,</if>
<if test="comment != null">comment,</if>
<if test="outletsId != null">outlets_id,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="campaignId != null">#{campaignId},</if>
<if test="deptId != null">#{deptId},</if>
<if test="userId != null">#{userId},</if>
<if test="nickName != null">#{nickName},</if>
<if test="comment != null">#{comment},</if>
<if test="outletsId != null">#{outletsId},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
</trim>
</insert>
<update id="updateCampaignCount" parameterType="CampaignCount">
update campaign_count
<trim prefix="SET" suffixOverrides=",">
<if test="deptId != null">dept_id = #{deptId},</if>
<if test="deptName != null">dept_name = #{deptName},</if>
<if test="userId != null">user_id = #{userId},</if>
<if test="userName != null">user_name = #{userName},</if>
<if test="createCampNumYear != null">create_camp_num_year = #{createCampNumYear},</if>
<if test="pushCampNumYear != null">push_camp_num_year = #{pushCampNumYear},</if>
<if test="otherCampNumYear != null">other_camp_num_year = #{otherCampNumYear},</if>
<if test="createCampNumMonth != null">create_camp_num_month = #{createCampNumMonth},</if>
<if test="pushCampNumMonth != null">push_camp_num_month = #{pushCampNumMonth},</if>
<if test="otherCampNumMonth != null">other_camp_num_month = #{otherCampNumMonth},</if>
<if test="createCampNumWeek != null">create_camp_num_week = #{createCampNumWeek},</if>
<if test="pushCampNumWeek != null">push_camp_num_week = #{pushCampNumWeek},</if>
<if test="otherCampNumWeek != null">other_camp_num_week = #{otherCampNumWeek},</if>
<if test="sumType != null">sum_type = #{sumType},</if>
<if test="custType != null">cust_type = #{custType},</if>
</trim>
where dt = #{dt}
</update>
<delete id="deleteCampaignCountByDt" parameterType="String">
delete from campaign_count where dt = #{dt}
</delete>
<delete id="deleteCampaignCountByDts" parameterType="String">
delete from campaign_count where dt in
<foreach item="dt" collection="array" open="(" separator="," close=")">
#{dt}
</foreach>
</delete>
</mapper>

View File

@@ -0,0 +1,79 @@
<?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.CorporateShareholderMapper">
<resultMap type="CorporateShareholder" id="CorporateShareholderResult">
<result property="socialCreditCode" column="social_credit_code" />
<result property="custType" column="cust_type" />
<result property="percent" column="percent" />
<result property="name" column="name" />
<result property="custIdc" column="cust_idc" />
<result property="customerType" column="customer_type" />
<result property="perCustType" column="per_cust_type" />
</resultMap>
<sql id="selectCorporateShareholderVo">
select social_credit_code, cust_type, percent, name, cust_idc, customer_type,per_cust_type from corporate_shareholder
</sql>
<select id="selectCorporateShareholderList" parameterType="CorporateShareholder" resultMap="CorporateShareholderResult">
<include refid="selectCorporateShareholderVo"/>
<where>
<if test="socialCreditCode != null and socialCreditCode != ''"> and social_credit_code = #{socialCreditCode}</if>
<if test="custType != null and custType != ''"> and cust_type = #{custType}</if>
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
<if test="custIdc != null and custIdc != ''"> and cust_idc = #{custIdc}</if>
<if test="customerType != null and customerType != ''"> and customer_type = #{customerType}</if>
</where>
</select>
<select id="selectCorporateShareholderBySocialCreditCode" parameterType="String" resultMap="CorporateShareholderResult">
<include refid="selectCorporateShareholderVo"/>
where social_credit_code = #{socialCreditCode}
</select>
<insert id="insertCorporateShareholder" parameterType="CorporateShareholder">
insert into corporate_shareholder
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="socialCreditCode != null">social_credit_code,</if>
<if test="custType != null">cust_type,</if>
<if test="percent != null">percent,</if>
<if test="name != null">name,</if>
<if test="custIdc != null">cust_idc,</if>
<if test="customerType != null">customer_type,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="socialCreditCode != null">#{socialCreditCode},</if>
<if test="custType != null">#{custType},</if>
<if test="percent != null">#{percent},</if>
<if test="name != null">#{name},</if>
<if test="custIdc != null">#{custIdc},</if>
<if test="customerType != null">#{customerType},</if>
</trim>
</insert>
<update id="updateCorporateShareholder" parameterType="CorporateShareholder">
update corporate_shareholder
<trim prefix="SET" suffixOverrides=",">
<if test="custType != null">cust_type = #{custType},</if>
<if test="percent != null">percent = #{percent},</if>
<if test="name != null">name = #{name},</if>
<if test="custIdc != null">cust_idc = #{custIdc},</if>
<if test="customerType != null">customerType = #{customerType},</if>
</trim>
where social_credit_code = #{socialCreditCode}
</update>
<delete id="deleteCorporateShareholderBySocialCreditCode" parameterType="String">
delete from corporate_shareholder where social_credit_code = #{socialCreditCode}
</delete>
<delete id="deleteCorporateShareholderBySocialCreditCodes" parameterType="String">
delete from corporate_shareholder where social_credit_code in
<foreach item="socialCreditCode" collection="array" open="(" separator="," close=")">
#{socialCreditCode}
</foreach>
</delete>
</mapper>

View File

@@ -0,0 +1,128 @@
<?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.CustDeptUserCmpmMapper">
<resultMap type="CustDeptUserCmpm" id="CustDeptUserCmpmResult">
<result property="id" column="id" />
<result property="deptId" column="dept_id" />
<result property="deptName" column="dept_name" />
<result property="outlets" column="outlets" />
<result property="outletsId" column="outlets_id" />
<result property="userId" column="user_id" />
<result property="userName" column="user_name" />
<result property="nickName" column="nick_name" />
<result property="custId" column="cust_id" />
<result property="custType" column="cust_type" />
<result property="custName" column="cust_name" />
<result property="custIdc" column="cust_idc" />
<result property="codeNoLevel1" column="code_no_level1" />
<result property="codeValueLevel1" column="code_value_level1" />
<result property="codeNoLevel2" column="code_no_level2" />
<result property="codeValueLevel2" column="code_value_level2" />
</resultMap>
<sql id="selectCustDeptUserCmpmVo">
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
</sql>
<select id="selectCustDeptUserCmpmList" parameterType="CustDeptUserCmpm" resultMap="CustDeptUserCmpmResult">
<include refid="selectCustDeptUserCmpmVo"/>
<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>
<select id="selectCustDeptUserCmpmById" parameterType="Long" resultMap="CustDeptUserCmpmResult">
<include refid="selectCustDeptUserCmpmVo"/>
where id = #{id}
</select>
<insert id="insertCustDeptUserCmpm" parameterType="CustDeptUserCmpm" useGeneratedKeys="true" keyProperty="id">
insert into cust_dept_user_cmpm
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="deptId != null">dept_id,</if>
<if test="deptName != null">dept_name,</if>
<if test="outlets != null">outlets,</if>
<if test="outletsId != null">outlets_id,</if>
<if test="userId != null">user_id,</if>
<if test="userName != null">user_name,</if>
<if test="nickName != null">nick_name,</if>
<if test="custId != null">cust_id,</if>
<if test="custType != null">cust_type,</if>
<if test="custName != null">cust_name,</if>
<if test="custIdc != null">cust_idc,</if>
<if test="codeNoLevel1 != null">code_no_level1,</if>
<if test="codeValueLevel1 != null">code_value_level1,</if>
<if test="codeNoLevel2 != null">code_no_level2,</if>
<if test="codeValueLevel2 != null">code_value_level2,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="deptId != null">#{deptId},</if>
<if test="deptName != null">#{deptName},</if>
<if test="outlets != null">#{outlets},</if>
<if test="outletsId != null">#{outletsId},</if>
<if test="userId != null">#{userId},</if>
<if test="userName != null">#{userName},</if>
<if test="nickName != null">#{nickName},</if>
<if test="custId != null">#{custId},</if>
<if test="custType != null">#{custType},</if>
<if test="custName != null">#{custName},</if>
<if test="custIdc != null">#{custIdc},</if>
<if test="codeNoLevel1 != null">#{codeNoLevel1},</if>
<if test="codeValueLevel1 != null">#{codeValueLevel1},</if>
<if test="codeNoLevel2 != null">#{codeNoLevel2},</if>
<if test="codeValueLevel2 != null">#{codeValueLevel2},</if>
</trim>
</insert>
<update id="updateCustDeptUserCmpm" parameterType="CustDeptUserCmpm">
update cust_dept_user_cmpm
<trim prefix="SET" suffixOverrides=",">
<if test="deptId != null">dept_id = #{deptId},</if>
<if test="deptName != null">dept_name = #{deptName},</if>
<if test="outlets != null">outlets = #{outlets},</if>
<if test="outletsId != null">outlets_id = #{outletsId},</if>
<if test="userId != null">user_id = #{userId},</if>
<if test="userName != null">user_name = #{userName},</if>
<if test="nickName != null">nick_name = #{nickName},</if>
<if test="custId != null">cust_id = #{custId},</if>
<if test="custType != null">cust_type = #{custType},</if>
<if test="custName != null">cust_name = #{custName},</if>
<if test="custIdc != null">cust_idc = #{custIdc},</if>
<if test="codeNoLevel1 != null">code_no_level1 = #{codeNoLevel1},</if>
<if test="codeValueLevel1 != null">code_value_level1 = #{codeValueLevel1},</if>
<if test="codeNoLevel2 != null">code_no_level2 = #{codeNoLevel2},</if>
<if test="codeValueLevel2 != null">code_value_level2 = #{codeValueLevel2},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteCustDeptUserCmpmById" parameterType="Long">
delete from cust_dept_user_cmpm where id = #{id}
</delete>
<delete id="deleteCustDeptUserCmpmByIds" parameterType="String">
delete from cust_dept_user_cmpm where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@@ -0,0 +1,139 @@
<?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.CustDeptUserGridMapper">
<resultMap type="CustDeptUserGrid" id="CustDeptUserGridResult">
<result property="id" column="id"/>
<result property="deptId" column="dept_id"/>
<result property="userId" column="user_id"/>
<result property="userName" column="user_name"/>
<result property="gridId" column="grid_id"/>
<result property="gridName" column="grid_name"/>
<result property="custId" column="cust_id"/>
<result property="custIdc" column="cust_idc"/>
<result property="custName" column="cust_name"/>
<result property="custPhone" column="cust_phone"/>
<result property="deptName" column="dept_name"/>
<result property="gridName2" column="grid_name2"/>
<result property="outlets" column="outlets"/>
<result property="outletsId" column="outlets_id"/>
<result property="tellerId" column="teller_id"/>
<result property="opsDept" column="ops_dept"/>
</resultMap>
<sql id="selectCustDeptUserGridVo">
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,
outlets_id,
teller_id,
ops_dept
from cust_dept_user_grid
</sql>
<select id="selectCustDeptUserGridList" parameterType="CustDeptUserGrid" resultMap="CustDeptUserGridResult">
<include refid="selectCustDeptUserGridVo"/>
<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="selectCustDeptUserGridById" parameterType="Long" resultMap="CustDeptUserGridResult">
<include refid="selectCustDeptUserGridVo"/>
where id = #{id}
</select>
<insert id="insertCustDeptUserGrid" parameterType="CustDeptUserGrid" useGeneratedKeys="true" keyProperty="id">
insert into cust_dept_user_grid
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="deptId != null">dept_id,</if>
<if test="userId != null">user_id,</if>
<if test="userName != null">user_name,</if>
<if test="gridId != null">grid_id,</if>
<if test="gridName != null">grid_name,</if>
<if test="custId != null">cust_id,</if>
<if test="custIdc != null">cust_idc,</if>
<if test="custName != null">cust_name,</if>
<if test="custPhone != null">cust_phone,</if>
<if test="deptName != null">dept_name,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="deptId != null">#{deptId},</if>
<if test="userId != null">#{userId},</if>
<if test="userName != null">#{userName},</if>
<if test="gridId != null">#{gridId},</if>
<if test="gridName != null">#{gridName},</if>
<if test="custId != null">#{custId},</if>
<if test="custIdc != null">#{custIdc},</if>
<if test="custName != null">#{custName},</if>
<if test="custPhone != null">#{custPhone},</if>
<if test="deptName != null">#{deptName},</if>
</trim>
</insert>
<update id="updateCustDeptUserGrid" parameterType="CustDeptUserGrid">
update cust_dept_user_grid
<trim prefix="SET" suffixOverrides=",">
<if test="deptId != null">dept_id = #{deptId},</if>
<if test="userId != null">user_id = #{userId},</if>
<if test="userName != null">user_name = #{userName},</if>
<if test="gridId != null">grid_id = #{gridId},</if>
<if test="gridName != null">grid_name = #{gridName},</if>
<if test="custId != null">cust_id = #{custId},</if>
<if test="custIdc != null">cust_idc = #{custIdc},</if>
<if test="custName != null">cust_name = #{custName},</if>
<if test="custPhone != null">cust_phone = #{custPhone},</if>
<if test="deptName != null">dept_name = #{deptName},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteCustDeptUserGridById" parameterType="Long">
delete
from cust_dept_user_grid
where id = #{id}
</delete>
<delete id="deleteCustDeptUserGridByIds" parameterType="String">
delete from cust_dept_user_grid where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<select id="selectCustDeptUserGridListByCustIds" parameterType="String" resultMap="CustDeptUserGridResult">
<include refid="selectCustDeptUserGridVo"/>
where cust_id in
<foreach item="id" collection="custIds" open="(" separator="," close=")">
#{id}
</foreach>
</select>
</mapper>

View File

@@ -0,0 +1,810 @@
<?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.CustInfoMerchantMapper">
<resultMap type="CustInfoMerchant" id="CustInfoMerchantResult">
<result property="id" column="id" />
<result property="custType" column="cust_type" />
<result property="custTag" column="cust_tag" />
<result property="custScale" column="cust_scale" />
<result property="custName" column="cust_name" />
<result property="lpName" column="lp_name" />
<result property="custPhone" column="cust_phone" />
<result property="custId" column="cust_id" />
<result property="custIsn" column="cust_isn" />
<result property="custCapital" column="cust_capital" />
<result property="custLocation" column="cust_location" />
<result property="loanTag" column="loan_tag" />
<result property="status" column="status" />
<result property="belongBranchId" column="belong_branch_id" />
<result property="belongBranchName" column="belong_branch_name" />
<result property="belongOutletId" column="belong_outlet_id" />
<result property="belongOutletName" column="belong_outlet_name" />
<result property="belongUserId" column="belong_user_id" />
<result property="belongUserName" column="belong_user_name" />
<result property="belongUserNameList" column="belong_user_name_list" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="regionCode" column="region_code" />
<result property="socialCreditCode" column="social_credit_code" />
<result property="tel" column="tel" />
<result property="registerLocation" column="register_location" />
<result property="businessScope" column="business_scope" />
<result property="taxpayerIdentificationNumber" column="taxpayer_identification_number" />
<result property="taxpayerQualification" column="taxpayer_qualification" />
<result property="label" column="label" />
<result property="industry" column="industry" />
<result property="custIdc" column="cust_idc" />
<result property="birthday" column="birthday" />
<result property="custAge" column="cust_age" />
<result property="custGender" column="cust_gender" />
<result property="recordStatus" column="record_status" />
<result property="asset" column="asset" />
<result property="credit" column="credit" />
</resultMap>
<resultMap type="CustInfoMerchant" id="CustInfoMerchantResult2">
<result property="id" column="id" />
<result property="custType" column="cust_type" />
<result property="custTag" column="cust_tag" />
<result property="custScale" column="cust_scale" />
<result property="custName" column="cust_name" />
<result property="lpName" column="lp_name" />
<result property="custPhone" column="cust_phone" />
<result property="custId" column="cust_id" />
<result property="custIsn" column="cust_isn" />
<result property="custCapital" column="cust_capital" />
<result property="custLocation" column="cust_location" />
<result property="loanTag" column="loan_tag" />
<result property="status" column="status" />
<result property="belongBranchId" column="belong_branch_id" />
<result property="belongBranchName" column="dept_name" />
<result property="belongOutletId" column="belong_outlet_id" />
<result property="belongOutletName" column="outlets" />
<result property="belongUserId" column="belong_user_id" />
<result property="belongUserName" column="belong_user_name" />
<result property="belongUserNameList" column="belong_user_name_list" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="regionCode" column="region_code" />
<result property="socialCreditCode" column="social_credit_code" />
<result property="tel" column="tel" />
<result property="registerLocation" column="register_location" />
<result property="businessScope" column="business_scope" />
<result property="taxpayerIdentificationNumber" column="taxpayer_identification_number" />
<result property="taxpayerQualification" column="taxpayer_qualification" />
<result property="label" column="label" />
<result property="industry" column="industry" />
<result property="custIdc" column="cust_idc" />
<result property="birthday" column="birthday" />
<result property="custAge" column="cust_age" />
<result property="custGender" column="cust_gender" />
<result property="actualController" column="actual_controller" />
</resultMap>
<resultMap type="CustManageInfo" id="CustManageInfoResult">
<result property="custId" column="cust_id" />
<result property="custName" column="cust_name" />
<result property="custNo" column="social_credit_code" />
<result property="belongUserId" column="user_name" />
<result property="belongUserName" column="nick_name" />
<result property="custPattern" column="cust_type" />
<result property="regionCode" column="region_code" />
</resultMap>
<sql id="selectCustInfoMerchantVo">
select id, cust_type, cust_tag, cust_scale, cust_name, lp_name, cust_phone, cust_id, cust_isn, cust_capital, cust_location, loan_tag, status, belong_branch_id, belong_branch_name, belong_outlet_id, belong_outlet_name, belong_user_id, belong_user_name, create_by, create_time, update_by, update_time, region_code, social_credit_code, tel, register_location, business_scope, taxpayer_identification_number, taxpayer_qualification,
label, industry, cust_idc, birthday,cust_age,cust_gender,record_status from cust_info_merchant
</sql>
<select id="selectCustInfoMerchantList" parameterType="CustInfoMerchant" resultMap="CustInfoMerchantResult">
<include refid="selectCustInfoMerchantVo"/>
<where>
<if test="custType != null and custType != ''"> and cust_type = #{custType}</if>
<if test="custTag != null and custTag != ''"> and cust_tag = #{custTag}</if>
<if test="custScale != null and custScale != ''"> and cust_scale = #{custScale}</if>
<if test="custName != null and custName != ''"> and cust_name like concat('%', #{custName}, '%')</if>
<if test="lpName != null and lpName != ''"> and lp_name like concat('%', #{lpName}, '%')</if>
<if test="custPhone != null and custPhone != ''"> and cust_phone = #{custPhone}</if>
<if test="custId != null and custId != ''"> and cust_id = #{custId}</if>
<if test="custIsn != null and custIsn != ''"> and cust_isn = #{custIsn}</if>
<if test="custCapital != null and custCapital != ''"> and cust_capital = #{custCapital}</if>
<if test="custLocation != null and custLocation != ''"> and cust_location = #{custLocation}</if>
<if test="loanTag != null and loanTag != ''"> and loan_tag = #{loanTag}</if>
<if test="status != null and status != ''"> and status = #{status}</if>
<if test="belongBranchId != null and belongBranchId != ''"> and belong_branch_id = #{belongBranchId}</if>
<if test="belongBranchName != null and belongBranchName != ''"> and belong_branch_name like concat('%', #{belongBranchName}, '%')</if>
<if test="belongOutletId != null and belongOutletId != ''"> and belong_outlet_id = #{belongOutletId}</if>
<if test="belongOutletName != null and belongOutletName != ''"> and belong_outlet_name like concat('%', #{belongOutletName}, '%')</if>
<if test="belongUserId != null and belongUserId != ''"> and belong_user_id = #{belongUserId}</if>
<if test="belongUserName != null and belongUserName != ''"> and belong_user_name like concat('%', #{belongUserName}, '%')</if>
<if test="regionCode != null and regionCode != ''"> and region_code = #{regionCode}</if>
<if test="socialCreditCode != null and socialCreditCode != ''"> and social_credit_code = #{socialCreditCode}</if>
<if test="tel != null and tel != ''"> and tel = #{tel}</if>
<if test="registerLocation != null and registerLocation != ''"> and register_location = #{registerLocation}</if>
<if test="businessScope != null and businessScope != ''"> and business_scope = #{businessScope}</if>
<if test="taxpayerIdentificationNumber != null and taxpayerIdentificationNumber != ''"> and taxpayer_identification_number = #{taxpayerIdentificationNumber}</if>
<if test="taxpayerQualification != null and taxpayerQualification != ''"> and taxpayer_qualification = #{taxpayerQualification}</if>
<if test="label != null and label != ''"> and label = #{label}</if>
<if test="industry != null and industry != ''"> and industry = #{industry}</if>
<if test="custIdc != null and custIdc != ''"> and cust_idc = #{custIdc}</if>
<if test="birthday != null "> and birthday = #{birthday}</if>
<if test="custAge != null and custAge != ''"> and cust_age = #{custAge}</if>
<if test="custGender != null and custGender != ''"> and cust_gender = #{custGender}</if>
</where>
</select>
<select id="selectCustInfoMerchantListByKeyword" parameterType="String" resultMap="CustInfoMerchantResult">
<include refid="selectCustInfoMerchantVo"/>
<where>
<if test="keyword != null and keyword != ''"> and ( cust_idc like concat('%', #{keyword}, '%') or cust_name like concat('%', #{keyword}, '%')
or cust_phone like concat('%', #{keyword}, '%') or lp_name like concat('%', #{keyword}, '%') )
</if>
</where>
</select>
<select id="selectCustInfoMerchantListByKeywordBranchAndManager" parameterType="String" resultMap="CustInfoMerchantResult">
select distinct a.id, a.cust_name, a.lp_name, a.cust_id, a.social_credit_code,a.cust_phone,a.tel ,a.cust_idc
from cust_info_merchant a
inner join
(select user_id,dept_id,outlets_id,cust_id from cust_dept_user_grid
<where>
<if test="deptId != null and deptId != ''">
and dept_id in (select dept_id from sys_dept where dept_id = #{deptId} or find_in_set(#{deptId},ancestors))
</if>
<if test="outletsId != null and outletsId != ''">
and outlets_id in (select dept_id from sys_dept where dept_id = #{outletsId} or find_in_set(#{outletsId},ancestors))
</if>
<if test="userId != null and userId != ''">
and user_id = #{userId}
</if>
<if test="opsDept != null and opsDept != ''">
and ops_dept = #{opsDept}
</if>
</where>
union all
(select t2.user_id,t2.dept_id,t2.outlets_id,t2.cust_id from cust_dept_user_cmpm t2
<where>
and t2.cust_type = '1'
<if test="deptId != null and deptId != ''">
and t2.dept_id in (select dept_id from sys_dept where dept_id = #{deptId} or find_in_set(#{deptId},ancestors))
</if>
<if test="outletsId != null and outletsId != ''">
and t2.outlets_id in (select dept_id from sys_dept where dept_id = #{outletsId} or find_in_set(#{outletsId},ancestors))
</if>
<if test="userId != null and userId != ''">
and t2.user_id = #{userId}
</if>
</where>
)) b
on a.cust_id = b.cust_id
<where>
<if test="keyword != null and keyword != ''"> and ( a.cust_idc like concat('%', #{keyword}, '%') or a.cust_name like concat('%', #{keyword}, '%')
or a.cust_phone like concat('%', #{keyword}, '%') or a.lp_name like concat('%', #{keyword}, '%'))
</if>
</where>
</select>
<select id="selectCustInfoMerchantById" parameterType="Long" resultMap="CustInfoMerchantResult">
<include refid="selectCustInfoMerchantVo"/>
where id = #{id}
</select>
<insert id="insertCustInfoMerchant" parameterType="CustInfoMerchant" useGeneratedKeys="true" keyProperty="id">
insert into cust_info_merchant
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="custType != null">cust_type,</if>
<if test="custTag != null">cust_tag,</if>
<if test="custScale != null">cust_scale,</if>
<if test="custName != null">cust_name,</if>
<if test="lpName != null">lp_name,</if>
<if test="custPhone != null">cust_phone,</if>
<if test="custId != null">cust_id,</if>
<if test="custIsn != null">cust_isn,</if>
<if test="custCapital != null">cust_capital,</if>
<if test="custLocation != null">cust_location,</if>
<if test="loanTag != null">loan_tag,</if>
<if test="status != null">status,</if>
<if test="belongBranchId != null">belong_branch_id,</if>
<if test="belongBranchName != null">belong_branch_name,</if>
<if test="belongOutletId != null">belong_outlet_id,</if>
<if test="belongOutletName != null">belong_outlet_name,</if>
<if test="belongUserId != null">belong_user_id,</if>
<if test="belongUserName != null">belong_user_name,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="regionCode != null">region_code,</if>
<if test="socialCreditCode != null">social_credit_code,</if>
<if test="tel != null">tel,</if>
<if test="registerLocation != null">register_location,</if>
<if test="businessScope != null">business_scope,</if>
<if test="taxpayerIdentificationNumber != null">taxpayer_identification_number,</if>
<if test="taxpayerQualification != null">taxpayer_qualification,</if>
<if test="label != null">label,</if>
<if test="industry != null">industry,</if>
<if test="custIdc != null">cust_idc,</if>
<if test="birthday != null">birthday,</if>
<if test="custAge != null">cust_age,</if>
<if test="custGender != null">cust_gender,</if>
<if test="recordStatus != null "> record_status ,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="custType != null">#{custType},</if>
<if test="custTag != null">#{custTag},</if>
<if test="custScale != null">#{custScale},</if>
<if test="custName != null">#{custName},</if>
<if test="lpName != null">#{lpName},</if>
<if test="custPhone != null">#{custPhone},</if>
<if test="custId != null">#{custId},</if>
<if test="custIsn != null">#{custIsn},</if>
<if test="custCapital != null">#{custCapital},</if>
<if test="custLocation != null">#{custLocation},</if>
<if test="loanTag != null">#{loanTag},</if>
<if test="status != null">#{status},</if>
<if test="belongBranchId != null">#{belongBranchId},</if>
<if test="belongBranchName != null">#{belongBranchName},</if>
<if test="belongOutletId != null">#{belongOutletId},</if>
<if test="belongOutletName != null">#{belongOutletName},</if>
<if test="belongUserId != null">#{belongUserId},</if>
<if test="belongUserName != null">#{belongUserName},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="regionCode != null">#{regionCode},</if>
<if test="socialCreditCode != null">#{socialCreditCode},</if>
<if test="tel != null">#{tel},</if>
<if test="registerLocation != null">#{registerLocation},</if>
<if test="businessScope != null">#{businessScope},</if>
<if test="taxpayerIdentificationNumber != null">#{taxpayerIdentificationNumber},</if>
<if test="taxpayerQualification != null">#{taxpayerQualification},</if>
<if test="label != null">#{label},</if>
<if test="industry != null">#{industry},</if>
<if test="custIdc != null">#{custIdc},</if>
<if test="birthday != null">#{birthday},</if>
<if test="custAge != null">#{custAge},</if>
<if test="custGender != null">#{custGender},</if>
<if test="recordStatus != null"> #{recordStatus}</if>
</trim>
</insert>
<update id="updateCustInfoMerchant" parameterType="CustInfoMerchant">
update cust_info_merchant
<trim prefix="SET" suffixOverrides=",">
<if test="custType != null">cust_type = #{custType},</if>
<if test="custTag != null">cust_tag = #{custTag},</if>
<if test="custScale != null">cust_scale = #{custScale},</if>
<if test="custName != null">cust_name = #{custName},</if>
<if test="lpName != null">lp_name = #{lpName},</if>
<if test="custPhone != null">cust_phone = #{custPhone},</if>
<if test="custId != null">cust_id = #{custId},</if>
<if test="custIsn != null">cust_isn = #{custIsn},</if>
<if test="custCapital != null">cust_capital = #{custCapital},</if>
<if test="custLocation != null">cust_location = #{custLocation},</if>
<if test="loanTag != null">loan_tag = #{loanTag},</if>
<if test="status != null">status = #{status},</if>
<if test="belongBranchId != null">belong_branch_id = #{belongBranchId},</if>
<if test="belongBranchName != null">belong_branch_name = #{belongBranchName},</if>
<if test="belongOutletId != null">belong_outlet_id = #{belongOutletId},</if>
<if test="belongOutletName != null">belong_outlet_name = #{belongOutletName},</if>
<if test="belongUserId != null">belong_user_id = #{belongUserId},</if>
<if test="belongUserName != null">belong_user_name = #{belongUserName},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="regionCode != null">region_code = #{regionCode},</if>
<if test="socialCreditCode != null">social_credit_code = #{socialCreditCode},</if>
<if test="tel != null">tel = #{tel},</if>
<if test="registerLocation != null">register_location = #{registerLocation},</if>
<if test="businessScope != null">business_scope = #{businessScope},</if>
<if test="taxpayerIdentificationNumber != null">taxpayer_identification_number = #{taxpayerIdentificationNumber},</if>
<if test="taxpayerQualification != null">taxpayer_qualification = #{taxpayerQualification},</if>
<if test="label != null">label = #{label},</if>
<if test="industry != null">industry = #{industry},</if>
<if test="custIdc != null">cust_idc = #{custIdc},</if>
<if test="birthday != null">birthday = #{birthday},</if>
<if test="custAge != null">cust_age = #{custAge},</if>
<if test="custGender != null">cust_gender = #{custGender},</if>
<if test="recordStatus != null and recordStatus != ''"> record_status = #{recordStatus},</if>
<if test="actualController != null">actual_controller = #{actualController},</if>
</trim>
where id = #{id}
</update>
<update id="updateCustInfoMerchantLabel" parameterType="CustInfoMerchant">
update cust_info_merchant
<trim prefix="SET" suffixOverrides=",">
<if test="custType != null and custType != ''">cust_type = #{custType},</if>
<if test="custTag != null and custTag != ''">cust_tag = #{custTag},</if>
<if test="custScale != null and custScale != ''">cust_scale = #{custScale},</if>
<if test="custName != null and custName != ''">cust_name = #{custName},</if>
<if test="lpName != null and lpName != ''">lp_name = #{lpName},</if>
<if test="custPhone != null and custPhone != ''">cust_phone = #{custPhone},</if>
<if test="custId != null and custId != ''">cust_id = #{custId},</if>
<if test="custIsn != null and custIsn != ''">cust_isn = #{custIsn},</if>
<if test="custCapital != null and custCapital != ''">cust_capital = #{custCapital},</if>
<if test="custLocation != null and custLocation != ''">cust_location = #{custLocation},</if>
<if test="loanTag != null and loanTag != ''">loan_tag = #{loanTag},</if>
<if test="status != null and status != ''">status = #{status},</if>
<if test="belongBranchId != null and belongBranchId != ''">belong_branch_id = #{belongBranchId},</if>
<if test="belongBranchName != null and belongBranchName != ''">belong_branch_name = #{belongBranchName},</if>
<if test="belongOutletId != null and belongOutletId != ''">belong_outlet_id = #{belongOutletId},</if>
<if test="belongOutletName != null and belongOutletName != ''">belong_outlet_name = #{belongOutletName},</if>
<if test="belongUserId != null and belongUserId != ''">belong_user_id = #{belongUserId},</if>
<if test="belongUserName != null and belongUserName != ''">belong_user_name = #{belongUserName},</if>
<if test="createBy != null and createBy != ''">create_by = #{createBy},</if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="regionCode != null and regionCode != ''">region_code = #{regionCode},</if>
<if test="socialCreditCode != null and socialCreditCode != ''">social_credit_code = #{socialCreditCode},</if>
<if test="tel != null and tel != ''">tel = #{tel},</if>
<if test="registerLocation != null and registerLocation != ''">register_location = #{registerLocation},</if>
<if test="businessScope != null and businessScope != ''">business_scope = #{businessScope},</if>
<if test="taxpayerIdentificationNumber != null and taxpayerIdentificationNumber != ''">taxpayer_identification_number = #{taxpayerIdentificationNumber},</if>
<if test="taxpayerQualification != null and taxpayerQualification != ''">taxpayer_qualification = #{taxpayerQualification},</if>
<if test="label != null and label != ''">label = #{label},</if>
<if test="industry != null and industry != ''">industry = #{industry},</if>
<if test="custIdc != null and custIdc != ''">cust_idc = #{custIdc},</if>
<if test="custAge != null and custAge != ''">cust_age = #{custAge},</if>
<if test="custGender != null and custGender != ''">cust_gender = #{custGender},</if>
<if test="recordStatus != null and recordStatus != ''"> record_status = #{recordStatus},</if>
<if test="birthday != null ">birthday = #{birthday},</if>
<if test="actualController != null and actualController != ''">actual_controller = #{actualController},</if>
</trim>
where cust_id = #{custId}
</update>
<delete id="deleteCustInfoMerchantById" parameterType="Long">
delete from cust_info_merchant where id = #{id}
</delete>
<delete id="deleteCustInfoMerchantByIds" parameterType="String">
delete from cust_info_merchant where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<select id="selectCustInfoMerchantByCustId" parameterType="String" resultMap="CustInfoMerchantResult">
select * from cust_info_merchant
where cust_id = #{custId}
</select>
<select id="selectCustInfoMerchantBySocialCreditCode" parameterType="String" resultMap="CustInfoMerchantResult">
select * from cust_info_merchant
where social_credit_code = #{socialCreditCode}
</select>
<select id="selectMyCustInfoMerchantList" parameterType="CustInfoBusiness" resultMap="CustInfoMerchantResult2">
SELECT a.id, a.cust_type, a.cust_tag, a.cust_scale, a.cust_name, a.lp_name,
a.cust_phone, a.cust_id, a.cust_isn,
GROUP_CONCAT(b.dept_name SEPARATOR ',') as dept_name,
GROUP_CONCAT(b.outlets SEPARATOR ',') as outlets,
a.cust_idc,
GROUP_CONCAT(b.user_name SEPARATOR ',') as belong_user_name_list
from cust_info_merchant a
<if test="opsDept != null and opsDept != ''">
inner </if>
<if test="opsDept == null or opsDept == ''">
left </if> join
(select user_name,user_id,dept_id,cust_id,dept_name,outlets from
(select concat_ws('-',user_name,teller_id) as user_name,user_id,dept_id,cust_id,dept_name,outlets from cust_dept_user_grid
<where>
<if test="opsDept != null and opsDept != ''">
ops_dept = #{opsDept}</if>
</where>
union
(select '', t2.user_id,t2.dept_id,t2.cust_id,'','' from cust_dept_user_cmpm t2
left join (select cust_id from cust_dept_user_grid
<where>
<if test="opsDept != null and opsDept != ''">
ops_dept = #{opsDept}</if>
</where>
group by cust_id)t1 on t2.cust_id = t1.cust_id
where (t1.cust_id is null or t1.cust_id = '') and t2.cust_type = '1' and t2.dept_id is not null)) f
where 1=1
<if test = "isHead == false">
${params.dataScope}
</if>
) b on a.cust_id = b.cust_id
<where>
<if test = "isHead == false">
b.user_id>0
</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="custName != null and custName != ''"> and a.cust_name like concat('%', #{custName}, '%') </if>
<if test="custType != null and custType != ''"> and a.cust_type = #{custType}</if>
</where>
group by a.cust_id,a.id
limit #{start},#{size}
</select>
<select id="selectMyCustInfoMerchantListHead" parameterType="CustInfoBusiness" resultType="com.ruoyi.ibs.customerselect.domain.CustBaseInfo">
SELECT a.id, a.cust_type, a.cust_tag, a.cust_scale, a.cust_name, a.lp_name,
a.cust_phone, a.cust_id, a.cust_isn,a.asset,a.credit,
a.cust_idc,
a.cust_type,a.cur_bal_d, a.cur_bal_t, a.bal_loan, a.cur_bal_5_bad, a.cur_d_ave,
a.cur_t_ave, a.loan_ave, is_ph, a.is_sx, a.is_yxht, a.is_xyk, a.fshl, a.is_sd, a.etc, a.dian, a.is_black, a.is_bad,
a.is_365zf,a.is_180zf,a.is_90zf,a.is_30zf, a.cust_level
from cust_info_merchant a
<where>
<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="custName != null and custName != ''"> and a.cust_name like concat('%', #{custName}, '%') </if>
<if test="custId != null and custId != ''"> and a.cust_id like concat('%', #{custId}, '%') </if>
<if test="custType != null and custType != ''"> and a.cust_type = #{custType}</if>
</where>
group by a.cust_id,a.id
limit #{start},#{size}
</select>
<select id="selectMyCustInfoMerchantListOps" parameterType="CustInfoBusiness" resultType="com.ruoyi.ibs.customerselect.domain.CustBaseInfo">
SELECT distinct a.id, a.cust_type, a.cust_tag, a.cust_scale, a.cust_name, a.lp_name,
a.cust_phone, a.cust_id, a.cust_isn,a.asset,a.credit,
a.cust_idc,
a.cust_type,a.cur_bal_d, a.cur_bal_t, a.bal_loan, a.cur_bal_5_bad, a.cur_d_ave,
a.cur_t_ave, a.loan_ave, is_ph, a.is_sx, a.is_yxht, a.is_xyk, a.fshl, a.is_sd, a.etc, a.dian, a.is_black, a.is_bad,
a.is_365zf,a.is_180zf,a.is_90zf,a.is_30zf, a.cust_level
from cust_info_merchant a
<if test="isSelectGrid == false">
inner join
(select user_id,dept_id,cust_id from
(select user_id,dept_id,cust_id,outlets_id from cust_dept_user_grid
<where>
<if test="opsDept != null and opsDept != ''">
ops_dept = #{opsDept}</if>
</where>
union all
select t2.user_id,t2.dept_id,t2.cust_id,t2.outlets_id from cust_dept_user_cmpm t2 where 1=1 and t2.cust_type = '1'
)f
where 1=1
<if test="deptId != null ">
and f.dept_id in (select dept_id from sys_dept where dept_id = #{deptId} or find_in_set(#{deptId},ancestors))
</if>
<if test="outletsId != null ">
and f.outlets_id in (select dept_id from sys_dept where dept_id = #{outletsId} or find_in_set(#{outletsId},ancestors))
</if>
<if test="userId != null ">
and f.user_id = #{userId}</if>
) b on a.cust_id = b.cust_id
</if>
<where>
<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>
<if test="userName != null ">
and gvcu.user_name = #{userName}
</if>
</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="custName != null and custName != ''"> and a.cust_name like concat('%', #{custName}, '%') </if>
<if test="custId != null and custId != ''"> and a.cust_id like concat('%', #{custId}, '%') </if>
<if test="custType != null and custType != ''"> and a.cust_type = #{custType}</if>
</where>
group by a.cust_id,a.id
limit #{start},#{size}
</select>
<select id="selectMyCustInfoMerchantList_COUNT" resultType="Long">
select -1
</select>
<select id="getMerchantNumByDeptId" parameterType="Long" resultType="java.lang.Long">
select count(distinct a.cust_id) from cust_info_merchant a
inner join (select distinct code, grid_id
from grid_region_admin_division_relate
where delete_flag = '0') b
on b.code = a.region_code
inner join (select distinct grid_id from grid_region_user_relate where delete_flag ='0' and parent_grid_id is null
and relate_dept_id in (select dept_id from sys_dept where dept_id = #{headDeptId} or find_in_set(#{headDeptId},ancestors))) c
on b.grid_id =c.grid_id
</select>
<select id="getMerchantNumByUserId" parameterType="String" resultType="java.lang.Long">
select count(distinct a.cust_id) from cust_info_merchant a
inner join (select distinct code, grid_id
from grid_region_admin_division_relate
where delete_flag = '0'
and ops_dept != '1') b
on b.code = a.region_code
inner join (select distinct grid_id, user_name, delete_flag
from grid_region_user_relate
where delete_flag = '0'
and parent_grid_id is not null) c
on b.grid_id = c.grid_id
where c.user_name = #{UserId} and c.delete_flag ='0'
</select>
<select id="getMerchantNumByLegalId" parameterType="String" resultType="java.lang.Long">
select count(*) from cust_info_merchant
where social_credit_code = #{LegalId}
</select>
<update id="updateMerchantByAnchor" parameterType="CustInfoUpdateFromAnchor">
update cust_info_merchant
<trim prefix="SET" suffixOverrides=",">
<if test="anchorName != null">cust_name = #{anchorName},</if>
<if test="belongBusiness != null">industry = #{belongBusiness},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="updateOrg != null">update_dept = #{updateOrg},</if>
<if test="address != null">${addressName} = #{address},</if>
<if test="regionCode != null">region_code = #{regionCode},</if>
</trim>
where social_credit_code = #{legalId}
</update>
<insert id="insertMerchantByAnchor" parameterType="CustInfoUpdateFromAnchor" >
insert into cust_info_merchant
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="custId != null">cust_id,</if>
<if test="custIsn != null">cust_isn,</if>
<if test="legalId != null">social_credit_code,</if>
<if test="anchorName != null">cust_name,</if>
<if test="belongBusiness != null">industry,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="address != null">${addressName},</if>
<if test="regionCode != null">region_code,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="custId != null">#{custId},</if>
<if test="custIsn != null">#{custIsn},</if>
<if test="legalId != null">#{legalId},</if>
<if test="anchorName != null">#{anchorName},</if>
<if test="belongBusiness != null">#{belongBusiness},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="address != null">#{address},</if>
<if test="regionCode != null">#{regionCode},</if>
</trim>
</insert>
<delete id="deleteMerchantByAnchor" parameterType="CustInfoDeleteFromAnchor">
update cust_info_merchant set region_code ='' where social_credit_code = #{legalId}
</delete>
<select id="selectPosNumByAdmin" parameterType="Long" resultType="java.lang.Long">
select count(distinct a.cust_id) from (select cust_id,region_code from cust_info_merchant) a
inner join (select distinct code,grid_id from grid_region_admin_division_relate) b on b.code = a.region_code
inner join (select distinct grid_id from grid_region_user_relate where delete_flag ='0'
and (relate_dept_id in (select dept_id from sys_dept where dept_id = #{userDept} or find_in_set(#{userDept},ancestors)) or user_name = #{userDept})) c on b.grid_id = c.grid_id
where b.grid_id = #{gridId}
</select>
<select id="getLpNameByCustId" >
select distinct lp_name from cust_info_merchant
where cust_id = #{custId}
</select>
<select id="selectCustInfoMerchatByCustNameAndCustIdc" parameterType="String" resultMap="CustInfoMerchantResult">
<include refid="selectCustInfoMerchantVo"/>
<where>
<if test="custName != null and custName != ''"> and cust_name = #{custName}</if>
<if test="custIdc != null and custIdc != ''"> and cust_idc = #{custIdc}</if>
</where>
</select>
<select id="selectCustInfoMerchatByCustId" parameterType="String" resultMap="CustInfoMerchantResult">
<include refid="selectCustInfoMerchantVo"/>
<where>
<if test="custId != null "> and cust_id = #{custId}</if>
</where>
</select>
<select id="getMerchantIdcByCustId" parameterType="String">
select distinct social_credit_code from cust_info_merchant
where cust_id = #{custId}
</select>
<select id="selectMerchantInfoByManage" parameterType="CustManageInfo" resultMap="CustManageInfoResult">
select distinct a.cust_id,a.cust_name,a.social_credit_code,a.region_code,c.user_name,c.nick_name,'1' as cust_type from cust_info_merchant a
inner join (select distinct code,grid_id from grid_region_admin_division_relate where delete_flag ='0') b on
b.code =a.region_code
inner join (select distinct grid_id,relate_dept_id,user_name,nick_name from grid_region_user_relate where delete_flag ='0'
and (relate_dept_id in (select dept_id from sys_dept where dept_id = #{userDept} or find_in_set(#{userDept},ancestors)) or user_name =#{userDept})) c
on b.grid_id = c.grid_id
where c.grid_id = #{gridId}
<if test="custName != null and custName != ''"> and a.cust_name like concat('%', #{custName}, '%') </if>
<if test="custId != null and custId != ''"> and a.cust_id like concat('%', #{custId}, '%') </if>
<if test="custNo != null and custNo != ''"> and a.cust_idc like concat('%', #{custNo}, '%') </if>
<if test="distributeTag != null and distributeTag != ''">
and case when #{distributeTag} = '0' then exists (select * from sys_grid_user_cust d where d.grid_id = #{gridId} and a.cust_id =d.cust_id and c.user_name = d.user_name)
when #{distributeTag} = '1' then not exists (select * from sys_grid_user_cust d where d.grid_id = #{gridId} and a.cust_id =d.cust_id and c.user_name = d.user_name)
else 1=1 end
</if>
</select>
<select id="countByCode" resultType="Long">
select count(distinct cust_id)
from cust_info_merchant_${deptCode}
where region_code like concat(#{code}, '%')
</select>
<insert id="insertCustomersToMmerchantByScCode" parameterType="java.util.List">
INSERT INTO cust_info_merchant
(cust_id,cust_name, social_credit_code, update_by, update_time, cust_phone, industry, asset, credit)
VALUES
<foreach collection="list" item="item" separator=",">
(#{item.custId},#{item.custName}, #{item.socialCreditCode}, #{item.createBy}, #{item.createTime}, #{item.custPhone},#{item.industry},#{item.asset},#{item.credit})
</foreach>
</insert>
<select id="selectCustInfoByScCodeList" resultType="java.lang.String">
select social_credit_code from
<if test="custType == 1">cust_info_merchant</if>
<if test="custType == 2">cust_info_business</if>
where social_credit_code in
<foreach collection="list" item="item" index="index" open="(" separator="," close=")">
#{item}
</foreach>
</select>
<select id="selectRecord" resultType="com.ruoyi.ibs.list.domain.CustInfoMerchant">
select id,cust_name from cust_info_merchant where social_credit_code = #{socialCreditCode}
</select>
</mapper>

View File

@@ -0,0 +1,216 @@
<?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.CustInfoRecordMapper">
<resultMap type="CustInfoRecord" id="CustInfoRecordResult">
<result property="id" column="id" />
<result property="custName" column="cust_name" />
<result property="lpName" column="lp_name" />
<result property="custPhone" column="cust_phone" />
<result property="custCapital" column="cust_capital" />
<result property="custLocation" column="cust_location" />
<result property="belongBranchId" column="belong_branch_id" />
<result property="belongBranchName" column="belong_branch_name" />
<result property="belongUserId" column="belong_user_id" />
<result property="belongUserName" column="belong_user_name" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="socialCreditCode" column="social_credit_code" />
<result property="tel" column="tel" />
<result property="registerLocation" column="register_location" />
<result property="businessScope" column="business_scope" />
<result property="industry" column="industry" />
<result property="custIdc" column="cust_idc" />
<result property="custGender" column="cust_gender" />
<result property="custAge" column="cust_age" />
<result property="status" column="status" />
<result property="isMarried" column="is_married" />
<result property="custEdu" column="cust_edu" />
<result property="custSalary" column="cust_salary" />
<result property="birthday" column="birthday" />
<result property="jobLocation" column="job_location" />
<result property="custType" column="cust_type" />
</resultMap>
<sql id="selectCustInfoRecordVo">
select id, cust_name, lp_name, cust_phone, cust_capital, cust_location, belong_branch_id, belong_branch_name, belong_user_id, belong_user_name, create_by, create_time, update_by, update_time, social_credit_code, tel, register_location, business_scope, industry, cust_idc, cust_gender, cust_age, status, is_married, cust_edu, cust_salary, birthday, job_location, cust_type from cust_info_record
</sql>
<select id="selectCustInfoRecordList" parameterType="CustInfoRecord" resultMap="CustInfoRecordResult">
<include refid="selectCustInfoRecordVo"/>
<where>
<if test="custName != null and custName != ''"> and cust_name like concat('%', #{custName}, '%')</if>
<if test="lpName != null and lpName != ''"> and lp_name like concat('%', #{lpName}, '%')</if>
<if test="custPhone != null and custPhone != ''"> and cust_phone = #{custPhone}</if>
<if test="custCapital != null and custCapital != ''"> and cust_capital = #{custCapital}</if>
<if test="custLocation != null and custLocation != ''"> and cust_location = #{custLocation}</if>
<if test="belongBranchId != null and belongBranchId != ''"> and belong_branch_id like concat(#{belongBranchId},'%') </if>
<if test="belongBranchName != null and belongBranchName != ''"> and belong_branch_name like concat('%', #{belongBranchName}, '%')</if>
<if test="belongUserId != null and belongUserId != ''"> and belong_user_id = #{belongUserId}</if>
<if test="belongUserName != null and belongUserName != ''"> and belong_user_name like concat('%', #{belongUserName}, '%')</if>
<if test="socialCreditCode != null and socialCreditCode != ''"> and social_credit_code = #{socialCreditCode}</if>
<if test="tel != null and tel != ''"> and tel = #{tel}</if>
<if test="registerLocation != null and registerLocation != ''"> and register_location = #{registerLocation}</if>
<if test="businessScope != null and businessScope != ''"> and business_scope = #{businessScope}</if>
<if test="industry != null and industry != ''"> and industry = #{industry}</if>
<if test="custIdc != null and custIdc != ''"> and cust_idc = #{custIdc}</if>
<if test="custGender != null and custGender != ''"> and cust_gender = #{custGender}</if>
<if test="custAge != null and custAge != ''"> and cust_age = #{custAge}</if>
<if test="status != null and status != ''"> and status = #{status}</if>
<if test="isMarried != null and isMarried != ''"> and is_married = #{isMarried}</if>
<if test="custEdu != null and custEdu != ''"> and cust_edu = #{custEdu}</if>
<if test="custSalary != null and custSalary != ''"> and cust_salary = #{custSalary}</if>
<if test="birthday != null and birthday != ''"> and birthday = #{birthday}</if>
<if test="jobLocation != null and jobLocation != ''"> and job_location = #{jobLocation}</if>
<if test="custType != null and custType != ''"> and cust_type = #{custType}</if>
</where>
</select>
<select id="selectCustInfoRecordListByCustTypeAndKeywords" parameterType="CustInfoRecord" resultMap="CustInfoRecordResult">
<include refid="selectCustInfoRecordVo"/>
<where>
<if test="deptId != null and deptId != ''">
and belong_branch_id in (select dept_id from sys_dept where dept_id = #{deptId}
or find_in_set(#{deptId},ancestors))
</if>
<if test="userName != null and userName != ''"> and belong_user_id = #{userName}</if>
<if test="keyword != null and keyword != ''"> and ( cust_idc like concat('%', #{keyword}, '%') or cust_name like concat('%', #{keyword}, '%')
or cust_phone like concat('%', #{keyword}, '%') or lp_name like concat('%', #{keyword}, '%'))
</if>
<if test="custType != null and custType != ''"> and cust_type = #{custType}</if>
</where>
</select>
<select id="selectHeadCustInfoRecordListByCustTypeAndKeywords" parameterType="CustInfoRecord" resultMap="CustInfoRecordResult">
<include refid="selectCustInfoRecordVo"/>
<where>
<if test="deptId != null and deptId != ''">
and belong_branch_id like concat('%', #{deptId}, '%')
</if>
<if test="keyword != null and keyword != ''"> and ( cust_idc like concat('%', #{keyword}, '%') or cust_name like concat('%', #{keyword}, '%')
or cust_phone like concat('%', #{keyword}, '%') or lp_name like concat('%', #{keyword}, '%'))
</if>
<if test="custType != null and custType != ''"> and cust_type = #{custType}</if>
</where>
</select>
<select id="selectCustInfoRecordById" parameterType="Long" resultMap="CustInfoRecordResult">
<include refid="selectCustInfoRecordVo"/>
where id = #{id}
</select>
<insert id="insertCustInfoRecord" parameterType="CustInfoRecord" useGeneratedKeys="true" keyProperty="id">
insert into cust_info_record
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="custName != null">cust_name,</if>
<if test="lpName != null">lp_name,</if>
<if test="custPhone != null">cust_phone,</if>
<if test="custCapital != null">cust_capital,</if>
<if test="custLocation != null">cust_location,</if>
<if test="belongBranchId != null">belong_branch_id,</if>
<if test="belongBranchName != null">belong_branch_name,</if>
<if test="belongUserId != null">belong_user_id,</if>
<if test="belongUserName != null">belong_user_name,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="socialCreditCode != null">social_credit_code,</if>
<if test="tel != null">tel,</if>
<if test="registerLocation != null">register_location,</if>
<if test="businessScope != null">business_scope,</if>
<if test="industry != null">industry,</if>
<if test="custIdc != null">cust_idc,</if>
<if test="custGender != null">cust_gender,</if>
<if test="custAge != null">cust_age,</if>
<if test="status != null">status,</if>
<if test="isMarried != null">is_married,</if>
<if test="custEdu != null">cust_edu,</if>
<if test="custSalary != null">cust_salary,</if>
<if test="birthday != null">birthday,</if>
<if test="jobLocation != null">job_location,</if>
<if test="custType != null">cust_type,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="custName != null">#{custName},</if>
<if test="lpName != null">#{lpName},</if>
<if test="custPhone != null">#{custPhone},</if>
<if test="custCapital != null">#{custCapital},</if>
<if test="custLocation != null">#{custLocation},</if>
<if test="belongBranchId != null">#{belongBranchId},</if>
<if test="belongBranchName != null">#{belongBranchName},</if>
<if test="belongUserId != null">#{belongUserId},</if>
<if test="belongUserName != null">#{belongUserName},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="socialCreditCode != null">#{socialCreditCode},</if>
<if test="tel != null">#{tel},</if>
<if test="registerLocation != null">#{registerLocation},</if>
<if test="businessScope != null">#{businessScope},</if>
<if test="industry != null">#{industry},</if>
<if test="custIdc != null">#{custIdc},</if>
<if test="custGender != null">#{custGender},</if>
<if test="custAge != null">#{custAge},</if>
<if test="status != null">#{status},</if>
<if test="isMarried != null">#{isMarried},</if>
<if test="custEdu != null">#{custEdu},</if>
<if test="custSalary != null">#{custSalary},</if>
<if test="birthday != null">#{birthday},</if>
<if test="jobLocation != null">#{jobLocation},</if>
<if test="custType != null">#{custType},</if>
</trim>
</insert>
<update id="updateCustInfoRecord" parameterType="CustInfoRecord">
update cust_info_record
<trim prefix="SET" suffixOverrides=",">
<if test="custName != null and custName != ''">cust_name = #{custName},</if>
<if test="lpName != null">lp_name = #{lpName},</if>
<if test="custPhone != null">cust_phone = #{custPhone},</if>
<if test="custCapital != null">cust_capital = #{custCapital},</if>
<if test="custLocation != null">cust_location = #{custLocation},</if>
<if test="belongBranchId != null">belong_branch_id = #{belongBranchId},</if>
<if test="belongBranchName != null">belong_branch_name = #{belongBranchName},</if>
<if test="belongUserId != null">belong_user_id = #{belongUserId},</if>
<if test="belongUserName != null">belong_user_name = #{belongUserName},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="socialCreditCode != null">social_credit_code = #{socialCreditCode},</if>
<if test="tel != null">tel = #{tel},</if>
<if test="registerLocation != null">register_location = #{registerLocation},</if>
<if test="businessScope != null">business_scope = #{businessScope},</if>
<if test="industry != null">industry = #{industry},</if>
<if test="custIdc != null">cust_idc = #{custIdc},</if>
<if test="custGender != null">cust_gender = #{custGender},</if>
<if test="custAge != null">cust_age = #{custAge},</if>
<if test="status != null">status = #{status},</if>
<if test="isMarried != null">is_married = #{isMarried},</if>
<if test="custEdu != null">cust_edu = #{custEdu},</if>
<if test="custSalary != null">cust_salary = #{custSalary},</if>
<if test="birthday != null">birthday = #{birthday},</if>
<if test="jobLocation != null">job_location = #{jobLocation},</if>
<if test="custType != null">cust_type = #{custType},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteCustInfoRecordById" parameterType="Long">
delete from cust_info_record where id = #{id}
</delete>
<delete id="deleteCustInfoRecordByIds" parameterType="String">
delete from cust_info_record where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,38 @@
<?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.DwBGridCmpmCorpcustClaimRptMapper">
<select id="selectResultList" resultType="DwBGridCmpmCorpcustClaimResultRpt">
select id,outlet_id,outlet_name,branch_id,branch_name,manager_id,manager_name,base_claim_cust_cnt,base_claim_acct_cnt,base_dep_bal,
base_dep_avg,base_dfgz_cnt,base_qyhl_prod_cnt,base_dkdj_prod_cnt,report_claim_cust_cnt,report_claim_acct_cnt,report_dep_bal,
report_dep_avg,report_dfgz_cnt,report_qyhl_prod_cnt,report_dkdj_prod_cnt,data_date
from dwb_grid_cmpm_corpcust_claim_result_rpt
<where>
<if test="role != null and role == 'outlet'"> and d.outlet_id = #{deptId} </if>
<if test="role != null and role == 'branch'"> and d.branch_id = #{deptId} </if>
<if test="role != null and role in {'head', 'ops', 'public', 'private'}">
and (left(outlet_id, 3) = left(#{deptId}, 3) or left(branch_id, 3) = left(#{deptId}, 3))
</if>
</where>
order by id
</select>
<select id="selectDetailList" resultType="DwBGridCmpmCorpcustClaimDetailRpt">
select id,outlet_id,outlet_name,branch_id,branch_name,manager_id,manager_name,cust_id,cust_name,cust_idc,cust_isn,base_claim_acct_cnt,
base_dep_bal,base_dep_avg,base_dfgz_flag,base_qyhl_prod_cnt,base_dkdj_prod_cnt,report_claim_acct_cnt,report_dep_bal,report_dep_avg,
report_dfgz_flag,report_qyhl_prod_cnt,report_dkdj_prod_cnt,data_date
from dwb_grid_cmpm_corpcust_claim_detail_rpt
<where>
<if test="role != null and role == 'outlet'"> and d.outlet_id = #{deptId} </if>
<if test="role != null and role == 'branch'"> and d.branch_id = #{deptId} </if>
<if test="role != null and role in {'head', 'ops', 'public', 'private'}">
and (left(outlet_id, 3) = left(#{deptId}, 3) or left(branch_id, 3) = left(#{deptId}, 3))
</if>
</where>
order by id
</select>
</mapper>

View File

@@ -0,0 +1,204 @@
<?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.FamilyMemberMapper">
<resultMap type="com.ruoyi.ibs.list.domain.FamilyMember" id="FamilyMemberResult">
<result property="id" column="id" />
<result property="idCard" column="id_card" />
<result property="name" column="name" />
<result property="fatherCard" column="father_card" />
<result property="motherCard" column="mother_card" />
<result property="spouseCard" column="spouse_card" />
<result property="familyId" column="family_id" />
<result property="gender" column="gender" />
<result property="age" column="age" />
<result property="bsId" column="bs_id" />
<result property="spouseFamilyId" column="spouse_family_id" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="birthDate" column="birth_date" />
<result property="isVirtual" column="is_virtual" />
<result property="depositBalance" column="deposit_balance" />
<result property="loanBalance" column="loan_balance" />
<result property="loanManager" column="loan_manager" />
</resultMap>
<sql id="selectFamilyMemberVo">
select id,id_card, name, father_card, mother_card, spouse_card, family_id, gender, age,bs_id,spouse_family_id,create_time,update_time,
create_by,update_by,birth_date,is_virtual, deposit_balance, loan_balance, loan_manager
from family_member
</sql>
<select id="selectFamilyMemberList" parameterType="FamilyMember" resultMap="FamilyMemberResult">
<include refid="selectFamilyMemberVo"/>
<where>
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
<if test="fatherCard != null and fatherCard != ''"> and father_card = #{fatherCard}</if>
<if test="motherCard != null and motherCard != ''"> and mother_card = #{motherCard}</if>
<if test="spouseCard != null and spouseCard != ''"> and spouse_card = #{spouseCard}</if>
<if test="familyId != null and familyId != ''"> and family_id = #{familyId}</if>
<if test="gender != null and gender != ''"> and gender = #{gender}</if>
<if test="age != null "> and age = #{age}</if>
<if test="bsId != null "> and bs_id = #{bsId}</if>
<if test="spouseFamilyId != null "> and spouse_family_id = #{spouseFamilyId}</if>
</where>
</select>
<select id="selectFamilyMemberByIdCard" parameterType="String" resultMap="FamilyMemberResult">
<include refid="selectFamilyMemberVo"/>
where id_card = #{idCard}
</select>
<select id="selectFamilyMemberByBsId" parameterType="String" resultMap="FamilyMemberResult">
<include refid="selectFamilyMemberVo"/>
where bs_id = #{bsId}
</select>
<insert id="insertFamilyMember" parameterType="FamilyMember">
insert into family_member
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="idCard != null">id_card,</if>
<if test="name != null and name != ''">name,</if>
<if test="fatherCard != null">father_card,</if>
<if test="motherCard != null">mother_card,</if>
<if test="spouseCard != null">spouse_card,</if>
<if test="familyId != null">family_id,</if>
<if test="gender != null">gender,</if>
<if test="age != null">age,</if>
<if test="bsId != null">bs_id,</if>
<if test="spouseFamilyId != null "> spouse_family_id ,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="birthDate != null">birth_date,</if>
<if test="isVirtual != null">is_virtual,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="idCard != null">#{idCard},</if>
<if test="name != null and name != ''">#{name},</if>
<if test="fatherCard != null">#{fatherCard},</if>
<if test="motherCard != null">#{motherCard},</if>
<if test="spouseCard != null">#{spouseCard},</if>
<if test="familyId != null">#{familyId},</if>
<if test="gender != null">#{gender},</if>
<if test="age != null">#{age},</if>
<if test="bsId != null">#{bsId},</if>
<if test="spouseFamilyId != null "> #{spouseFamilyId},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="birthDate != null">#{birthDate},</if>
<if test="isVirtual != null">#{isVirtual},</if>
</trim>
</insert>
<update id="updateFamilyMember" parameterType="FamilyMember">
update family_member
<trim prefix="SET" suffixOverrides=",">
<if test="name != null and name != ''">name = #{name},</if>
<if test="fatherCard != null">father_card = #{fatherCard},</if>
<if test="motherCard != null">mother_card = #{motherCard},</if>
<if test="spouseCard != null">spouse_card = #{spouseCard},</if>
<if test="familyId != null">family_id = #{familyId},</if>
<if test="gender != null">gender = #{gender},</if>
<if test="age != null">age = #{age},</if>
<if test="bsId != null">bs_id = #{bsId},</if>
<if test="spouseFamilyId != null "> spouse_family_id = #{spouseFamilyId},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="birthDate != null">birth_date = #{birthDate},</if>
<if test="isVirtual != null">is_virtual= #{isVirtual},</if>
</trim>
where id_card = #{idCard}
</update>
<delete id="deleteFamilyMemberByIdCard" parameterType="String">
delete from family_member where id_card = #{idCard}
</delete>
<delete id="deleteFamilyMemberByIdCards" parameterType="String">
delete from family_member where id_card in
<foreach item="idCard" collection="array" open="(" separator="," close=")">
#{idCard}
</foreach>
</delete>
<select id="getMemberByIdCard" resultMap="FamilyMemberResult">
SELECT * FROM family_member
WHERE id_card = #{idCard}
</select>
<select id="getMembersByFamilyId" resultMap="FamilyMemberResult">
<include refid="selectFamilyMemberVo"/>
WHERE family_id = #{familyId} or spouse_family_id = #{familyId}
union
select f1.id,f1.id_card, f1.name, f1.father_card, f1.mother_card, f1.spouse_card, f1.family_id, f1.gender, f1.age,f1.bs_id,f1.spouse_family_id,
f1.create_time,f1.update_time,f1.create_by,f1.update_by,f1.birth_date, f1.is_virtual, f1.deposit_balance, f1.loan_balance, f1.loan_manager
from family_member f1
inner join family_member f2 on f1.mother_card = f2.id_card
where f2.family_id = #{familyId} and f2.gender = 'F'
</select>
<select id="getMembersByFamilyId2" resultMap="FamilyMemberResult">
<include refid="selectFamilyMemberVo"/>
WHERE family_id = #{familyId}
union all
select distinct f1.id,f1.id_card, f1.name, f1.father_card, f1.mother_card, f1.spouse_card, f1.family_id, f1.gender, f1.age,f1.bs_id,f1.spouse_family_id,
f1.create_time,f1.update_time,f1.create_by,f1.update_by,f1.birth_date, f1.is_virtual , f1.deposit_balance, f1.loan_balance, f1.loan_manager
from family_member f1
inner join family_member f2 on (f1.id_card = f2.mother_card or f1.id_card = f2.spouse_card)
where f2.family_id = #{familyId}
union all
select f1.id,f1.id_card, f1.name, f1.father_card, f1.mother_card, f1.spouse_card, f1.family_id, f1.gender, f1.age,f1.bs_id,
f1.spouse_family_id,f1.create_time,f1.update_time,f1.create_by,f1.update_by,f1.birth_date, f1.is_virtual, f1.deposit_balance, f1.loan_balance, f1.loan_manager
from family_member f1
inner join family_member f2 on f1.mother_card = f2.id_card where f2.family_id = #{familyId} and f2.gender = 'F'
</select>
<select id="getMembersSpouseByFamilyId" resultMap="FamilyMemberResult">
<include refid="selectFamilyMemberVo"/>
WHERE id_card in (SELECT spouse_card FROM family_member where family_id = #{familyId})
</select>
<select id="getSpouseFamilyId" resultType="String">
SELECT fm2.family_id
FROM family_member fm1
JOIN family_member fm2 ON fm1.spouse_card = fm2.id_card
WHERE fm1.id_card = #{idCard}
</select>
<select id="getChildrenByAnyParent" resultMap="FamilyMemberResult">
SELECT * FROM family_member WHERE father_card = #{parentCard} OR mother_card = #{parentCard}
</select>
<select id="batchSelect" resultMap="FamilyMemberResult">
SELECT * FROM family_member WHERE id_card IN
<foreach item='id' collection='ids' open='(' separator=',' close=')'>
#{id}
</foreach>
</select>
<select id="selectChildrenIds" resultType="String">
SELECT id_card FROM family_member WHERE father_card = #{memberId} OR mother_card = #{memberId}
</select>
<select id="selectSiblingIds" resultType="String">
SELECT id_card FROM family_member WHERE (father_card = #{fatherId} OR mother_card = #{motherId} or bs_id = #{bsId})
AND id_card != #{memberId}
</select>
</mapper>

View File

@@ -0,0 +1,131 @@
<?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.FamilyMembersMapper">
<resultMap type="FamilyMembers" id="FamilyMembersResult">
<result property="id" column="id" />
<result property="custIsn" column="cust_isn" />
<result property="custId" column="cust_id" />
<result property="fmyCustId" column="fmy_cust_id" />
<result property="fmyCustIdc" column="fmy_cust_idc" />
<result property="fmyName" column="fmy_name" />
<result property="tel" column="tel" />
<result property="birthday" column="birthday" />
<result property="fmyRln" column="fmy_rln" />
<result property="label" column="label" />
<result property="belongBusi" column="belong_busi" />
</resultMap>
<sql id="selectFamilyMembersVo">
select id,cust_isn, cust_id, fmy_cust_id,fmy_cust_idc, fmy_name, tel, birthday, fmy_rln, label, belong_busi from family_members
</sql>
<select id="selectFamilyMembersList" parameterType="FamilyMembers" resultMap="FamilyMembersResult">
<include refid="selectFamilyMembersVo"/>
<where>
<if test="id != null "> and id = #{id}</if>
<if test="custIsn != null and custIsn != ''"> and cust_isn = #{custIsn}</if>
<if test="custId != null and custId != ''"> and cust_id = #{custId}</if>
<if test="fmyCustId != null and fmyCustId != ''"> and fmy_cust_id = #{fmyCustId}</if>
<if test="fmyCustIdc != null and fmyCustIdc != ''"> and fmy_cust_idc = #{fmyCustIdc}</if>
<if test="fmyName != null and fmyName != ''"> and fmy_name like concat('%', #{fmyName}, '%')</if>
<if test="tel != null and tel != ''"> and tel = #{tel}</if>
<if test="birthday != null "> and birthday = #{birthday}</if>
<if test="fmyRln != null and fmyRln != ''"> and fmy_rln = #{fmyRln}</if>
<if test="label != null and label != ''"> and label = #{label}</if>
<if test="belongBusi != null and belongBusi != ''"> and belong_busi = #{belongBusi}</if>
</where>
</select>
<select id="selectFamilyMembersByCustIsn" parameterType="String" resultMap="FamilyMembersResult">
<include refid="selectFamilyMembersVo"/>
where cust_isn = #{custIsn}
</select>
<select id="selectCustEnumByCustId" resultType="CustTagVo">
select cstn.id, cstn.cust_tag_name, case when cst.cust_id is null then 'false' else 'true' end as flag,
cstn.cust_tag_level1,cstn.cust_tag_level2,cstn.tag_type
from sys_cust_tag_nemu cstn
left join
(select * from sys_cust_tag where cust_id = #{custId} )cst on cst.tag_id = cstn.id
where cstn.dept_id = #{deptId3} and cstn.cust_tag_type = #{custType}
order by cstn.cust_tag_level1,cstn.cust_tag_level2,flag desc
</select>
<select id="selectManualTag" resultType="CustManualTagVO">
select
tm.id AS id,
tm.parent_id AS parentId,
tm.cust_tag_name AS custTagName,
case when ctm.cust_id is null then 'false' else 'true' end as flag
from sys_tag_manual tm
left join sys_cust_tag_manual ctm
on ctm.tag_id = tm.id and ctm.cust_id = #{custId}
where tm.dept_id = #{deptId3} and tm.cust_tag_type = #{custType}
order by tm.id, flag desc
</select>
<select id="selectmanualAll" resultType="CustManualTagVO">
select id, parent_id, cust_tag_name
from sys_tag_manual
where dept_id = #{deptId} and cust_tag_type = #{custType}
</select>
<insert id="insertFamilyMembers" parameterType="FamilyMembers">
insert into family_members
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="custIsn != null">cust_isn,</if>
<if test="custId != null">cust_id,</if>
<if test="fmyCustId != null">fmy_cust_id,</if>
<if test="fmyCustIdc != null">fmy_cust_idc,</if>
<if test="fmyName != null">fmy_name,</if>
<if test="tel != null">tel,</if>
<if test="birthday != null">birthday,</if>
<if test="fmyRln != null">fmy_rln,</if>
<if test="label != null">label,</if>
<if test="belongBusi != null">belong_busi,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="custIsn != null">#{custIsn},</if>
<if test="custId != null">#{custId},</if>
<if test="fmyCustId != null">#{fmyCustId},</if>
<if test="fmyCustIdc != null">#{fmyCustIdc},</if>
<if test="fmyName != null">#{fmyName},</if>
<if test="tel != null">#{tel},</if>
<if test="birthday != null">#{birthday},</if>
<if test="fmyRln != null">#{fmyRln},</if>
<if test="label != null">#{label},</if>
<if test="belongBusi != null">#{belongBusi},</if>
</trim>
</insert>
<update id="updateFamilyMembers" parameterType="FamilyMembers">
update family_members
<trim prefix="SET" suffixOverrides=",">
<if test="custId != null">cust_id = #{custId},</if>
<if test="fmyCustId != null">fmy_cust_id = #{fmyCustId},</if>
<if test="fmyCustIdc != null">fmy_cust_idc = #{fmyCustIdc},</if>
<if test="fmyName != null">fmy_name = #{fmyName},</if>
<if test="tel != null">tel = #{tel},</if>
<if test="birthday != null">birthday = #{birthday},</if>
<if test="fmyRln != null">fmy_rln = #{fmyRln},</if>
<if test="label != null">label = #{label},</if>
<if test="belongBusi != null">belong_busi = #{belongBusi},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteFamilyMembersByCustIsn" parameterType="String">
delete from family_members where cust_isn = #{custIsn}
</delete>
<delete id="deleteFamilyMembersByCustIsns" parameterType="String">
delete from family_members where cust_isn in
<foreach item="custIsn" collection="array" open="(" separator="," close=")">
#{custIsn}
</foreach>
</delete>
</mapper>

View File

@@ -0,0 +1,90 @@
<?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.FamilyMembersRecordMapper">
<resultMap type="FamilyMembersRecord" id="FamilyMembersRecordResult">
<result property="id" column="id" />
<result property="custIdc" column="cust_idc" />
<result property="fmyName" column="fmy_name" />
<result property="tel" column="tel" />
<result property="birthday" column="birthday" />
<result property="fmyRln" column="fmy_rln" />
<result property="belongBusi" column="belong_busi" />
<result property="fmyCustIdc" column="fmy_cust_idc" />
<result property="recordId" column="record_id" />
</resultMap>
<sql id="selectFamilyMembersRecordVo">
select id,cust_idc, fmy_name, tel, birthday, fmy_rln, belong_busi, fmy_cust_idc,record_id from family_members_record
</sql>
<select id="selectFamilyMembersRecordList" parameterType="FamilyMembersRecord" resultMap="FamilyMembersRecordResult">
<include refid="selectFamilyMembersRecordVo"/>
<where>
<if test="custIdc != null and custIdc != ''"> and cust_idc = #{custIdc}</if>
<if test="fmyName != null and fmyName != ''"> and fmy_name like concat('%', #{fmyName}, '%')</if>
<if test="tel != null and tel != ''"> and tel = #{tel}</if>
<if test="birthday != null "> and birthday = #{birthday}</if>
<if test="fmyRln != null and fmyRln != ''"> and fmy_rln = #{fmyRln}</if>
<if test="belongBusi != null and belongBusi != ''"> and belong_busi = #{belongBusi}</if>
<if test="fmyCustIdc != null and fmyCustIdc != ''"> and fmy_cust_idc = #{fmyCustIdc}</if>
<if test="recordId != null "> and record_id = #{recordId}</if>
</where>
</select>
<select id="selectFamilyMembersRecordByCustIdc" parameterType="String" resultMap="FamilyMembersRecordResult">
<include refid="selectFamilyMembersRecordVo"/>
where cust_idc = #{custIdc}
</select>
<insert id="insertFamilyMembersRecord" parameterType="FamilyMembersRecord">
insert into family_members_record
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="custIdc != null">cust_idc,</if>
<if test="fmyName != null">fmy_name,</if>
<if test="tel != null">tel,</if>
<if test="birthday != null">birthday,</if>
<if test="fmyRln != null">fmy_rln,</if>
<if test="belongBusi != null">belong_busi,</if>
<if test="fmyCustIdc != null">fmy_cust_idc,</if>
<if test="recordId != null">record_id,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="custIdc != null">#{custIdc},</if>
<if test="fmyName != null">#{fmyName},</if>
<if test="tel != null">#{tel},</if>
<if test="birthday != null">#{birthday},</if>
<if test="fmyRln != null">#{fmyRln},</if>
<if test="belongBusi != null">#{belongBusi},</if>
<if test="fmyCustIdc != null">#{fmyCustIdc},</if>
<if test="recordId != null">#{recordId},</if>
</trim>
</insert>
<update id="updateFamilyMembersRecord" parameterType="FamilyMembersRecord">
update family_members_record
<trim prefix="SET" suffixOverrides=",">
<if test="fmyName != null">fmy_name = #{fmyName},</if>
<if test="tel != null">tel = #{tel},</if>
<if test="birthday != null">birthday = #{birthday},</if>
<if test="fmyRln != null">fmy_rln = #{fmyRln},</if>
<if test="belongBusi != null">belong_busi = #{belongBusi},</if>
<if test="fmyCustIdc != null">fmy_cust_idc = #{fmyCustIdc},</if>
<if test="recordId != null">record_id = #{recordId},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteFamilyMembersRecordByCustIdc" parameterType="String">
delete from family_members_record where cust_idc = #{custIdc}
</delete>
<delete id="deleteFamilyMembersRecordByCustIdcs" parameterType="String">
delete from family_members_record where cust_idc in
<foreach item="custIdc" collection="array" open="(" separator="," close=")">
#{custIdc}
</foreach>
</delete>
</mapper>

View File

@@ -0,0 +1,87 @@
<?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.OtherBankRateMapper">
<resultMap type="OtherBankRate" id="OtherBankRateResult">
<result property="id" column="id" />
<result property="custIdc" column="cust_idc" />
<result property="bank" column="bank" />
<result property="rate" column="rate" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="source" column="source" />
</resultMap>
<sql id="selectOtherBankRateVo">
select id, cust_idc, bank, rate, create_by, create_time, update_by, update_time,source from other_bank_rate
</sql>
<select id="selectOtherBankRateList" parameterType="OtherBankRate" resultMap="OtherBankRateResult">
<include refid="selectOtherBankRateVo"/>
<where>
<if test="custIdc != null and custIdc != ''"> and cust_idc = #{custIdc}</if>
<if test="bank != null and bank != ''"> and bank = #{bank}</if>
<if test="rate != null and rate != ''"> and rate = #{rate}</if>
<if test="source != null and source != ''"> and source = #{source}</if>
</where>
</select>
<select id="selectOtherBankRateById" parameterType="Long" resultMap="OtherBankRateResult">
<include refid="selectOtherBankRateVo"/>
where id = #{id}
</select>
<insert id="insertOtherBankRate" parameterType="OtherBankRate" useGeneratedKeys="true" keyProperty="id">
insert into other_bank_rate
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="custIdc != null">cust_idc,</if>
<if test="bank != null">bank,</if>
<if test="rate != null">rate,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="source != null">source,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="custIdc != null">#{custIdc},</if>
<if test="bank != null">#{bank},</if>
<if test="rate != null">#{rate},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="source != null">#{source},</if>
</trim>
</insert>
<update id="updateOtherBankRate" parameterType="OtherBankRate">
update other_bank_rate
<trim prefix="SET" suffixOverrides=",">
<if test="custIdc != null">cust_idc = #{custIdc},</if>
<if test="bank != null">bank = #{bank},</if>
<if test="rate != null">rate = #{rate},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="source != null">source = #{source},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteOtherBankRateById" parameterType="Long">
delete from other_bank_rate where id = #{id}
</delete>
<delete id="deleteOtherBankRateByIds" parameterType="String">
delete from other_bank_rate where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@@ -0,0 +1,101 @@
<?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.RecordRelateMapper">
<resultMap type="RecordRelate" id="RecordRelateResult">
<result property="id" column="id" />
<result property="socialCreditCode" column="social_credit_code" />
<result property="relateCustIdc" column="relate_cust_idc" />
<result property="relatePerson" column="relate_person" />
<result property="relateMerchant" column="relate_merchant" />
<result property="relateBusiness" column="relate_business" />
<result property="custIdc" column="cust_idc" />
<result property="custType" column="cust_type" />
<result property="relateMerchantCode" column="relate_merchant_code" />
<result property="relateBusinessCode" column="relate_business_code" />
<result property="recordId" column="record_id" />
</resultMap>
<sql id="selectRecordRelateVo">
select id, social_credit_code, relate_cust_idc, relate_person, relate_merchant, relate_business, cust_idc, cust_type, relate_merchant_code, relate_business_code,record_id from record_relate
</sql>
<select id="selectRecordRelateList" parameterType="RecordRelate" resultMap="RecordRelateResult">
<include refid="selectRecordRelateVo"/>
<where>
<if test="socialCreditCode != null and socialCreditCode != ''"> and social_credit_code = #{socialCreditCode}</if>
<if test="relateCustIdc != null and relateCustIdc != ''"> and relate_cust_idc = #{relateCustIdc}</if>
<if test="relatePerson != null and relatePerson != ''"> and relate_person = #{relatePerson}</if>
<if test="relateMerchant != null and relateMerchant != ''"> and relate_merchant = #{relateMerchant}</if>
<if test="relateBusiness != null and relateBusiness != ''"> and relate_business = #{relateBusiness}</if>
<if test="custIdc != null and custIdc != ''"> and cust_idc = #{custIdc}</if>
<if test="custType != null and custType != ''"> and cust_type = #{custType}</if>
<if test="relateMerchantCode != null and relateMerchantCode != ''"> and relate_merchant_code = #{relateMerchantCode}</if>
<if test="relateBusinessCode != null and relateBusinessCode != ''"> and relate_business_code = #{relateBusinessCode}</if>
<if test="recordId != null "> and record_id = #{recordId}</if>
</where>
</select>
<select id="selectRecordRelateById" parameterType="Long" resultMap="RecordRelateResult">
<include refid="selectRecordRelateVo"/>
where id = #{id}
</select>
<insert id="insertRecordRelate" parameterType="RecordRelate" useGeneratedKeys="true" keyProperty="id">
insert into record_relate
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="socialCreditCode != null">social_credit_code,</if>
<if test="relateCustIdc != null">relate_cust_idc,</if>
<if test="relatePerson != null">relate_person,</if>
<if test="relateMerchant != null">relate_merchant,</if>
<if test="relateBusiness != null">relate_business,</if>
<if test="custIdc != null">cust_idc,</if>
<if test="custType != null">cust_type,</if>
<if test="relateMerchantCode != null">relate_merchant_code,</if>
<if test="relateBusinessCode != null">relate_business_code,</if>
<if test="recordId != null">record_id,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="socialCreditCode != null">#{socialCreditCode},</if>
<if test="relateCustIdc != null">#{relateCustIdc},</if>
<if test="relatePerson != null">#{relatePerson},</if>
<if test="relateMerchant != null">#{relateMerchant},</if>
<if test="relateBusiness != null">#{relateBusiness},</if>
<if test="custIdc != null">#{custIdc},</if>
<if test="custType != null">#{custType},</if>
<if test="relateMerchantCode != null">#{relateMerchantCode},</if>
<if test="relateBusinessCode != null">#{relateBusinessCode},</if>
<if test="recordId != null">#{recordId},</if>
</trim>
</insert>
<update id="updateRecordRelate" parameterType="RecordRelate">
update record_relate
<trim prefix="SET" suffixOverrides=",">
<if test="socialCreditCode != null">social_credit_code = #{socialCreditCode},</if>
<if test="relateCustIdc != null">relate_cust_idc = #{relateCustIdc},</if>
<if test="relatePerson != null">relate_person = #{relatePerson},</if>
<if test="relateMerchant != null">relate_merchant = #{relateMerchant},</if>
<if test="relateBusiness != null">relate_business = #{relateBusiness},</if>
<if test="custIdc != null">cust_idc = #{custIdc},</if>
<if test="custType != null">cust_type = #{custType},</if>
<if test="relateMerchantCode != null">relate_merchant_code = #{relateMerchantCode},</if>
<if test="relateBusinessCode != null">relate_business_code = #{relateBusinessCode},</if>
<if test="recordId != null">record_id = #{recordId},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteRecordRelateById" parameterType="Long">
delete from record_relate where id = #{id}
</delete>
<delete id="deleteRecordRelateByIds" parameterType="String">
delete from record_relate where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@@ -0,0 +1,119 @@
<?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.SignedProductsMapper">
<resultMap type="SignedProducts" id="SignedProductsResult">
<result property="currdeposFlag" column="currdepos_flag" />
<result property="hatflowcostbookFlag" column="hatflowcostbook_flag" />
<result property="phmortgloanFlag" column="phmortgloan_flag" />
<result property="zheliloanFlag" column="zheliloan_flag" />
<result property="frcdFlag" column="frcd_flag" />
<result property="financialbookFlag" column="financialbook_flag" />
<result property="fundbookFlag" column="fundbook_flag" />
<result property="insurbookFlag" column="insurbook_flag" />
<result property="bondbookFlag" column="bondbook_flag" />
<result property="watfeeWhcFlag" column="watfee_whc_flag" />
<result property="elefeeWhcFlag" column="elefee_whc_flag" />
<result property="gasfeeWhcFlag" column="gasfee_whc_flag" />
<result property="etcFlag" column="etc_flag" />
<result property="custId" column="cust_id" />
</resultMap>
<sql id="selectSignedProductsVo">
select currdepos_flag, hatflowcostbook_flag, phmortgloan_flag, zheliloan_flag, frcd_flag, financialbook_flag, fundbook_flag, insurbook_flag, bondbook_flag, watfee_whc_flag, elefee_whc_flag, gasfee_whc_flag, etc_flag, cust_id from signed_products
</sql>
<select id="selectSignedProductsList" parameterType="SignedProducts" resultMap="SignedProductsResult">
<include refid="selectSignedProductsVo"/>
<where>
<if test="currdeposFlag != null and currdeposFlag != ''"> and currdepos_flag = #{currdeposFlag}</if>
<if test="hatflowcostbookFlag != null and hatflowcostbookFlag != ''"> and hatflowcostbook_flag = #{hatflowcostbookFlag}</if>
<if test="phmortgloanFlag != null and phmortgloanFlag != ''"> and phmortgloan_flag = #{phmortgloanFlag}</if>
<if test="zheliloanFlag != null and zheliloanFlag != ''"> and zheliloan_flag = #{zheliloanFlag}</if>
<if test="frcdFlag != null and frcdFlag != ''"> and frcd_flag = #{frcdFlag}</if>
<if test="financialbookFlag != null and financialbookFlag != ''"> and financialbook_flag = #{financialbookFlag}</if>
<if test="fundbookFlag != null and fundbookFlag != ''"> and fundbook_flag = #{fundbookFlag}</if>
<if test="insurbookFlag != null and insurbookFlag != ''"> and insurbook_flag = #{insurbookFlag}</if>
<if test="bondbookFlag != null and bondbookFlag != ''"> and bondbook_flag = #{bondbookFlag}</if>
<if test="watfeeWhcFlag != null and watfeeWhcFlag != ''"> and watfee_whc_flag = #{watfeeWhcFlag}</if>
<if test="elefeeWhcFlag != null and elefeeWhcFlag != ''"> and elefee_whc_flag = #{elefeeWhcFlag}</if>
<if test="gasfeeWhcFlag != null and gasfeeWhcFlag != ''"> and gasfee_whc_flag = #{gasfeeWhcFlag}</if>
<if test="etcFlag != null and etcFlag != ''"> and etc_flag = #{etcFlag}</if>
<if test="custId != null and custId != ''"> and cust_id = #{custId}</if>
</where>
</select>
<select id="selectSignedProductsByCurrdeposFlag" parameterType="String" resultMap="SignedProductsResult">
<include refid="selectSignedProductsVo"/>
where cust_id = #{custId}
</select>
<insert id="insertSignedProducts" parameterType="SignedProducts">
insert into signed_products
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="currdeposFlag != null">currdepos_flag,</if>
<if test="hatflowcostbookFlag != null">hatflowcostbook_flag,</if>
<if test="phmortgloanFlag != null">phmortgloan_flag,</if>
<if test="zheliloanFlag != null">zheliloan_flag,</if>
<if test="frcdFlag != null">frcd_flag,</if>
<if test="financialbookFlag != null">financialbook_flag,</if>
<if test="fundbookFlag != null">fundbook_flag,</if>
<if test="insurbookFlag != null">insurbook_flag,</if>
<if test="bondbookFlag != null">bondbook_flag,</if>
<if test="watfeeWhcFlag != null">watfee_whc_flag,</if>
<if test="elefeeWhcFlag != null">elefee_whc_flag,</if>
<if test="gasfeeWhcFlag != null">gasfee_whc_flag,</if>
<if test="etcFlag != null">etc_flag,</if>
<if test="custId != null">cust_id,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="currdeposFlag != null">#{currdeposFlag},</if>
<if test="hatflowcostbookFlag != null">#{hatflowcostbookFlag},</if>
<if test="phmortgloanFlag != null">#{phmortgloanFlag},</if>
<if test="zheliloanFlag != null">#{zheliloanFlag},</if>
<if test="frcdFlag != null">#{frcdFlag},</if>
<if test="financialbookFlag != null">#{financialbookFlag},</if>
<if test="fundbookFlag != null">#{fundbookFlag},</if>
<if test="insurbookFlag != null">#{insurbookFlag},</if>
<if test="bondbookFlag != null">#{bondbookFlag},</if>
<if test="watfeeWhcFlag != null">#{watfeeWhcFlag},</if>
<if test="elefeeWhcFlag != null">#{elefeeWhcFlag},</if>
<if test="gasfeeWhcFlag != null">#{gasfeeWhcFlag},</if>
<if test="etcFlag != null">#{etcFlag},</if>
<if test="custId != null">#{custId},</if>
</trim>
</insert>
<update id="updateSignedProducts" parameterType="SignedProducts">
update signed_products
<trim prefix="SET" suffixOverrides=",">
<if test="hatflowcostbookFlag != null">hatflowcostbook_flag = #{hatflowcostbookFlag},</if>
<if test="phmortgloanFlag != null">phmortgloan_flag = #{phmortgloanFlag},</if>
<if test="zheliloanFlag != null">zheliloan_flag = #{zheliloanFlag},</if>
<if test="frcdFlag != null">frcd_flag = #{frcdFlag},</if>
<if test="financialbookFlag != null">financialbook_flag = #{financialbookFlag},</if>
<if test="fundbookFlag != null">fundbook_flag = #{fundbookFlag},</if>
<if test="insurbookFlag != null">insurbook_flag = #{insurbookFlag},</if>
<if test="bondbookFlag != null">bondbook_flag = #{bondbookFlag},</if>
<if test="watfeeWhcFlag != null">watfee_whc_flag = #{watfeeWhcFlag},</if>
<if test="elefeeWhcFlag != null">elefee_whc_flag = #{elefeeWhcFlag},</if>
<if test="gasfeeWhcFlag != null">gasfee_whc_flag = #{gasfeeWhcFlag},</if>
<if test="etcFlag != null">etc_flag = #{etcFlag},</if>
<if test="custId != null">cust_id = #{custId},</if>
</trim>
where currdepos_flag = #{currdeposFlag}
</update>
<delete id="deleteSignedProductsByCurrdeposFlag" parameterType="String">
delete from signed_products where currdepos_flag = #{currdeposFlag}
</delete>
<delete id="deleteSignedProductsByCurrdeposFlags" parameterType="String">
delete from signed_products where currdepos_flag in
<foreach item="currdeposFlag" collection="array" open="(" separator="," close=")">
#{currdeposFlag}
</foreach>
</delete>
</mapper>

View File

@@ -0,0 +1,136 @@
<?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.SocialSecurityMapper">
<resultMap type="SocialSecurity" id="SocialSecurityResult">
<result property="id" column="id" />
<result property="custIdc" column="cust_idc" />
<result property="paymentStatus" column="payment_status" />
<result property="unitType" column="unit_type" />
<result property="belongBusi" column="belong_busi" />
<result property="economicType" column="economic_type" />
<result property="qualityLabel" column="quality_label" />
<result property="paymentBaseRank" column="payment_base_rank" />
<result property="paymentCountRank" column="payment_count_rank" />
<result property="paymentType" column="payment_type" />
<result property="insuranceStatus" column="insurance_status" />
<result property="recentTwoYearsCount" column="recent_two_years_count" />
<result property="recentOneYearsCount" column="recent_one_years_count" />
<result property="paymentBase" column="payment_base" />
<result property="blackList" column="black_list" />
<result property="labourArbitration" column="labour_arbitration" />
<result property="receivePensionBenefits" column="receive_pension_benefits" />
<result property="receiveUnemploymentBenefits" column="receive_unemployment_benefits" />
</resultMap>
<sql id="selectSocialSecurityVo">
select id, cust_idc, payment_status, unit_type, belong_busi, economic_type, quality_label, payment_base_rank, payment_count_rank, payment_type, insurance_status, recent_two_years_count, recent_one_years_count, payment_base, black_list, labour_arbitration, receive_pension_benefits, receive_unemployment_benefits from social_security
</sql>
<select id="selectSocialSecurityList" parameterType="SocialSecurity" resultMap="SocialSecurityResult">
<include refid="selectSocialSecurityVo"/>
<where>
<if test="custIdc != null and custIdc != ''"> and cust_idc = #{custIdc}</if>
<if test="paymentStatus != null and paymentStatus != ''"> and payment_status = #{paymentStatus}</if>
<if test="unitType != null and unitType != ''"> and unit_type = #{unitType}</if>
<if test="belongBusi != null and belongBusi != ''"> and belong_busi = #{belongBusi}</if>
<if test="economicType != null and economicType != ''"> and economic_type = #{economicType}</if>
<if test="qualityLabel != null and qualityLabel != ''"> and quality_label = #{qualityLabel}</if>
<if test="paymentBaseRank != null and paymentBaseRank != ''"> and payment_base_rank = #{paymentBaseRank}</if>
<if test="paymentCountRank != null and paymentCountRank != ''"> and payment_count_rank = #{paymentCountRank}</if>
<if test="paymentType != null and paymentType != ''"> and payment_type = #{paymentType}</if>
<if test="insuranceStatus != null and insuranceStatus != ''"> and insurance_status = #{insuranceStatus}</if>
<if test="recentTwoYearsCount != null and recentTwoYearsCount != ''"> and recent_two_years_count = #{recentTwoYearsCount}</if>
<if test="recentOneYearsCount != null and recentOneYearsCount != ''"> and recent_one_years_count = #{recentOneYearsCount}</if>
<if test="paymentBase != null and paymentBase != ''"> and payment_base = #{paymentBase}</if>
<if test="blackList != null and blackList != ''"> and black_list = #{blackList}</if>
<if test="labourArbitration != null and labourArbitration != ''"> and labour_arbitration = #{labourArbitration}</if>
<if test="receivePensionBenefits != null and receivePensionBenefits != ''"> and receive_pension_benefits = #{receivePensionBenefits}</if>
<if test="receiveUnemploymentBenefits != null and receiveUnemploymentBenefits != ''"> and receive_unemployment_benefits = #{receiveUnemploymentBenefits}</if>
</where>
</select>
<select id="selectSocialSecurityById" parameterType="Long" resultMap="SocialSecurityResult">
<include refid="selectSocialSecurityVo"/>
where id = #{id}
</select>
<insert id="insertSocialSecurity" parameterType="SocialSecurity" useGeneratedKeys="true" keyProperty="id">
insert into social_security
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="custIdc != null">cust_idc,</if>
<if test="paymentStatus != null">payment_status,</if>
<if test="unitType != null">unit_type,</if>
<if test="belongBusi != null">belong_busi,</if>
<if test="economicType != null">economic_type,</if>
<if test="qualityLabel != null">quality_label,</if>
<if test="paymentBaseRank != null">payment_base_rank,</if>
<if test="paymentCountRank != null">payment_count_rank,</if>
<if test="paymentType != null">payment_type,</if>
<if test="insuranceStatus != null">insurance_status,</if>
<if test="recentTwoYearsCount != null">recent_two_years_count,</if>
<if test="recentOneYearsCount != null">recent_one_years_count,</if>
<if test="paymentBase != null">payment_base,</if>
<if test="blackList != null">black_list,</if>
<if test="labourArbitration != null">labour_arbitration,</if>
<if test="receivePensionBenefits != null">receive_pension_benefits,</if>
<if test="receiveUnemploymentBenefits != null">receive_unemployment_benefits,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="custIdc != null">#{custIdc},</if>
<if test="paymentStatus != null">#{paymentStatus},</if>
<if test="unitType != null">#{unitType},</if>
<if test="belongBusi != null">#{belongBusi},</if>
<if test="economicType != null">#{economicType},</if>
<if test="qualityLabel != null">#{qualityLabel},</if>
<if test="paymentBaseRank != null">#{paymentBaseRank},</if>
<if test="paymentCountRank != null">#{paymentCountRank},</if>
<if test="paymentType != null">#{paymentType},</if>
<if test="insuranceStatus != null">#{insuranceStatus},</if>
<if test="recentTwoYearsCount != null">#{recentTwoYearsCount},</if>
<if test="recentOneYearsCount != null">#{recentOneYearsCount},</if>
<if test="paymentBase != null">#{paymentBase},</if>
<if test="blackList != null">#{blackList},</if>
<if test="labourArbitration != null">#{labourArbitration},</if>
<if test="receivePensionBenefits != null">#{receivePensionBenefits},</if>
<if test="receiveUnemploymentBenefits != null">#{receiveUnemploymentBenefits},</if>
</trim>
</insert>
<update id="updateSocialSecurity" parameterType="SocialSecurity">
update social_security
<trim prefix="SET" suffixOverrides=",">
<if test="custIdc != null">cust_idc = #{custIdc},</if>
<if test="paymentStatus != null">payment_status = #{paymentStatus},</if>
<if test="unitType != null">unit_type = #{unitType},</if>
<if test="belongBusi != null">belong_busi = #{belongBusi},</if>
<if test="economicType != null">economic_type = #{economicType},</if>
<if test="qualityLabel != null">quality_label = #{qualityLabel},</if>
<if test="paymentBaseRank != null">payment_base_rank = #{paymentBaseRank},</if>
<if test="paymentCountRank != null">payment_count_rank = #{paymentCountRank},</if>
<if test="paymentType != null">payment_type = #{paymentType},</if>
<if test="insuranceStatus != null">insurance_status = #{insuranceStatus},</if>
<if test="recentTwoYearsCount != null">recent_two_years_count = #{recentTwoYearsCount},</if>
<if test="recentOneYearsCount != null">recent_one_years_count = #{recentOneYearsCount},</if>
<if test="paymentBase != null">payment_base = #{paymentBase},</if>
<if test="blackList != null">black_list = #{blackList},</if>
<if test="labourArbitration != null">labour_arbitration = #{labourArbitration},</if>
<if test="receivePensionBenefits != null">receive_pension_benefits = #{receivePensionBenefits},</if>
<if test="receiveUnemploymentBenefits != null">receive_unemployment_benefits = #{receiveUnemploymentBenefits},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteSocialSecurityById" parameterType="Long">
delete from social_security where id = #{id}
</delete>
<delete id="deleteSocialSecurityByIds" parameterType="String">
delete from social_security where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@@ -0,0 +1,333 @@
<?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.SysCampaignGroupCustomerMapper">
<resultMap type="SysCampaignGroupCustomer" id="SysCampaignGroupCustomerResult">
<result property="id" column="id"/>
<result property="custId" column="cust_id"/>
<result property="campaignId" column="campaign_id"/>
<result property="groupId" column="group_id"/>
<result property="deptId" column="dept_id"/>
<result property="userId" column="user_id"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time"/>
<result property="remark" column="remark"/>
<result property="delFlag" column="del_flag"/>
<result property="gridId" column="grid_id"/>
<result property="listType" column="list_type"/>
<result property="pushStatus" column="push_status"/>
<result property="orgClaimStatus" column="org_claim_status"/>
<result property="orgDistributeStatus" column="org_distribute_status"/>
<result property="custClaimStatus" column="cust_claim_status"/>
<result property="createRole" column="create_role"/>
<result property="gridName" column="grid_name"/>
<result property="gridName2" column="grid_name2"/>
<result property="outlets" column="outlets"/>
<result property="custIdc" column="cust_idc"/>
<result property="secondPushStatus" column="second_push_status"/>
<result property="socialCreditCode" column="social_credit_code" />
<result property="custPhone" column="cust_phone" />
<result property="outletsId" column="outlets_id"/>
</resultMap>
<sql id="selectSysCampaignGroupCustomerVo">
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
</sql>
<select id="selectSysCampaignGroupCustomerList" parameterType="SysCampaignGroupCustomer"
resultMap="SysCampaignGroupCustomerResult">
<include refid="selectSysCampaignGroupCustomerVo"/>
<where>
<if test="custId != null and custId != ''">and cust_id = #{custId}</if>
<if test="campaignId != null and campaignId != ''">and campaign_id = #{campaignId}</if>
<if test="groupId != null and groupId != ''">and group_id = #{groupId}</if>
<if test="deptId != null ">and dept_id = #{deptId}</if>
<if test="outletsId != null ">and outlets_id = #{outletsId}</if>
<if test="userId != null ">and user_id = #{userId}</if>
<if test="deptFlag != null ">and user_id is null </if>
<if test="gridId != null ">and grid_id = #{gridId}</if>
<if test="listType != null and listType != ''">and list_type = #{listType}</if>
<if test="pushStatus != null and pushStatus != ''">and push_status = #{pushStatus}</if>
<if test="secondPushStatus != null and secondPushStatus != ''">and second_push_status = #{secondPushStatus}</if>
<if test="orgDistributeStatus != null and orgDistributeStatus != ''">and org_distribute_status = #{orgDistributeStatus}</if>
<if test="createRole != null and createRole != ''">and create_role = #{createRole}</if>
</where>
</select>
<select id="selectSysCampaignGroupCustomerList2" parameterType="SysCampaignGroupCustomer"
resultMap="SysCampaignGroupCustomerResult">
<include refid="selectSysCampaignGroupCustomerVo"/>
<where>
<if test="custId != null and custId != ''">and cust_id = #{custId}</if>
<if test="campaignId != null and campaignId != ''">and campaign_id = #{campaignId}</if>
<if test="groupId != null and groupId != ''">and group_id = #{groupId}</if>
<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="gridId != null ">and grid_id = #{gridId}</if>
<if test="listType != null and listType != ''">and list_type = #{listType}</if>
<if test="pushStatus != null and pushStatus != ''">and push_status = #{pushStatus}</if>
<if test="createRole != null and createRole != ''">and create_role = #{createRole}</if>
</where>
</select>
<select id="selectSysCampaignGroupCustomerById" parameterType="Long" resultMap="SysCampaignGroupCustomerResult">
<include refid="selectSysCampaignGroupCustomerVo"/>
where id = #{id}
</select>
<insert id="insertSysCampaignGroupCustomer" parameterType="SysCampaignGroupCustomer" useGeneratedKeys="true"
keyProperty="id">
insert into sys_campaign_group_customer
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="custId != null">cust_id,</if>
<if test="campaignId != null">campaign_id,</if>
<if test="groupId != null">group_id,</if>
<if test="deptId != null">dept_id,</if>
<if test="userId != null">user_id,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="remark != null">remark,</if>
<if test="delFlag != null">del_flag,</if>
<if test="gridId != null">grid_id,</if>
<if test="listType != null">list_type,</if>
<if test="pushStatus != null">push_status,</if>
<if test="orgClaimStatus != null">org_claim_status,</if>
<if test="orgDistributeStatus != null">org_distribute_status,</if>
<if test="custClaimStatus != null">cust_claim_status,</if>
<if test="createRole != null">create_role,</if>
<if test="gridName!= null">grid_name,</if>
<if test="gridName2 != null">grid_name2,</if>
<if test="outlets != null">outlets,</if>
<if test="custIdc != null">cust_idc,</if>
<if test="secondPushStatus != null">second_push_status,</if>
<if test="socialCreditCode != null">social_credit_code,</if>
<if test="custPhone != null">cust_phone,</if>
<if test="outletsId != null">outlets_id,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="custId != null">#{custId},</if>
<if test="campaignId != null">#{campaignId},</if>
<if test="groupId != null">#{groupId},</if>
<if test="deptId != null">#{deptId},</if>
<if test="userId != null">#{userId},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="remark != null">#{remark},</if>
<if test="delFlag != null">#{delFlag},</if>
<if test="gridId != null">#{gridId},</if>
<if test="listType != null">#{listType},</if>
<if test="pushStatus != null">#{pushStatus},</if>
<if test="orgClaimStatus != null">#{orgClaimStatus},</if>
<if test="orgDistributeStatus != null">#{orgDistributeStatus},</if>
<if test="custClaimStatus != null">#{custClaimStatus},</if>
<if test="createRole != null">#{createRole},</if>
<if test="gridName != null">#{gridName},</if>
<if test="gridName2 != null">#{gridName2},</if>
<if test="outlets != null">#{outlets},</if>
<if test="custIdc != null">#{custIdc},</if>
<if test="secondPushStatus != null">#{secondPushStatus},</if>
<if test="socialCreditCode != null">#{socialCreditCode},</if>
<if test="custPhone != null">#{custPhone},</if>
<if test="outletsId != null">#{outletsId},</if>
</trim>
</insert>
<insert id="insertSysCampaignGroupCustomerBatch" parameterType="java.util.List" useGeneratedKeys="true" keyProperty="id">
insert into sys_campaign_group_customer
(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,cust_name,lp_name,cust_isn)
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}
,#{item.custName},#{item.lpName},#{item.custIsn})
</foreach>
</insert>
<insert id="insertHeadHandledMission" >
insert into head_handled_mission (campaign_id, create_time, create_by)
values (#{campaignId},sysdate(),#{userName})
</insert>
<update id="updateSysCampaignGroupCustomer" parameterType="SysCampaignGroupCustomer">
update sys_campaign_group_customer
<trim prefix="SET" suffixOverrides=",">
<if test="custId != null">cust_id = #{custId},</if>
<if test="campaignId != null">campaign_id = #{campaignId},</if>
<if test="groupId != null">group_id = #{groupId},</if>
<if test="deptId != null">dept_id = #{deptId},</if>
<if test="userId != null">user_id = #{userId},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="delFlag != null">del_flag = #{delFlag},</if>
<if test="gridId != null">grid_id = #{gridId},</if>
<if test="listType != null">list_type = #{listType},</if>
<if test="pushStatus != null">push_status = #{pushStatus},</if>
<if test="orgClaimStatus != null">org_claim_status = #{orgClaimStatus},</if>
<if test="orgDistributeStatus != null">org_distribute_status = #{orgDistributeStatus},</if>
<if test="custClaimStatus != null">cust_claim_status = #{custClaimStatus},</if>
<if test="createRole != null">create_role = #{createRole},</if>
<if test="gridName != null">grid_name = #{gridName},</if>
<if test="gridName2 != null">grid_name2 = #{gridName2},</if>
<if test="outlets != null">outlets = #{outlets},</if>
<if test="custIdc != null">cust_idc = #{custIdc},</if>
<if test="secondPushStatus != null">second_push_status = #{secondPushStatus},</if>
<if test="socialCreditCode != null">social_credit_code = #{socialCreditCode},</if>
<if test="custPhone != null">cust_phone = #{custPhone},</if>
<if test="outletsId != null">outlets_id = #{outletsId},</if>
</trim>
where id = #{id}
</update>
<update id="updateSysCampaignGroupCustomerBatch">
<foreach collection="list" item="item" separator=";">
update sys_campaign_group_customer
<set>
<if test="item.custId != null">cust_id = #{item.custId},</if>
<if test="item.campaignId != null">campaign_id = #{item.campaignId},</if>
<if test="item.groupId != null">group_id = #{item.groupId},</if>
<if test="item.deptId != null">dept_id = #{item.deptId},</if>
<if test="item.userId != null">user_id = #{item.userId},</if>
<if test="item.createBy != null">create_by = #{item.createBy},</if>
<if test="item.createTime != null">create_time = #{item.createTime},</if>
<if test="item.updateBy != null">update_by = #{item.updateBy},</if>
<if test="item.updateTime != null">update_time = #{item.updateTime},</if>
<if test="item.remark != null">remark = #{item.remark},</if>
<if test="item.delFlag != null">del_flag = #{item.delFlag},</if>
<if test="item.gridId != null">grid_id = #{item.gridId},</if>
<if test="item.listType != null">list_type = #{item.listType},</if>
<if test="item.pushStatus != null">push_status = #{item.pushStatus},</if>
<if test="item.orgClaimStatus != null">org_claim_status = #{item.orgClaimStatus},</if>
<if test="item.orgDistributeStatus != null">org_distribute_status = #{item.orgDistributeStatus},</if>
<if test="item.custClaimStatus != null">cust_claim_status = #{item.custClaimStatus},</if>
<if test="item.createRole != null">create_role = #{item.createRole},</if>
<if test="item.gridName != null">grid_name = #{item.gridName},</if>
<if test="item.gridName2 != null">grid_name2 = #{item.gridName2},</if>
<if test="item.outlets != null">outlets = #{item.outlets},</if>
<if test="item.custIdc != null">cust_idc = #{item.custIdc},</if>
<if test="item.secondPushStatus != null">second_push_status = #{item.secondPushStatus},</if>
<if test="item.socialCreditCode != null">social_credit_code = #{item.socialCreditCode},</if>
<if test="item.custPhone != null">cust_phone = #{item.custPhone},</if>
<if test="item.outletsId != null">outlets_id = #{item.outletsId},</if>
<if test="item.pushUserLevel != null">push_user_level = #{item.pushUserLevel},</if>
</set>
<where>
id = #{item.id}
</where>
</foreach>
</update>
<delete id="deleteSysCampaignGroupCustomerById" parameterType="Long">
delete
from sys_campaign_group_customer
where id = #{id}
</delete>
<delete id="deleteSysCampaignGroupCustomerByIds" parameterType="String">
delete from sys_campaign_group_customer where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<select id="getDeptIdByUserId" parameterType="Long" resultType="java.lang.Long">
select dept_id
from sys_user
where user_Id = #{userId}
</select>
<select id="getReceiveUserNum" resultType="java.lang.String">
select distinct user_id from sys_campaign_group_customer where group_id = #{groupId} and campaign_id = #{campaignId} and cust_claim_status = '1'
and case when #{deptId} is null then org_claim_status not in ('0','1')
and dept_id in (select dept_id from sys_dept where dept_id = #{userDept} or find_in_set(#{userDept},ancestors))
when #{deptId} is not null then dept_id = #{deptId} and org_claim_status in ('0','1')
else 1=1 end
</select>
<select id="getAllUserNum" resultType="java.lang.String">
select distinct user_id from sys_campaign_group_customer where group_id = #{groupId} and campaign_id = #{campaignId}
and case when #{deptId} is null then org_claim_status not in ('0','1')
and dept_id in (select dept_id from sys_dept where dept_id = #{userDept} or find_in_set(#{userDept},ancestors))
when #{deptId} is not null then dept_id = #{deptId} and org_claim_status in ('0','1')
else 1=1 end
</select>
<select id="getReceiveUserNumOutlet" resultType="java.lang.String">
select distinct user_id from sys_campaign_group_customer where group_id = #{groupId} and campaign_id = #{campaignId} and cust_claim_status = '1'
and outlets_id =#{userDept}
</select>
<select id="getAllUserNumOutlet" resultType="java.lang.String">
select distinct user_id from sys_campaign_group_customer where group_id = #{groupId} and campaign_id = #{campaignId}
and outlets_id =#{userDept}
</select>
<select id="getUserInfoList" parameterType="ListSelectForUser">
select distinct b.nick_name from sys_campaign_group_customer a ,sys_user b where a.group_id = #{groupId} and a.cust_id = #{custId} and a.user_id=b.user_id
</select>
<select id="getGroupCustIdByGroupId">
select distinct cust_id from sys_campaign_group_customer where group_id = #{groupId}
and case when #{deptId} is null then user_id is not null else (dept_id = #{deptId} and user_id is null) end
</select>
<select id="selectSysCampaignGroupCustomerListUnsuccess" parameterType="SysCampaignGroupCustomer"
resultMap="SysCampaignGroupCustomerResult">
<include refid="selectSysCampaignGroupCustomerVo"/>
<where>
user_id is null
<if test="custId != null and custId != ''">and cust_id = #{custId}</if>
<if test="campaignId != null and campaignId != ''">and campaign_id = #{campaignId}</if>
<if test="groupId != null and groupId != ''">and group_id = #{groupId}</if>
<if test="deptId != null ">and dept_id = #{deptId}</if>
<if test="outletsId != null ">and outlets_id = #{outletsId}</if>
<if test="userId != null ">and user_id = #{userId}</if>
<if test="createRole != null and createRole != ''">and create_role = #{createRole}</if>
</where>
</select>
</mapper>

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,150 @@
<?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.SysGroupBusinessMapper">
<resultMap type="SysGroupBusiness" id="SysGroupBusinessResult">
<result property="id" column="id" />
<result property="groupId" column="group_id" />
<result property="custId" column="cust_id" />
<result property="custName" column="cust_name" />
<result property="custIdc" column="cust_idc" />
<result property="deptId" column="dept_id" />
<result property="userId" column="user_id" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="remark" column="remark" />
<result property="delFlag" column="del_flag" />
<result property="pushStatus" column="push_status" />
<result property="custPhone" column="cust_phone" />
<result property="gridName1" column="grid_name1" />
<result property="userName" column="user_name" />
<result property="custIsn" column="cust_isn" />
<result property="deptName" column="dept_name" />
<result property="gridName2" column="grid_name2" />
<result property="lpName" column="lp_name" />
<result property="socialCreditCode" column="social_credit_code" />
</resultMap>
<sql id="selectSysGroupBusinessVo">
select id, group_id, cust_id, cust_name, cust_idc, dept_id, user_id, create_by, create_time, update_by, update_time, remark, del_flag, push_status, cust_phone, grid_name1, user_name, cust_isn, dept_name, grid_name2, lp_name, social_credit_code from sys_group_business
</sql>
<select id="selectSysGroupBusinessList" parameterType="SysGroupBusiness" resultMap="SysGroupBusinessResult">
<include refid="selectSysGroupBusinessVo"/>
<where>
<if test="groupId != null and groupId != ''"> and group_id = #{groupId}</if>
<if test="custId != null and custId != ''"> and cust_id = #{custId}</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="deptId != null "> and dept_id = #{deptId}</if>
<if test="userId != null "> and user_id = #{userId}</if>
<if test="pushStatus != null and pushStatus != ''"> and push_status = #{pushStatus}</if>
<if test="custPhone != null and custPhone != ''"> and cust_phone = #{custPhone}</if>
<if test="gridName1 != null and gridName1 != ''"> and grid_name1 = #{gridName1}</if>
<if test="userName != null and userName != ''"> and user_name like concat('%', #{userName}, '%')</if>
<if test="custIsn != null and custIsn != ''"> and cust_isn = #{custIsn}</if>
<if test="deptName != null and deptName != ''"> and dept_name like concat('%', #{deptName}, '%')</if>
<if test="gridName2 != null and gridName2 != ''"> and grid_name2 = #{gridName2}</if>
<if test="lpName != null and lpName != ''"> and lp_name like concat('%', #{lpName}, '%')</if>
<if test="socialCreditCode != null and socialCreditCode != ''"> and social_credit_code = #{socialCreditCode}</if>
</where>
</select>
<select id="selectSysGroupBusinessById" parameterType="Long" resultMap="SysGroupBusinessResult">
<include refid="selectSysGroupBusinessVo"/>
where id = #{id}
</select>
<insert id="insertSysGroupBusiness" parameterType="SysGroupBusiness" useGeneratedKeys="true" keyProperty="id">
insert into sys_group_business
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="groupId != null">group_id,</if>
<if test="custId != null">cust_id,</if>
<if test="custName != null">cust_name,</if>
<if test="custIdc != null">cust_idc,</if>
<if test="deptId != null">dept_id,</if>
<if test="userId != null">user_id,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="remark != null">remark,</if>
<if test="delFlag != null">del_flag,</if>
<if test="pushStatus != null">push_status,</if>
<if test="custPhone != null">cust_phone,</if>
<if test="gridName1 != null">grid_name1,</if>
<if test="userName != null">user_name,</if>
<if test="custIsn != null">cust_isn,</if>
<if test="deptName != null">dept_name,</if>
<if test="gridName2 != null">grid_name2,</if>
<if test="lpName != null">lp_name,</if>
<if test="socialCreditCode != null">social_credit_code,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="groupId != null">#{groupId},</if>
<if test="custId != null">#{custId},</if>
<if test="custName != null">#{custName},</if>
<if test="custIdc != null">#{custIdc},</if>
<if test="deptId != null">#{deptId},</if>
<if test="userId != null">#{userId},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="remark != null">#{remark},</if>
<if test="delFlag != null">#{delFlag},</if>
<if test="pushStatus != null">#{pushStatus},</if>
<if test="custPhone != null">#{custPhone},</if>
<if test="gridName1 != null">#{gridName1},</if>
<if test="userName != null">#{userName},</if>
<if test="custIsn != null">#{custIsn},</if>
<if test="deptName != null">#{deptName},</if>
<if test="gridName2 != null">#{gridName2},</if>
<if test="lpName != null">#{lpName},</if>
<if test="socialCreditCode != null">#{socialCreditCode},</if>
</trim>
</insert>
<update id="updateSysGroupBusiness" parameterType="SysGroupBusiness">
update sys_group_business
<trim prefix="SET" suffixOverrides=",">
<if test="groupId != null">group_id = #{groupId},</if>
<if test="custId != null">cust_id = #{custId},</if>
<if test="custName != null">cust_name = #{custName},</if>
<if test="custIdc != null">cust_idc = #{custIdc},</if>
<if test="deptId != null">dept_id = #{deptId},</if>
<if test="userId != null">user_id = #{userId},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="delFlag != null">del_flag = #{delFlag},</if>
<if test="pushStatus != null">push_status = #{pushStatus},</if>
<if test="custPhone != null">cust_phone = #{custPhone},</if>
<if test="gridName1 != null">grid_name1 = #{gridName1},</if>
<if test="userName != null">user_name = #{userName},</if>
<if test="custIsn != null">cust_isn = #{custIsn},</if>
<if test="deptName != null">dept_name = #{deptName},</if>
<if test="gridName2 != null">grid_name2 = #{gridName2},</if>
<if test="lpName != null">lp_name = #{lpName},</if>
<if test="socialCreditCode != null">social_credit_code = #{socialCreditCode},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteSysGroupBusinessById" parameterType="Long">
delete from sys_group_business where id = #{id}
</delete>
<delete id="deleteSysGroupBusinessByIds" parameterType="String">
delete from sys_group_business where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@@ -0,0 +1,465 @@
<?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.SysGroupCustomerMapper">
<resultMap type="SysGroupCustomer" id="SysGroupCustomerResult">
<result property="id" column="id" />
<result property="groupId" column="group_id" />
<result property="custId" column="cust_id" />
<result property="custName" column="cust_name" />
<result property="custIdc" column="cust_idc" />
<result property="deptId" column="dept_id" />
<result property="userId" column="user_id" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="remark" column="remark" />
<result property="delFlag" column="del_flag" />
<result property="gridId" column="grid_id" />
<result property="pushStatus" column="push_status" />
<result property="custPhone" column="cust_phone" />
<result property="gridName" column="grid_name" />
<result property="userName" column="user_name" />
<result property="custIsn" column="cust_isn" />
<result property="deptName" column="deptName" />
<result property="tellerId" column="teller_id" />
<result property="gridName2" column="grid_name2" />
<result property="idType" column="id_type" />
<result property="outlets" column="outlets" />
<result property="lpName" column="lp_name" />
<result property="socialCreditCode" column="social_credit_code" />
<result property="socialCreditCodeType" column="social_credit_code_type" />
<result property="custType" column="cust_type" />
<result property="outletsId" column="outlets_id" />
</resultMap>
<resultMap type="CustomerList" id="CustomerList">
<result property="groupName" column="group_name" />
<result property="custId" column="cust_id" />
<result property="custIdc" column="cust_idc" />
<result property="custIsn" column="cust_isn" />
<result property="custName" column="cust_name" />
<result property="custPhone" column="cust_phone" />
<result property="pushStatus" column="push_status" />
<result property="gridName" column="grid_name" />
<result property="gridName2" column="grid_name2" />
<result property="userName" column="user_name" />
<result property="deptName" column="dept_name" />
<result property="groupId" column="group_id" />
<result property="outlets" column="outlets" />
<result property="tellerId" column="teller_id" />
<result property="lpName" column="lp_name" />
<result property="socialCreditCode" column="social_credit_code" />
<result property="idType" column="id_type" />
<result property="custType" column="cust_type" />
<result property="socialCreditCodeType" column="social_credit_code_type" />
<result property="createTime" column="create_time" />
<result property="custLb" column="cust_lb" />
<result property="deptId" column="dept_id" />
</resultMap>
<sql id="selectSysGroupCustomerVo">
select id, group_id, cust_id, cust_name, cust_idc, dept_id, user_id, create_by, create_time, update_by, update_time, remark, del_flag, grid_id,
push_status, cust_phone, grid_name, user_name,cust_isn,dept_name,teller_id,grid_name2,id_type,outlets,lp_name,social_credit_code,social_credit_code_type,cust_type,outlets_id
from sys_group_customer
</sql>
<select id="selectSysGroupCustomerList" parameterType="SysGroupCustomer" resultMap="SysGroupCustomerResult">
<include refid="selectSysGroupCustomerVo"/>
<where>
<if test="groupId != null and groupId != ''"> and group_id = #{groupId}</if>
<if test="custId != null and custId != ''"> and cust_id = #{custId}</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="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="gridId != null "> and grid_id = #{gridId}</if>
<if test="pushStatus != null and pushStatus != ''"> and push_status = #{pushStatus}</if>
<if test="custPhone != null and custPhone != ''"> and cust_phone = #{custPhone}</if>
<if test="gridName != null and gridName != ''"> and grid_name like concat('%', #{gridName}, '%')</if>
<if test="userName != null and userName != ''"> and user_name like concat('%', #{userName}, '%')</if>
<if test="deptName != null and deptName != ''"> and dept_name like concat('%', #{deptName}, '%')</if>
</where>
</select>
<select id="selectSysGroupCustomerListIds" resultMap="SysGroupCustomerResult">
select distinct sgc.cust_id, sgc.cust_name, sgc.cust_idc, sgc.dept_id, su.user_id as user_id, sgc.del_flag, sgc.grid_id,
sgc.push_status, sgc.cust_phone, sgc.grid_name, sgc.user_name,sgc.cust_isn,sgc.dept_name,
sgc.teller_id,sgc.grid_name2,sgc.id_type,sgc.outlets,sgc.lp_name,sgc.social_credit_code,
sgc.social_credit_code_type,sgc.cust_type, sgc.outlets_id
from sys_group_customer sgc
left join sys_campaign_group scg on scg.group_id = sgc.group_id
left join sys_campaign_group_customer scgc on scg.campaign_id = scgc.campaign_id
left join sys_user su on sgc.teller_id = su.user_name
<where>
sgc.push_status = '1' and
sgc.group_id in
<foreach collection="groupIds" item="id" open="(" separator="," close=")">
#{id}
</foreach>
<if test="custFlag != null and custFlag !='' ">
and sgc.cust_id in
<foreach collection="custIds" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="filter != null and filter != ''"> and scgc.user_id is null </if>
</where>
</select>
<select id="selectSysGroupCustomerList2" parameterType="SysGroupCustomer" resultMap="SysGroupCustomerResult">
<include refid="selectSysGroupCustomerVo"/>
<where>
<if test="groupId != null and groupId != ''"> and group_id = #{groupId}</if>
<if test="custId != null and custId != ''"> and cust_id = #{custId}</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="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="gridId != null "> and grid_id = #{gridId}</if>
<if test="pushStatus != null and pushStatus != ''"> and push_status = #{pushStatus}</if>
<if test="custPhone != null and custPhone != ''"> and cust_phone = #{custPhone}</if>
<if test="gridName != null and gridName != ''"> and grid_name like concat('%', #{gridName}, '%')</if>
<if test="userName != null and userName != ''"> and user_name like concat('%', #{userName}, '%')</if>
<if test="deptName != null and deptName != ''"> and dept_name like concat('%', #{deptName}, '%')</if>
</where>
</select>
<select id="selectSysGroupCustomerListExport" resultMap="CustomerList">
select
sg.group_id,sg.group_name,
sgc.cust_name,
sgc.cust_phone,
sgc.cust_id,
sgc.cust_idc,sgc.cust_isn,
sgc.push_status,
sgc.grid_name ,
sgc.grid_name2 ,
sgc.user_name,
sgc.dept_name,
sgc.teller_id,sgc.outlets,sgc.id_type,sg.cust_type,sgc.lp_name,sgc.social_credit_code
from
sys_group_customer sgc
inner join sys_group sg on
sgc.group_id = sg.group_id
<where>
1 = 1
<if test="groupId != null and groupId != ''">
and sgc.group_id = #{groupId}
</if>
<if test="pushStatus != null and pushStatus != ''">
and sgc.push_status = #{pushStatus}
</if>
</where>
</select>
<select id="selectSysGroupCustomerListExportByCustIds" resultMap="CustomerList">
select
sg.group_id,sg.group_name,
sgc.cust_name,
sgc.cust_phone,
sgc.cust_id,
sgc.cust_idc,sgc.cust_isn,
sgc.push_status,
sgc.grid_name ,
sgc.grid_name2 ,
sgc.user_name,
sgc.dept_name,
sgc.teller_id,sgc.outlets,sgc.id_type,sg.cust_type,sgc.lp_name,sgc.social_credit_code,sgc.create_time,sgc.dept_id,sgc.social_credit_code_type,
CASE sgc.cust_lb
WHEN 0 THEN '是'
WHEN 1 THEN '否'
END AS cust_lb
from
sys_group_customer sgc
inner join sys_group sg on
sgc.group_id = sg.group_id
<where>
<if test="groupId != null and groupId != ''">
sgc.group_id = #{groupId}
</if>
and sgc.cust_id in <foreach collection="custIds" index="index" item="item" open="(" separator="," close=")">#{item}</foreach>
</where>
</select>
<select id="selectSysGroupCustomerById" parameterType="Long" resultMap="SysGroupCustomerResult">
<include refid="selectSysGroupCustomerVo"/>
where id = #{id}
</select>
<insert id="insertSysGroupCustomer" parameterType="SysGroupCustomer" useGeneratedKeys="true" keyProperty="id">
insert into sys_group_customer
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="groupId != null">group_id,</if>
<if test="custId != null">cust_id,</if>
<if test="custName != null">cust_name,</if>
<if test="custIdc != null">cust_idc,</if>
<if test="deptId != null">dept_id,</if>
<if test="userId != null">user_id,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="remark != null">remark,</if>
<if test="delFlag != null">del_flag,</if>
<if test="gridId != null">grid_id,</if>
<if test="pushStatus != null">push_status,</if>
<if test="custPhone != null">cust_phone,</if>
<if test="gridName != null">grid_name,</if>
<if test="userName != null">user_name,</if>
<if test="custIsn != null">cust_isn,</if>
<if test="deptName != null">dept_name,</if>
<if test="tellerId != null">teller_id,</if>
<if test="gridName2 != null">grid_name2,</if>
<if test="idType != null">id_type,</if>
<if test="outlets != null">outlets,</if>
<if test="lpName != null">lp_name,</if>
<if test="socialCreditCode != null">social_credit_code,</if>
<if test="socialCreditCodeType != null">social_credit_code_type,</if>
<if test="custType != null">cust_type,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="groupId != null">#{groupId},</if>
<if test="custId != null">#{custId},</if>
<if test="custName != null">#{custName},</if>
<if test="custIdc != null">#{custIdc},</if>
<if test="deptId != null">#{deptId},</if>
<if test="userId != null">#{userId},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="remark != null">#{remark},</if>
<if test="delFlag != null">#{delFlag},</if>
<if test="gridId != null">#{gridId},</if>
<if test="pushStatus != null">#{pushStatus},</if>
<if test="custPhone != null">#{custPhone},</if>
<if test="gridName != null">#{gridName},</if>
<if test="userName != null">#{userName},</if>
<if test="custIsn != null">#{custIsn},</if>
<if test="deptName != null">#{deptName},</if>
<if test="tellerId != null">#{tellerId},</if>
<if test="gridName2 != null">#{gridName2},</if>
<if test="idType != null">#{idType},</if>
<if test="outlets != null">#{outlets},</if>
<if test="lpName != null">#{lpName},</if>
<if test="socialCreditCode != null">#{socialCreditCode},</if>
<if test="socialCreditCodeType != null">#{socialCreditCodeType},</if>
<if test="custType != null">#{custType},</if>
</trim>
</insert>
<update id="updateSysGroupCustomer" parameterType="SysGroupCustomer">
update sys_group_customer
<trim prefix="SET" suffixOverrides=",">
<if test="groupId != null">group_id = #{groupId},</if>
<if test="custId != null">cust_id = #{custId},</if>
<if test="custName != null">cust_name = #{custName},</if>
<if test="custIdc != null">cust_idc = #{custIdc},</if>
<if test="deptId != null">dept_id = #{deptId},</if>
<if test="userId != null">user_id = #{userId},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="delFlag != null">del_flag = #{delFlag},</if>
<if test="gridId != null">grid_id = #{gridId},</if>
<if test="pushStatus != null">push_status = #{pushStatus},</if>
<if test="custPhone != null">cust_phone = #{custPhone},</if>
<if test="gridName != null">grid_name = #{gridName},</if>
<if test="userName != null">user_name = #{userName},</if>
<if test="custIsn != null">cust_isn = #{custIsn},</if>
<if test="deptName != null">dept_name = #{deptName},</if>
<if test="tellerId != null">teller_id = #{tellerId},</if>
<if test="gridName2 != null">grid_name2 = #{gridName2},</if>
<if test="idType != null">id_type = #{idType},</if>
<if test="outlets != null">outlets = #{outlets},</if>
<if test="lpName != null">lp_name = #{lpName},</if>
<if test="socialCreditCode != null">social_credit_code = #{socialCreditCode},</if>
<if test="socialCreditCodeType != null">social_credit_code_type = #{socialCreditCodeType},</if>
<if test="custType != null">cust_type = #{custType},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteSysGroupCustomerById" parameterType="Long">
delete from sys_group_customer where id = #{id}
</delete>
<delete id="deleteSysGroupCustomerByIds" parameterType="String">
delete from sys_group_customer where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<select id="getCustNumByGroupId" parameterType="String">
select count(*) from sys_group_customer where group_id = #{groupId};
</select>
<select id="getUserInfoList" parameterType="ListSelectForUser">
select user_name from sys_group_customer where group_id = #{groupId} and cust_id = #{custId}
</select>
<select id="getGridInfoList" parameterType="ListSelectForUser">
select grid_name from sys_group_customer where group_id = #{groupId} and cust_id = #{custId}
</select>
<update id="updateOutletsIdAndUserIdByUsername" parameterType="String">
update sys_group_customer sgc set sgc.user_id = (select u.user_id from sys_user u where u.user_name = sgc.teller_id ),sgc.outlets_id = (select u.dept_id from sys_user u inner join sys_dept sd on u.dept_id = sd.dept_id where u.user_name = sgc.teller_id and sd.dept_type = 'outlet' ),sgc.outlets = (select sd.dept_name from sys_user u inner join sys_dept sd on u.dept_id = sd.dept_id where u.user_name = sgc.teller_id and sd.dept_type = 'outlet' ) where group_id = #{groupId}
</update>
<update id="updateCustIdAndCustIsn" parameterType="String">
<if test="custType == 0">
update sys_group_customer sgc set sgc.cust_id = (select cust_id from cust_info_retail c where c.cust_idc = sgc.cust_idc limit 1 ),sgc.cust_isn = (select cust_isn from cust_info_retail c where c.cust_idc = sgc.cust_idc limit 1) where group_id = #{groupId} and cust_idc in
<foreach item="id" collection="list" open="(" separator="," close=")">
#{id}
</foreach>
</if>
<if test="custType == 1">
update sys_group_customer sgc set sgc.cust_id = (select cust_id from cust_info_merchant c where c.cust_idc = sgc.cust_idc limit 1),sgc.cust_isn = (select cust_isn from cust_info_merchant c where c.cust_idc = sgc.cust_idc limit 1) where group_id = #{groupId} and cust_idc in
<foreach item="id" collection="list" open="(" separator="," close=")">
#{id}
</foreach>
</if>
<if test="custType == 2">
update sys_group_customer sgc set sgc.cust_id = (select cust_id from cust_info_business c where c.cust_idc = sgc.cust_idc limit 1),sgc.cust_isn = (select cust_isn from cust_info_business c where c.cust_idc = sgc.cust_idc limit 1) where group_id = #{groupId} and cust_idc in
<foreach item="id" collection="list" open="(" separator="," close=")">
#{id}
</foreach>
</if>
</update>
<select id="selectCustIds" parameterType="String" resultType="String">
<if test="custType == 0">
select cust_id from cust_info_retail c where c.cust_id in
<foreach item="id" collection="list" open="(" separator="," close=")">
#{id}
</foreach>
</if>
<if test="custType == 1">
select cust_id from cust_info_merchant c where c.cust_id in
<foreach item="id" collection="list" open="(" separator="," close=")">
#{id}
</foreach>
</if>
<if test="custType == 2">
select cust_id from cust_info_business c where c.cust_id in
<foreach item="id" collection="list" open="(" separator="," close=")">
#{id}
</foreach>
</if>
</select>
<update id="updateCustIdAndCustIsnBySocialCreditCode" parameterType="String">
<if test="custType == 1">
update sys_group_customer sgc set sgc.cust_id = (select cust_id from cust_info_merchant c where c.social_credit_code = sgc.social_credit_code limit 1),sgc.cust_isn = (select cust_isn from cust_info_merchant c where c.social_credit_code = sgc.social_credit_code limit 1) where group_id = #{groupId} and social_credit_code in
<foreach item="id" collection="list" open="(" separator="," close=")">
#{id}
</foreach>
</if>
<if test="custType == 2">
update sys_group_customer sgc set sgc.cust_id = (select cust_id from cust_info_business c where c.social_credit_code = sgc.social_credit_code limit 1),sgc.cust_isn = (select cust_isn from cust_info_business c where c.social_credit_code = sgc.social_credit_code limit 1) where group_id = #{groupId} and social_credit_code in
<foreach item="id" collection="list" open="(" separator="," close=")">
#{id}
</foreach>
</if>
</update>
<insert id="insertSysGroupCustomerBatch" parameterType="java.util.List" useGeneratedKeys="true" keyProperty="id">
insert into sys_group_customer
(group_id,cust_id,cust_name,cust_idc,dept_id,user_id,create_by,create_time,update_by,
update_time,remark,del_flag,grid_id,push_status,cust_phone,grid_name,user_name,cust_isn,
dept_name,teller_id,grid_name2,id_type,outlets,lp_name,social_credit_code,social_credit_code_type,cust_type,cust_lb,outlets_id)
values
<foreach collection="list" item="item" index="index" separator=",">
(#{item.groupId},#{item.custId},#{item.custName},#{item.custIdc},#{item.deptId},#{item.userId},#{item.createBy},#{item.createTime},
#{item.updateBy},#{item.updateTime},#{item.remark},#{item.delFlag},#{item.gridId},#{item.pushStatus},#{item.custPhone},#{item.gridName},
#{item.userName},#{item.custIsn},#{item.deptName},#{item.tellerId},#{item.gridName2},#{item.idType},#{item.outlets},#{item.lpName},
#{item.socialCreditCode},#{item.socialCreditCodeType},#{item.custType},#{item.custLb},#{item.outletsId})
</foreach>
</insert>
<update id="updateSysGroupCustomerBatch">
<foreach collection="list" item="item" separator=";">
update sys_group_customer
<set>
<if test="item.groupId != null">group_id = #{item.groupId},</if>
<if test="item.custId != null">cust_id = #{item.custId},</if>
<if test="item.custName != null">cust_name = #{item.custName},</if>
<if test="item.custIdc != null">cust_idc = #{item.custIdc},</if>
<if test="item.deptId != null">dept_id = #{item.deptId},</if>
<if test="item.userId != null">user_id = #{item.userId},</if>
<if test="item.createBy != null">create_by = #{item.createBy},</if>
<if test="item.createTime != null">create_time = #{item.createTime},</if>
<if test="item.updateBy != null">update_by = #{item.updateBy},</if>
<if test="item.updateTime != null">update_time = #{item.updateTime},</if>
<if test="item.remark != null">remark = #{item.remark},</if>
<if test="item.delFlag != null">del_flag = #{item.delFlag},</if>
<if test="item.gridId != null">grid_id = #{item.gridId},</if>
<if test="item.pushStatus != null">push_status = #{item.pushStatus},</if>
<if test="item.custPhone != null">cust_phone = #{item.custPhone},</if>
<if test="item.gridName != null">grid_name = #{item.gridName},</if>
<if test="item.userName != null">user_name = #{item.userName},</if>
<if test="item.custIsn != null">cust_isn = #{item.custIsn},</if>
<if test="item.deptName != null">dept_name = #{item.deptName},</if>
<if test="item.tellerId != null">teller_id = #{item.tellerId},</if>
<if test="item.gridName2 != null">grid_name2 = #{item.gridName2},</if>
<if test="item.idType != null">id_type = #{item.idType},</if>
<if test="item.outlets != null">outlets = #{item.outlets},</if>
<if test="item.lpName != null">lp_name = #{item.lpName},</if>
<if test="item.socialCreditCode != null">social_credit_code = #{item.socialCreditCode},</if>
<if test="item.socialCreditCodeType != null">social_credit_code_type = #{item.socialCreditCodeType},</if>
<if test="item.custType != null">cust_type = #{item.custType},</if>
</set>
<where>
id = #{item.id}
</where>
</foreach>
</update>
<select id="selectCustIdcBySocialCreditCode" parameterType="String" resultType="java.lang.String">
<if test="custType == 1">
select cust_idc from cust_info_merchant c where c.social_credit_code = #{socialCreditCode} limit 1
</if>
<if test="custType == 2">
select cust_idc from cust_info_business c where c.social_credit_code = #{socialCreditCode} limit 1
</if>
</select>
<select id="selectCustIdcList" resultMap="SysGroupCustomerResult">
<if test="custType == 0">
select group_id,cust_id,cust_idc,push_status from sys_group_customer where group_id = #{groupId} and cust_id in
</if>
<if test="custType == 1 or custType == 2">
select group_id,cust_id,social_credit_code,push_status from sys_group_customer where group_id = #{groupId} and cust_id in
</if>
<foreach collection="list" item="item" index="index" open="(" separator="," close=")">
#{item}
</foreach>
</select>
<delete id="deleteSysGroupCustomerByCustId" parameterType="String">
delete from sys_group_customer where group_id = #{groupId} and cust_id = #{custId} and push_status = "2"
</delete>
</mapper>

View File

@@ -0,0 +1,645 @@
<?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.SysGroupMapper">
<resultMap type="SysGroup" id="SysGroupResult">
<result property="id" column="id" />
<result property="groupName" column="group_name" />
<result property="createType" column="create_type" />
<result property="customerNum" column="customer_num" />
<result property="deptId" column="dept_id" />
<result property="userId" column="user_id" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="updateType" column="update_type" />
<result property="status" column="status" />
<result property="remark" column="remark" />
<result property="delFlag" column="del_flag" />
<result property="groupType" column="group_type" />
<result property="groupId" column="group_id" />
<result property="custType" column="cust_Type" />
<result property="createRole" column="create_role" />
</resultMap>
<resultMap type="SysGroupVo" id="SysGroupVoResult">
<result property="id" column="id" />
<result property="groupName" column="group_name" />
<result property="createType" column="create_type" />
<result property="customerNum" column="customer_num" />
<result property="deptId" column="dept_id" />
<result property="userId" column="user_id" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="updateType" column="update_type" />
<result property="status" column="status" />
<result property="remark" column="remark" />
<result property="delFlag" column="del_flag" />
<result property="groupType" column="group_type" />
<result property="groupId" column="group_id" />
<result property="custType" column="cust_Type" />
<result property="createRole" column="create_role" />
<result property="campaignId" column="campaign_id" />
<result property="labelIds" column="label_ids"/>
<result property="labelSql" column="label_sql"/>
</resultMap>
<resultMap type="SysGroupRec" id="SysGroupRecResult">
<result property="id" column="id" />
<result property="groupName" column="group_name" />
<result property="createType" column="create_type" />
<result property="customerNum" column="customer_num" />
<result property="deptId" column="dept_id" />
<result property="userId" column="user_id" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="updateType" column="update_type" />
<result property="status" column="status" />
<result property="remark" column="remark" />
<result property="delFlag" column="del_flag" />
<result property="groupId" column="group_id" />
<result property="custType" column="cust_Type" />
<result property="custId" column="cust_id" />
<result property="custIdc" column="cust_idc" />
<result property="custName" column="cust_name" />
<result property="custPhone" column="cust_phone" />
<result property="pushStatus" column="push_status" />
<result property="gridName" column="grid_name" />
<result property="deptName" column="dept_name" />
<result property="userName" column="user_name" />
<result property="campaignId" column="campaign_id" />
<result property="secondPushStatus" column="second_push_status" />
<result property="gridName2" column="grid_name2" />
<result property="lpName" column="lp_name" />
<result property="tellerId" column="teller_id" />
<result property="labelIds" column="label_ids"/>
<result property="labelSql" column="label_sql"/>
<result property="description" column="description"/>
<result property="updateTypeRelateTime" column="update_type_relate_time"/>
<result property="relateGroupId" column="relate_group_id"/>
</resultMap>
<resultMap type="CustomerList" id="CustomerList">
<result property="groupName" column="group_name" />
<result property="custId" column="cust_id" />
<result property="custIdc" column="cust_idc" />
<result property="custIsn" column="cust_isn" />
<result property="custName" column="cust_name" />
<result property="custPhone" column="cust_phone" />
<result property="pushStatus" column="push_status" />
<result property="gridName" column="grid_name" />
<result property="gridName2" column="grid_name2" />
<result property="userName" column="user_name" />
<result property="deptName" column="dept_name" />
<result property="deptId" column="dept_id" />
<result property="groupId" column="group_id" />
<result property="outlets" column="outlets" />
<result property="tellerId" column="teller_id" />
<result property="lpName" column="lp_name" />
<result property="socialCreditCode" column="social_credit_code" />
<result property="socialCreditCodeType" column="social_credit_code_type" />
<result property="idType" column="id_type" />
<result property="custType" column="cust_type" />
<result property="tellerNameWithId" column="teller_name_with_id" />
<result property="branchId" column="branch_id" />
<result property="branchName" column="branch_name" />
</resultMap>
<sql id="selectSysGroup">
select id,group_id, group_name, create_type, customer_num, dept_id, user_id, create_by, create_time, update_by, update_time, update_type, status, remark, del_flag,group_type,cust_type,create_role , label_ids,label_sql, description, update_type_relate_time, relate_group_id from sys_group
</sql>
<sql id="selectSysGroupVo">
select sg.id,sg.group_id, sg.group_name, sg.create_type, sg.customer_num, sg.dept_id, sg.user_id, concat(su.nick_name,'-',sg.create_by) as create_by, sg.create_time, sg.update_by, sg.update_time, sg.update_type, sg.status, sg.remark, sg.del_flag,sg.group_type,sg.cust_type,sg.create_role
from sys_group sg left join sys_user su on sg.create_by = su.user_name
</sql>
<select id="selectSysGroupList" parameterType="String" resultMap="SysGroupVoResult">
<include refid="selectSysGroupVo"/>
<where>
sg.del_flag = '0'
<if test="groupName != null and groupName != ''"> and sg.group_name like concat('%', #{groupName}, '%')</if>
<if test="deptId != null "> and sg.dept_id div 1000 = #{deptId}</if>
<if test="createBy != null "> and sg.create_by = #{createBy}</if>
<if test="type == 0 "> and sg.cust_type = '2' </if>
<if test="type == 1 "> and sg.cust_type != '2' </if>
</where>
order by sg.create_time desc
<if test="updateTimeSort == null "> ,update_time desc</if>
<if test="updateTimeSort == 0 "> ,update_time asc</if>
<if test="updateTimeSort == 1 "> , update_time desc</if>
<if test="customerNumSort == 0 "> , customer_num asc</if>
<if test="customerNumSort == 1 "> , customer_num desc</if>
</select>
<select id="selectSysGroupList1" parameterType="String" resultMap="SysGroupVoResult">
select sg.id,sg.group_id, sg.group_name, sg.create_type, sg.customer_num, sg.dept_id, sg.user_id, concat(su.nick_name,'-',sg.create_by) as create_by, sg.create_time, sg.update_by, sg.update_time, sg.update_type, sg.status, sg.remark, sg.del_flag,sg.group_type,sg.cust_type,sg.create_role
from sys_group sg left join sys_user su on sg.create_by = su.user_name
<where>
sg.del_flag = '0'
<if test="groupName != null and groupName != ''"> and sg.group_name like concat('%', #{groupName}, '%')</if>
<if test="deptId != null "> and sg.dept_id = #{deptId}</if>
<if test="createBy != null "> and sg.create_by = #{createBy}</if>
</where>
order by sg.create_time desc
<if test="updateTimeSort == null "> , update_time desc</if>
<if test="updateTimeSort == 0 "> , update_time asc</if>
<if test="updateTimeSort == 1 "> ,update_time desc</if>
<if test="customerNumSort == 0 "> , customer_num asc</if>
<if test="customerNumSort == 1 "> , customer_num desc</if>
</select>
<select id="selectSysGroupList5" parameterType="String" resultMap="CustomerList">
select scgc.group_id,sg.group_name,
sgc.cust_name,sgc.cust_phone ,scgc.cust_id,sgc.cust_idc,sgc.cust_isn,
scgc.push_status ,scgc.grid_name,scgc.grid_name2,
su.nick_name as user_name,sd.dept_name,su.user_name as teller_id,scgc.outlets,sgc.id_type,sg.cust_type,sgc.lp_name,sgc.social_credit_code,sgc.social_credit_code_type
from sys_campaign_group_customer scgc inner join sys_group_customer sgc on
scgc.group_id = sgc.group_id and scgc.cust_id = sgc.cust_id
inner join sys_group sg on scgc.group_id = sg.group_id inner join sys_dept sd on scgc.dept_id = sd.dept_id left join sys_user su on scgc.user_id = su.user_id
<where>
<if test="groupId != null and groupId != ''"> and scgc.group_id = #{groupId}</if>
<if test="deptId != null "> and scgc.dept_id = #{deptId}</if>
<if test="custId != null and custId != ''"> and scgc.cust_id like concat('%', #{custId}, '%') </if>
<if test="custIdc != null and custIdc != ''"> and sgc.cust_idc like concat('%', #{custIdc}, '%') </if>
<if test="custIsn != null and custIsn != ''"> and sgc.cust_isn like concat('%', #{custIsn}, '%') </if>
<if test="gridName != null and gridName != ''"> and scgc.grid_name like concat('%', #{gridName}, '%')</if>
<if test="gridName2 != null and gridName2 != ''"> and scgc.grid_name2 like concat('%', #{gridName2}, '%')</if>
<if test="custName != null and custName != ''"> and sgc.cust_name like concat('%', #{custName}, '%')</if>
<if test="deptName != null and deptName != ''"> and sd.dept_name like concat('%', #{deptName}, '%')</if>
<if test="outlets != null and outlets != ''"> and scgc.outlets like concat('%', #{outlets}, '%')</if>
<if test="username != null and username != ''"> and su.nick_name like concat('%', #{username}, '%')</if>
<if test="socialCreditCode != null and socialCreditCode != ''"> and sgc.social_credit_code like concat('%', #{socialCreditCode}, '%')</if>
<if test="pushStatus != null and pushStatus != ''"> and scgc.push_status = #{pushStatus}</if>
</where>
union all
select
sg.group_id,sg.group_name,
sgc.cust_name,
sgc.cust_phone,
sgc.cust_id,
sgc.cust_idc,sgc.cust_isn,
sgc.push_status,
sgc.grid_name ,
sgc.grid_name2 ,
sgc.user_name,
sgc.dept_name,
sgc.teller_id,sgc.outlets,sgc.id_type,sg.cust_type,sgc.lp_name,sgc.social_credit_code,sgc.social_credit_code_type
from
sys_group_customer sgc
inner join sys_group sg on
sgc.group_id = sg.group_id
left join sys_campaign sc on
sc.group_id = sgc.group_id
<where>
<if test="groupId != null and groupId != ''">
sgc.group_id = #{groupId}
</if>
<if test="deptId != null "> and sgc.dept_id = #{deptId}</if>
<if test="custId != null and custId != ''">
and sgc.cust_id like concat('%', #{custId}, '%')
</if>
<if test="custIdc != null and custIdc != ''"> and sgc.cust_idc like concat('%', #{custIdc}, '%')</if>
<if test="custIsn != null and custIsn != ''"> and sgc.cust_isn like concat('%', #{custIsn}, '%') </if>
<if test="gridName != null and gridName != ''"> and sgc.grid_name like concat('%', #{gridName}, '%')</if>
<if test="gridName2 != null and gridName2 != ''"> and sgc.grid_name2 like concat('%', #{gridName2}, '%')</if>
<if test="custName != null and custName != ''"> and sgc.cust_name like concat('%', #{custName}, '%')</if>
<if test="deptName != null and deptName != ''"> and sgc.dept_name like concat('%', #{deptName}, '%')</if>
<if test="outlets != null and outlets != ''"> and sgc.outlets like concat('%', #{outlets}, '%')</if>
<if test="username != null and username != ''"> and sgc.user_name like concat('%', #{username}, '%')</if>
<if test="socialCreditCode != null and socialCreditCode != ''"> and sgc.social_credit_code like concat('%', #{socialCreditCode}, '%')</if>
<if test="pushStatus == null or pushStatus ==''">
and (sgc.push_status = '0' or sgc.push_status = '2')
</if>
<if test="pushStatus != null and pushStatus != '' and pushStatus=='1'.toString()">
and sgc.push_status = '3'
</if>
<if test="pushStatus != null and pushStatus != '' and pushStatus!='1'.toString()">
and sgc.push_status = #{pushStatus}
</if>
</where>
</select>
<select id="selectSysGroupListImport" parameterType="String" resultMap="CustomerList">
select
sg.group_id,sg.group_name,
sgc.cust_name,
sgc.cust_phone,
sgc.cust_id,
sgc.cust_idc,sgc.cust_isn,
sgc.push_status,
sgc.grid_name ,
sgc.grid_name2 ,
sgc.user_name,
sgc.dept_name,
sgc.dept_id,
sgc.teller_id,sgc.outlets,sgc.id_type,sg.cust_type,sgc.lp_name,sgc.social_credit_code,sgc.social_credit_code_type,sgc.create_time, sgc.cust_lb, sgc.outlets_id,
sgc.remark,
CONCAT(su.nick_name, '-', su.user_name) as teller_name_with_id, dep.parent_id as branch_id, dep.parent_name as branch_name
from
sys_group_customer sgc
inner join sys_group sg on
sgc.group_id = sg.group_id
left join sys_user su on sgc.teller_id = su.user_name
left join
(SELECT
sd.dept_id,
sd.dept_name,
sd.parent_id,
sd_parent.dept_name AS parent_name
FROM sys_dept sd
LEFT JOIN sys_dept sd_parent ON sd.parent_id = sd_parent.dept_id
)dep on sgc.outlets_id = dep.dept_id
<where>
<if test="groupId != null and groupId != ''">
sgc.group_id = #{groupId}
</if>
<if test="deptId != null "> and sgc.dept_id = #{deptId}</if>
<if test="custId != null and custId != ''">
and sgc.cust_id like concat('%', #{custId}, '%')
</if>
<if test="custIdc != null and custIdc != ''"> and sgc.cust_idc like concat('%', #{custIdc}, '%')</if>
<if test="custName != null and custName != ''"> and sgc.cust_name like concat('%', #{custName}, '%')</if>
<if test="socialCreditCode != null and socialCreditCode != ''"> and sgc.social_credit_code like concat('%', #{socialCreditCode}, '%')</if>
<if test="tellerId != null and tellerId != ''"> and sgc.teller_id like concat('%', #{tellerId}, '%')</if>
<if test="pushStatus != null and pushStatus != ''"> and sgc.push_status = #{pushStatus}</if>
</where>
</select>
<select id="selectSysGroupList3" parameterType="String" resultMap="CustomerList">
select scgc.group_id,sg.group_name,
sgc.cust_name,sgc.cust_phone ,scgc.cust_id,sgc.cust_idc,sgc.cust_isn,
scgc.push_status ,scgc.grid_name,scgc.grid_name2,
su.nick_name as user_name,sd.dept_name,su.user_name as teller_id,scgc.outlets,sgc.id_type,sg.cust_type,sgc.lp_name,sgc.social_credit_code,sgc.social_credit_code_type
from sys_campaign_group_customer scgc inner join sys_group_customer sgc on
scgc.group_id = sgc.group_id and scgc.cust_id = sgc.cust_id
inner join sys_group sg on scgc.group_id = sg.group_id inner join sys_dept sd on scgc.dept_id = sd.dept_id left join sys_user su on scgc.user_id = su.user_id
<where>
<if test="groupId != null and groupId != ''"> and scgc.group_id = #{groupId}</if>
<if test="custId != null and custId != ''"> and scgc.cust_id like concat('%', #{custId}, '%') </if>
<if test="custIdc != null and custIdc != ''"> and sgc.cust_idc like concat('%', #{custIdc}, '%') </if>
<if test="custIsn != null and custIsn != ''"> and sgc.cust_isn like concat('%', #{custIsn}, '%') </if>
<if test="gridName != null and gridName != ''"> and scgc.grid_name like concat('%', #{gridName}, '%')</if>
<if test="gridName2 != null and gridName2 != ''"> and scgc.grid_name2 like concat('%', #{gridName2}, '%')</if>
<if test="custName != null and custName != ''"> and sgc.cust_name like concat('%', #{custName}, '%')</if>
<if test="deptName != null and deptName != ''"> and sd.dept_name like concat('%', #{deptName}, '%')</if>
<if test="outlets != null and outlets != ''"> and scgc.outlets like concat('%', #{outlets}, '%')</if>
<if test="username != null and username != ''"> and su.nick_name like concat('%', #{username}, '%')</if>
<if test="socialCreditCode != null and socialCreditCode != ''"> and sgc.social_credit_code like concat('%', #{socialCreditCode}, '%')</if>
<if test="pushStatus != null and pushStatus != ''"> and scgc.push_status = #{pushStatus}</if>
<if test="deptId != null and deptId != ''"> and scgc.dept_id in
(select dept_id from sys_dept where dept_id = #{deptId} or find_in_set(#{deptId},ancestors))
</if>
</where>
union all
select
sg.group_id,sg.group_name,
sgc.cust_name,
sgc.cust_phone,
sgc.cust_id,
sgc.cust_idc,sgc.cust_isn,
sgc.push_status,
sgc.grid_name ,
sgc.grid_name2 ,
sgc.user_name,
sgc.dept_name,
sgc.teller_id,sgc.outlets,sgc.id_type,sg.cust_type,sgc.lp_name,sgc.social_credit_code,sgc.social_credit_code_type
from
sys_group_customer sgc
inner join sys_group sg on
sgc.group_id = sg.group_id
left join sys_campaign sc on
sc.group_id = sgc.group_id
<where>
<if test="groupId != null and groupId != ''">
sgc.group_id = #{groupId}
</if>
<if test="custId != null and custId != ''">
and sgc.cust_id like concat('%', #{custId}, '%')
</if>
<if test="custIdc != null and custIdc != ''"> and sgc.cust_idc like concat('%', #{custIdc}, '%')</if>
<if test="custIsn != null and custIsn != ''"> and sgc.cust_isn like concat('%', #{custIsn}, '%') </if>
<if test="gridName != null and gridName != ''"> and sgc.grid_name like concat('%', #{gridName}, '%')</if>
<if test="gridName2 != null and gridName2 != ''"> and sgc.grid_name2 like concat('%', #{gridName2}, '%')</if>
<if test="custName != null and custName != ''"> and sgc.cust_name like concat('%', #{custName}, '%')</if>
<if test="deptName != null and deptName != ''"> and sgc.dept_name like concat('%', #{deptName}, '%')</if>
<if test="outlets != null and outlets != ''"> and sgc.outlets like concat('%', #{outlets}, '%')</if>
<if test="username != null and username != ''"> and sgc.user_name like concat('%', #{username}, '%')</if>
<if test="socialCreditCode != null and socialCreditCode != ''"> and sgc.social_credit_code like concat('%', #{socialCreditCode}, '%')</if>
<if test="pushStatus == null or pushStatus ==''">
and (sgc.push_status = '0' or sgc.push_status = '2')
</if>
<if test="pushStatus != null and pushStatus != '' and pushStatus=='1'.toString()">
and sgc.push_status = '3'
</if>
<if test="pushStatus != null and pushStatus != '' and pushStatus!='1'.toString()">
and sgc.push_status = #{pushStatus}
</if>
</where>
</select>
<select id="selectSysGroupList2" parameterType="String" resultMap="CustomerList">
select scgc.group_id,sg.group_name,
sgc.cust_name,sgc.cust_phone ,scgc.cust_id,sgc.cust_idc,sgc.cust_isn,
sgc.remark,
scgc.push_status ,scgc.grid_name,scgc.grid_name2,
su.nick_name as user_name,sd.dept_name,su.user_name as teller_id,scgc.outlets,sgc.id_type,sg.cust_type,sgc.lp_name,sgc.social_credit_code,sgc.social_credit_code_type, sgc.create_time, sgc.cust_lb
from sys_campaign_group_customer scgc inner join sys_group_customer sgc on
scgc.group_id = sgc.group_id and scgc.cust_id = sgc.cust_id
inner join sys_group sg on scgc.group_id = sg.group_id inner join sys_dept sd on scgc.dept_id = sd.dept_id left join sys_user su on scgc.user_id = su.user_id
<where>
scgc.org_claim_status in ('0','1')
<if test="groupId != null and groupId != ''"> and scgc.group_id = #{groupId}</if>
<if test="custId != null and custId != ''"> and scgc.cust_id like concat('%', #{custId}, '%') </if>
<if test="custIdc != null and custIdc != ''"> and sgc.cust_idc like concat('%', #{custIdc}, '%') </if>
<if test="custIsn != null and custIsn != ''"> and sgc.cust_isn like concat('%', #{custIsn}, '%') </if>
<if test="gridName != null and gridName != ''"> and scgc.grid_name like concat('%', #{gridName}, '%')</if>
<if test="gridName2 != null and gridName2 != ''"> and scgc.grid_name2 like concat('%', #{gridName2}, '%')</if>
<if test="custName != null and custName != ''"> and sgc.cust_name like concat('%', #{custName}, '%')</if>
<if test="deptName != null and deptName != ''"> and sd.dept_name like concat('%', #{deptName}, '%')</if>
<if test="outlets != null and outlets != ''"> and scgc.outlets like concat('%', #{outlets}, '%')</if>
<if test="username != null and username != ''"> and su.nick_name like concat('%', #{username}, '%')</if>
<if test="socialCreditCode != null and socialCreditCode != ''"> and sgc.social_credit_code like concat('%', #{socialCreditCode}, '%')</if>
<if test="pushStatus != null and pushStatus != ''"> and scgc.push_status = #{pushStatus}</if>
<if test="deptId != null and deptId != ''"> and scgc.dept_id in
(select dept_id from sys_dept where dept_id = #{deptId} or find_in_set(#{deptId},ancestors))
</if>
</where>
</select>
<select id="selectCustomerList" parameterType="String" resultMap="CustomerList">
select
sg.group_id,sg.group_name,
sgc.cust_name,
sgc.cust_phone,
sgc.cust_id,
sgc.cust_idc,sgc.cust_isn,
sgc.push_status,
sgc.grid_name ,
sgc.grid_name2 ,
sgc.user_name,
sgc.dept_name,
sgc.dept_id,
sgc.teller_id,sgc.outlets,sgc.id_type,sg.cust_type,sgc.lp_name,sgc.social_credit_code,sgc.social_credit_code_type
from
sys_group_customer sgc
inner join sys_group sg on
sgc.group_id = sg.group_id
<where>
<if test="groupId != null and groupId != ''">
sgc.group_id = #{groupId}
</if>
<if test="custId != null and custId != ''">
and sgc.cust_id like concat('%', #{custId}, '%')
</if>
<if test="custIdc != null and custIdc != ''"> and sgc.cust_idc like concat('%', #{custIdc}, '%')</if>
<if test="custIsn != null and custIsn != ''"> and sgc.cust_isn like concat('%', #{custIsn}, '%') </if>
<if test="gridName != null and gridName != ''"> and sgc.grid_name like concat('%', #{gridName}, '%')</if>
<if test="gridName2 != null and gridName2 != ''"> and sgc.grid_name2 like concat('%', #{gridName2}, '%')</if>
<if test="custName != null and custName != ''"> and sgc.cust_name like concat('%', #{custName}, '%')</if>
<if test="deptName != null and deptName != ''"> and sgc.dept_name like concat('%', #{deptName}, '%')</if>
<if test="outlets != null and outlets != ''"> and sgc.outlets like concat('%', #{outlets}, '%')</if>
<if test="username != null and username != ''"> and sgc.user_name like concat('%', #{username}, '%')</if>
<if test="socialCreditCode != null and socialCreditCode != ''"> and sgc.social_credit_code like concat('%', #{socialCreditCode}, '%')</if>
</where>
</select>
<select id="selectUnsuccessCustomerList" parameterType="String" resultMap="CustomerList">
select
sg.group_id,sg.group_name,
sgc.cust_name,
sgc.cust_phone,
sgc.cust_id,
sgc.cust_idc,
sgc.push_status,
sgc.grid_name ,
sgc.grid_name2 ,
sgc.user_name,
sgc.dept_name,
sgc.teller_id
from
sys_group_customer sgc
inner join sys_group sg on
sgc.group_id = sg.group_id
left join sys_campaign sc on
sc.group_id = sgc.group_id
<where>
<if test="groupId != null and groupId != ''">
sgc.group_id = #{groupId}
</if>
<if test="custId != null and custId != ''">
and sgc.cust_id like concat('%', #{custId}, '%')
</if>
<if test="custName != null and custName != ''">
and sgc.cust_name like concat('%', #{custName}, '%')
</if>
<if test="pushStatus != null and pushStatus != ''">
and sgc.push_status = #{pushStatus}
</if>
<if test="pushStatus == null or pushStatus ==''">
and (sgc.push_status = '0' or sgc.push_status = '2')
</if>
</where>
</select>
<select id="selectSysGroupById" parameterType="Long" resultMap="SysGroupResult">
<include refid="selectSysGroupVo"/>
where id = #{id}
</select>
<select id="selectSysGroupByGroupId" parameterType="String" resultMap="SysGroupResult">
<include refid="selectSysGroup"/>
where group_id = #{groupId}
</select>
<select id="selectSysGroupNameByGroupId" parameterType="String" >
select group_name from sys_group
where group_id = #{groupId}
</select>
<select id="selectSysGroupBydeptId" parameterType="Long" resultMap="SysGroupResult">
<include refid="selectSysGroup"/>
<where>
del_flag = '0'
<if test="deptId != null">and left(dept_id,3) = left(#{deptId},3)</if>
</where>
</select>
<select id="selectSysGroupBydeptId1" parameterType="Long" resultMap="SysGroupResult">
<include refid="selectSysGroup"/>
<where>
del_flag = '0'
<if test="deptId != null">and dept_id = #{deptId}</if>
</where>
</select>
<select id="selectSysGroupBydeptIdAndUserId" parameterType="Long" resultMap="SysGroupResult">
<include refid="selectSysGroup"/>
<where>
del_flag = '0'
<if test="deptId != null">and dept_id = #{deptId}</if>
<if test="userName != null">and create_by = #{userName}</if>
</where>
</select>
<select id="isHead" parameterType="String" resultType="String">
select r.role_key from sys_role r left join sys_user_role sur on r.role_id = sur.role_id left join sys_user u on sur.user_id = u.user_id where u.user_name = #{username}
</select>
<insert id="insertSysGroup" parameterType="SysGroup" useGeneratedKeys="true" keyProperty="id">
insert into sys_group
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="groupName != null">group_name,</if>
<if test="createType != null">create_type,</if>
<if test="customerNum != null">customer_num,</if>
<if test="deptId != null">dept_id,</if>
<if test="userId != null">user_id,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="updateType != null">update_type,</if>
<if test="status != null">status,</if>
<if test="remark != null">remark,</if>
<if test="delFlag != null">del_flag,</if>
<if test="groupType != null">group_type,</if>
<if test="groupId != null">group_id,</if>
<if test="custType != null">cust_type,</if>
<if test="createRole != null">create_role,</if>
<if test="labelIds != null">label_ids,</if>
<if test="description != null">description,</if>
<if test="updateTypeRelateTime != null">update_type_relate_time,</if>
<if test="relateGroupId != null">relate_group_id,</if>
<if test="labelSql != null">label_sql,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="groupName != null">#{groupName},</if>
<if test="createType != null">#{createType},</if>
<if test="customerNum != null">#{customerNum},</if>
<if test="deptId != null">#{deptId},</if>
<if test="userId != null">#{userId},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="updateType != null">#{updateType},</if>
<if test="status != null">#{status},</if>
<if test="remark != null">#{remark},</if>
<if test="delFlag != null">#{delFlag},</if>
<if test="groupType != null">#{groupType},</if>
<if test="groupId != null">#{groupId},</if>
<if test="custType != null">#{custType},</if>
<if test="createRole != null">#{createRole},</if>
<if test="labelIds != null">#{labelIds},</if>
<if test="description != null">#{description},</if>
<if test="updateTypeRelateTime != null">#{updateTypeRelateTime},</if>
<if test="relateGroupId != null">#{relateGroupId},</if>
<if test="labelSql != null">#{labelSql},</if>
</trim>
</insert>
<update id="updateSysGroup" parameterType="SysGroup">
update sys_group
<trim prefix="SET" suffixOverrides=",">
<if test="groupName != null">group_name = #{groupName},</if>
<if test="createType != null">create_type = #{createType},</if>
<if test="customerNum != null">customer_num = #{customerNum},</if>
<if test="deptId != null">dept_id = #{deptId},</if>
<if test="userId != null">user_id = #{userId},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="updateType != null">update_type = #{updateType},</if>
<if test="status != null">status = #{status},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="delFlag != null">del_flag = #{delFlag},</if>
<if test="groupType != null">group_type = #{groupType},</if>
<if test="createRole != null">create_role = #{createRole},</if>
<if test="labelIds != null">label_ids = #{labelIds},</if>
<if test="description != null">description = #{description},</if>
<if test="updateTypeRelateTime != null">update_type_relate_time = #{updateTypeRelateTime},</if>
<if test="relateGroupId != null">relate_group_id = #{relateGroupId},</if>
<if test="labelSql != null">label_sql = #{labelSql},</if>
</trim>
where id = #{id}
</update>
<update id="updateSysGroupByIdc" parameterType="SysGroup">
update sys_group
<trim prefix="SET" suffixOverrides=",">
<if test="customerNum != null">customer_num = #{customerNum},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
</trim>
where group_id = #{groupId}
</update>
<delete id="deleteSysGroupById" parameterType="Long">
delete from sys_group where id = #{id}
</delete>
<delete id="deleteSysGroupByIds" parameterType="String">
delete from sys_group where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<select id="selectListNameByBank" parameterType="Long">
select distinct a.group_id,a.group_name,a.create_role from sys_group a,sys_campaign_group_customer b where a.group_id = b.group_id and b.dept_id div 10 = #{countDept}
</select>
<select id="selectListNameByUser" parameterType="Long">
select * from sys_group where user_id = #{UserId}
</select>
<select id="selectCountByGroupName" parameterType="String" resultType="integer">
select count(*) from sys_group sg
where del_flag = '0'
<if test="groupName != null">and group_name = #{groupName}</if>
<if test="headId != null">and dept_id like concat(#{headId},'%')</if>
</select>
</mapper>

View File

@@ -0,0 +1,842 @@
<?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.SysListMapper">
<resultMap type="MarketingList" id="MarketingList">
<id property="listType" column="list_type" />
<result property="groupName" column="group_name" />
<result property="customerNum" column="customer_num" />
<result property="campaignName" column="campaign_name" />
<result property="createTime" column="create_time" />
<result property="campaignDegree" column="campaign_degree" />
<result property="startTime" column="start_time" />
<result property="endTime" column="end_time" />
<result property="custId" column="cust_id" />
<result property="custIdc" column="cust_idc" />
<result property="custName" column="cust_name" />
<result property="custPhone" column="cust_phone" />
<result property="groupId" column="group_id" />
<result property="campaignId" column="campaign_id" />
<result property="claimType" column="claim_type" />
<result property="orgClaimStatus" column="org_claim_status" />
<result property="orgDistributeStatus" column="org_distribute_status" />
<result property="custClaimStatus" column="cust_claim_status" />
<result property="claimEndTime" column="claim_end_time" />
</resultMap>
<resultMap type="ListSelectByUser" id="ListSelectByUser">
<id property="groupId" column="group_id" />
<result property="createRole" column="create_role" />
<result property="groupType" column="group_type" />
<result property="groupName" column="group_name" />
<result property="campaignId" column="campaign_id" />
<result property="campaignName" column="campaign_name" />
<result property="startTime" column="start_time" />
<result property="endTime" column="end_time" />
<result property="campaignDegree" column="campaign_degree" />
<result property="deptId" column="dept_id" />
<result property="claimEndTime" column="claim_end_time" />
<result property="claimType" column="claim_type" />
<result property="orgClaimStatus" column="org_claim_status" />
<result property="orgDistributeStatus" column="org_distribute_status" />
<result property="customerNum" column="customer_num" />
<result property="updateTime" column="update_time" />
<result property="secondPushStatus" column="second_push_status" />
<result property="executer" column="executer" />
<result property="createTime" column="create_time" />
<result property="belongDept" column="dept_name" />
<result property="sendDept" column="send_dept" />
<result property="checkTarget" column="check_target" />
</resultMap>
<resultMap type="ListSelectForUser" id="ListSelectForUser">
<id property="custId" column="cust_id" />
<result property="createRole" column="create_role" />
<result property="groupId" column="group_id" />
<result property="groupName" column="group_name" />
<result property="custPattern" column="cust_type" />
<result property="campaignId" column="campaign_id" />
<result property="campaignName" column="campaign_name" />
<result property="custIdc" column="cust_idc" />
<result property="socialCreditCode" column="social_credit_code" />
<result property="custName" column="cust_name" />
<result property="custPhone" column="cust_phone" />
<result property="custIsn" column="cust_isn" />
<result property="lpName" column="lp_name" />
<result property="startTime" column="start_time" />
<result property="endTime" column="end_time" />
<result property="campaignDegree" column="campaign_degree" />
<result property="deptId" column="dept_id" />
<result property="claimType" column="claim_type" />
<result property="orgClaimStatus" column="org_claim_status" />
<result property="orgDistributeStatus" column="org_distribute_status" />
<result property="custClaimStatus" column="cust_claim_status" />
<result property="topGridName" column="grid_name" />
<result property="secGridName" column="grid_name2" />
<result property="outlets" column="outlets" />
<result property="userName" column="nick_name" />
<result property="belongDept" column="dept_name" />
<result property="checkTarget" column="check_target" />
</resultMap>
<select id="selectMarketingList" parameterType="String" resultMap="MarketingList">
select
scgc.list_type,
scgc.group_id,
scgc.campaign_id,
sg.group_name,
sg.customer_num,
sc.campaign_name,
sc.create_time ,
sc.campaign_degree,
sc.start_time,
sc.end_time,
sc.claim_end_time,
scgc.cust_id,
scgc.org_claim_status,
scgc.org_distribute_status,
scgc.cust_claim_status,
sc.claim_type
from
sys_campaign_group_customer scgc
inner join sys_campaign sc on
scgc.campaign_id = sc.campaign_id
inner join sys_group sg on
scgc.group_id = sg.group_id
<where>
<if test="keyword != null and keyword != ''">
and sg.group_name like concat('%', #{keyword}, '%') or sc.campaign_name like concat('%', #{keyword}, '%')
</if>
<if test="deptId != null ">
and scgc.dept_id div 1000 = #{deptId}
</if>
</where>
</select>
<select id="selectMarketingList2" parameterType="String" resultMap="MarketingList">
select
scgc.list_type,
scgc.group_id,
scgc.campaign_id,
sg.group_name,
sg.customer_num,
sc.campaign_name,
sc.create_time ,
sc.campaign_degree,
sc.start_time,
sc.end_time,
sc.claim_end_time,
scgc.cust_id,
scgc.org_claim_status,
scgc.org_distribute_status,
scgc.cust_claim_status,
sc.claim_type
from
sys_campaign_group_customer scgc
inner join sys_campaign sc on
scgc.campaign_id = sc.campaign_id
inner join sys_group sg on
scgc.group_id = sg.group_id
<where>
<if test="keyword != null and keyword != ''">
and sg.group_name like concat('%', #{keyword}, '%') or sc.campaign_name like concat('%', #{keyword}, '%')
</if>
<if test="deptId != null ">
and scgc.dept_id = #{deptId}
</if>
<if test="userId != null ">
and scgc.user_id = #{userId}
</if>
<if test="createRole != null ">
and scgc.create_role = #{createRole}
</if>
</where>
</select>
<select id="selectMarketingCustomerList" parameterType="String" resultMap="MarketingList">
select
scgc.list_type,
scgc.group_id,
scgc.campaign_id,
sg.group_name,
sg.customer_num,
sc.campaign_name,
sc.create_time ,
sc.campaign_degree,
sc.start_time,
sc.end_time,
sc.claim_end_time,
sgc.cust_name,
sgc.cust_phone,
sgc.cust_id,
sgc.cust_idc,
scgc.org_claim_status,
scgc.org_distribute_status,
scgc.cust_claim_status,
sc.claim_type
from
sys_campaign_group_customer scgc
inner join sys_campaign sc on
scgc.campaign_id = sc.campaign_id
inner join sys_group sg on
scgc.group_id = sg.group_id
inner join sys_group_customer sgc on
scgc.cust_id = sgc.cust_id and scgc.group_id = sgc.group_id
<where>
<if test="groupId != null and groupId != ''">
and scgc.group_id = #{groupId}
</if>
<if test="campaignId != null and campaignId != ''">
and scgc.campaign_id = #{campaignId}
</if>
<if test="keyword != null and keyword != ''">
and (sgc.cust_idc like concat('%', #{keyword}, '%') or sgc.cust_name like concat('%', #{keyword}, '%') or sgc.cust_phone like concat('%', #{keyword}, '%'))
</if>
<if test="deptId != null ">
and scgc.dept_id div 1000 = #{deptId}
</if>
</where>
</select>
<select id="selectMarketingCustomerList2" parameterType="String" resultMap="MarketingList">
select
scgc.list_type,
scgc.group_id,
scgc.campaign_id,
sg.group_name,
sg.customer_num,
sc.campaign_name,
sc.create_time ,
sc.campaign_degree,
sc.start_time,
sc.end_time,
sc.claim_end_time,
sgc.cust_name,
sgc.cust_phone,
sgc.cust_id,
sgc.cust_idc,
scgc.org_claim_status,
scgc.org_distribute_status,
scgc.cust_claim_status,
sc.claim_type
from
sys_campaign_group_customer scgc
inner join sys_campaign sc on
scgc.campaign_id = sc.campaign_id
inner join sys_group sg on
scgc.group_id = sg.group_id
inner join sys_group_customer sgc on
scgc.cust_id = sgc.cust_id and scgc.group_id = sgc.group_id
<where>
<if test="groupId != null and groupId != ''">
and scgc.group_id = #{groupId}
</if>
<if test="campaignId != null and campaignId != ''">
and scgc.campaign_id = #{campaignId}
</if>
<if test="keyword != null and keyword != ''">
and (sgc.cust_idc like concat('%', #{keyword}, '%') or sgc.cust_name like concat('%', #{keyword}, '%') or sgc.cust_phone like concat('%', #{keyword}, '%'))
</if>
<if test="deptId != null ">
and scgc.dept_id = #{deptId}
</if>
<if test="userId != null ">
and scgc.user_id = #{userId}
</if>
</where>
</select>
<select id="selectMarketingListByBank" parameterType="ListSelectByUser" resultMap="ListSelectByUser">
select distinct sg.group_id,
any_value(sg.create_role) as create_role,
any_value(sg.group_type) as group_type,
any_value(sg.group_name) as group_name,
any_value(sc.campaign_id) as campaign_id,
any_value(sc.campaign_name) as campaign_name,
any_value(sc.start_time) as start_time,
any_value(sc.end_time) as end_time,
any_value(sc.campaign_degree) as campaign_degree,
any_value(scgc.dept_id) as dept_id,
any_value(sc.claim_end_time) as claim_end_time,
any_value(sc.claim_type) as claim_type,
any_value(sc.check_target) as check_target,
any_value(scgc.org_claim_status) as org_claim_status,
any_value(scgc.org_distribute_status) as org_distribute_status,
any_value(sg.update_time) as update_time,
any_value(scgc.second_push_status) as second_push_status,
any_value(sc.executer) as executer,
any_value(sc.create_time) as create_time,
any_value(sd.dept_name) as dept_name,
any_value(sd2.dept_name) as send_dept,
count(distinct scgc.cust_id) as customer_num
from
sys_campaign_group_customer scgc
inner join (select distinct campaign_id,campaign_name,start_time,end_time,campaign_degree,claim_end_time,claim_type,check_target,executer,create_time,dept_id from sys_campaign) sc on
scgc.campaign_id = sc.campaign_id
inner join (select distinct group_id,cust_type,create_role,group_type,group_name,update_time from sys_group where cust_type = #{custPattern}) sg on
scgc.group_id = sg.group_id
inner join (select distinct dept_id,dept_name from sys_dept) sd on
scgc.dept_id = sd.dept_id
inner join (select distinct dept_id,dept_name from sys_dept) sd2 on
sc.dept_id = sd2.dept_id
where scgc.del_flag = '0' and scgc.org_claim_status in ('0','1') and scgc.push_status = '1'
<if test="userDept != null and userDept != ''">
and scgc.dept_id in
(select dept_id from sys_dept where dept_id = #{userDept} or find_in_set(#{userDept},ancestors))
</if>
<if test="groupName != null and groupName != ''">
and (sg.group_name like concat('%', #{groupName}, '%') or sc.campaign_name like concat('%', #{groupName}, '%'))
</if>
<if test="campaignName != null and campaignName != ''">
and sc.campaign_name like concat('%', #{campaignName}, '%')
</if>
<if test="orgClaimStatus != null and orgClaimStatus != ''">
and scgc.org_claim_status = #{orgClaimStatus}
</if>
<if test="orgDistributeStatus != null and orgDistributeStatus != ''">
and scgc.org_distribute_status = #{orgDistributeStatus}
</if>
<if test="groupType != null and groupType != ''">
and sg.create_role = #{groupType}
</if>
<if test="userId != null and userId != ''">
and scgc.user_id = #{userId}
</if>
<if test="startTime != null ">
and DATE_FORMAT(sc.start_time,'%Y-%m-%d') = DATE_FORMAT(#{startTime},'%Y-%m-%d')
</if>
<if test="endTime != null ">
and DATE_FORMAT(sc.end_time,'%Y-%m-%d') = DATE_FORMAT(#{endTime},'%Y-%m-%d')
</if>
<if test="campaignDegree != null and campaignDegree != ''">
and sc.campaign_degree = #{campaignDegree}
</if>
<if test="belongDept != null and belongDept != ''">
and scgc.dept_id = #{belongDept}
</if>
<if test="claimEndTime != null ">
and DATE_FORMAT(sc.claim_end_time,'%Y-%m-%d') = DATE_FORMAT(#{claimEndTime},'%Y-%m-%d')
</if>
<if test="claimType != null and claimType != ''">
and sc.claim_type = #{claimType}
</if>
<if test="orgClaimStatus != null and orgClaimStatus != ''">
and scgc.org_claim_status = #{orgClaimStatus}
</if>
<if test="orgDistributeStatus != null and orgDistributeStatus != ''">
and scgc.org_distribute_status = #{orgDistributeStatus}
</if>
<if test="actionStatus != null and actionStatus != ''">
and case when #{actionStatus} = '待开始' then sc.start_time &gt; #{nowTime}
when #{actionStatus} = '进行中' then sc.end_time &gt;= #{nowTime} and #{nowTime} &gt;= sc.start_time
when #{actionStatus} = '已结束' then #{nowTime} &gt; sc.end_time
else 1=1 end
</if>
group by scgc.campaign_id,left(scgc.dept_id,5),sg.group_id
union all
select distinct
sg.group_id,
any_value(sg.create_role) as create_role,
any_value(sg.group_type) as group_type,
any_value(sg.group_name) as group_name,
any_value(sc.campaign_id) as campaign_id,
any_value(sc.campaign_name) as campaign_name,
any_value(sc.start_time) as start_time,
any_value(sc.end_time) as end_time,
any_value(sc.campaign_degree) as campaign_degree,
null as dept_id,
any_value(sc.claim_end_time) as claim_end_time,
any_value(sc.claim_type) as claim_type,
any_value(sc.check_target) as check_target,
any_value(scgc.org_claim_status) as org_claim_status,
any_value(scgc.org_distribute_status) as org_distribute_status,
any_value(sg.update_time) as update_time,
any_value(scgc.second_push_status) as second_push_status,
any_value(sc.executer) as executer,
any_value(sc.create_time) as create_time,
null as dept_name,
any_value(sd2.dept_name) as send_dept,
count(distinct scgc.cust_id) as customer_num
from
sys_campaign_group_customer scgc
inner join (select distinct campaign_id,campaign_name,start_time,end_time,campaign_degree,claim_end_time,claim_type,check_target,executer,create_time,dept_id from sys_campaign) sc on
scgc.campaign_id = sc.campaign_id
inner join (select distinct group_id,cust_type,create_role,group_type,group_name,update_time from sys_group where cust_type = #{custPattern} ) sg on
scgc.group_id = sg.group_id
inner join (select distinct dept_id,dept_name from sys_dept) sd on
scgc.dept_id = sd.dept_id
inner join (select distinct dept_id,dept_name from sys_dept) sd2 on
sc.dept_id = sd2.dept_id
where scgc.del_flag = '0' and scgc.org_claim_status not in ('0','1') and scgc.push_status = '1'
<if test="userDept != null and userDept != ''">
and scgc.dept_id in
(select dept_id from sys_dept where dept_id = #{userDept} or find_in_set(#{userDept},ancestors))
</if>
<if test="groupName != null and groupName != ''">
and (sg.group_name like concat('%', #{groupName}, '%') or sc.campaign_name like concat('%', #{groupName}, '%'))
</if>
<if test="campaignName != null and campaignName != ''">
and sc.campaign_name like concat('%', #{campaignName}, '%')
</if>
<if test="orgClaimStatus != null and orgClaimStatus != ''">
and scgc.org_claim_status = #{orgClaimStatus}
</if>
<if test="orgDistributeStatus != null and orgDistributeStatus != ''">
and scgc.org_distribute_status = #{orgDistributeStatus}
</if>
<if test="groupType != null and groupType != ''">
and sg.create_role = #{groupType}
</if>
<if test="userId != null and userId != ''">
and scgc.user_id = #{userId}
</if>
<if test="startTime != null ">
and DATE_FORMAT(sc.start_time,'%Y-%m-%d') = DATE_FORMAT(#{startTime},'%Y-%m-%d')
</if>
<if test="endTime != null ">
and DATE_FORMAT(sc.end_time,'%Y-%m-%d') = DATE_FORMAT(#{endTime},'%Y-%m-%d')
</if>
<if test="campaignDegree != null and campaignDegree != ''">
and sc.campaign_degree = #{campaignDegree}
</if>
<if test="belongDept != null and belongDept != ''">
and scgc.dept_id = #{belongDept}
</if>
<if test="claimEndTime != null ">
and DATE_FORMAT(sc.claim_end_time,'%Y-%m-%d') = DATE_FORMAT(#{claimEndTime},'%Y-%m-%d')
</if>
<if test="claimType != null and claimType != ''">
and sc.claim_type = #{claimType}
</if>
<if test="orgClaimStatus != null and orgClaimStatus != ''">
and scgc.org_claim_status = #{orgClaimStatus}
</if>
<if test="orgDistributeStatus != null and orgDistributeStatus != ''">
and scgc.org_distribute_status = #{orgDistributeStatus}
</if>
<if test="actionStatus != null and actionStatus != ''">
and case when #{actionStatus} = '待开始' then sc.start_time &gt; #{nowTime}
when #{actionStatus} = '进行中' then sc.end_time &gt; #{nowTime} and #{nowTime} &gt; sc.start_time
when #{actionStatus} = '已结束' then #{nowTime} &gt; sc.end_time
else 1=1 end
</if>
group by scgc.campaign_id,sg.group_id
order by create_time desc
</select>
<select id="selectMarketingListByOutlet" parameterType="ListSelectByUser" resultMap="ListSelectByUser">
select distinct sg.group_id,
any_value(sg.create_role) as create_role,
any_value(sg.group_type) as group_type,
any_value(sg.group_name) as group_name,
any_value(sc.campaign_id) as campaign_id,
any_value(sc.campaign_name) as campaign_name,
any_value(sc.start_time) as start_time,
any_value(sc.end_time) as end_time,
any_value(sc.campaign_degree) as campaign_degree,
any_value(scgc.dept_id) as dept_id,
any_value(sc.claim_end_time) as claim_end_time,
any_value(sc.claim_type) as claim_type,
any_value(sc.check_target) as check_target,
any_value(scgc.org_claim_status) as org_claim_status,
any_value(scgc.org_distribute_status) as org_distribute_status,
any_value(sg.update_time) as update_time,
any_value(scgc.second_push_status) as second_push_status,
any_value(sc.executer) as executer,
any_value(sc.create_time) as create_time,
any_value(sd.dept_name) as dept_name,
any_value(sd2.dept_name) as send_dept,
count(distinct scgc.cust_id) as customer_num
from
sys_campaign_group_customer scgc
inner join (select distinct campaign_id,campaign_name,start_time,end_time,campaign_degree,claim_end_time,claim_type,check_target,executer,create_time,dept_id from sys_campaign) sc on
scgc.campaign_id = sc.campaign_id
inner join (select distinct group_id,cust_type,create_role,group_type,group_name,update_time from sys_group where cust_type = #{custPattern}) sg on
scgc.group_id = sg.group_id
inner join (select distinct dept_id,dept_name from sys_dept) sd on
scgc.dept_id = sd.dept_id
inner join (select distinct dept_id,dept_name from sys_dept) sd2 on
sc.dept_id = sd2.dept_id
where scgc.del_flag = '0' and scgc.push_status = '1'
<if test="userDept != null and userDept != ''">
and scgc.dept_id in
(select dept_id from sys_dept where dept_id = #{userDept} or find_in_set(#{userDept},ancestors))
</if>
<if test="groupName != null and groupName != ''">
and (sg.group_name like concat('%', #{groupName}, '%') or sc.campaign_name like concat('%', #{groupName}, '%'))
</if>
<if test="campaignName != null and campaignName != ''">
and sc.campaign_name like concat('%', #{campaignName}, '%')
</if>
<if test="orgClaimStatus != null and orgClaimStatus != ''">
and scgc.org_claim_status = #{orgClaimStatus}
</if>
<if test="orgDistributeStatus != null and orgDistributeStatus != ''">
and scgc.org_distribute_status = #{orgDistributeStatus}
</if>
<if test="groupType != null and groupType != ''">
and sg.create_role = #{groupType}
</if>
<if test="userId != null and userId != ''">
and scgc.user_id = #{userId}
</if>
<if test="startTime != null ">
and DATE_FORMAT(sc.start_time,'%Y-%m-%d') = DATE_FORMAT(#{startTime},'%Y-%m-%d')
</if>
<if test="endTime != null ">
and DATE_FORMAT(sc.end_time,'%Y-%m-%d') = DATE_FORMAT(#{endTime},'%Y-%m-%d')
</if>
<if test="campaignDegree != null and campaignDegree != ''">
and sc.campaign_degree = #{campaignDegree}
</if>
<if test="belongDept != null and belongDept != ''">
and scgc.dept_id = #{belongDept}
</if>
<if test="belongOutlet != null and belongOutlet != ''">
and scgc.outlets_id = #{belongOutlet}
</if>
<if test="claimEndTime != null ">
and DATE_FORMAT(sc.claim_end_time,'%Y-%m-%d') = DATE_FORMAT(#{claimEndTime},'%Y-%m-%d')
</if>
<if test="claimType != null and claimType != ''">
and sc.claim_type = #{claimType}
</if>
<if test="orgClaimStatus != null and orgClaimStatus != ''">
and scgc.org_claim_status = #{orgClaimStatus}
</if>
<if test="orgDistributeStatus != null and orgDistributeStatus != ''">
and scgc.org_distribute_status = #{orgDistributeStatus}
</if>
<if test="actionStatus != null and actionStatus != ''">
and case when #{actionStatus} = '待开始' then sc.start_time &gt; #{nowTime}
when #{actionStatus} = '进行中' then sc.end_time &gt;= #{nowTime} and #{nowTime} &gt;= sc.start_time
when #{actionStatus} = '已结束' then #{nowTime} &gt; sc.end_time
else 1=1 end
</if>
group by scgc.campaign_id,left(scgc.dept_id,5),sg.group_id
order by create_time desc
</select>
<select id="selectCustListByBankRetail" parameterType="ListSelectForUser" resultMap="ListSelectForUser">
select
sgc.cust_id,
sg.create_role,
sg.group_id,
sg.group_name,
sc.campaign_id,
sc.campaign_name,
scgc.cust_idc,
sgc.cust_name,
scgc.cust_phone,
sgc.cust_isn,
sc.start_time,
sc.end_time,
sc.campaign_degree,
sc.check_target,
scgc.dept_id,
sc.claim_type,
scgc.org_claim_status,
scgc.org_distribute_status,
scgc.cust_claim_status,
scgc.grid_name,
scgc.grid_name2,
scgc.outlets,
su.nick_name as nick_name,
sd.dept_name as dept_name
from
sys_campaign_group_customer scgc
inner join sys_campaign sc on
scgc.campaign_id = sc.campaign_id
inner join sys_group sg on
scgc.group_id = sg.group_id
inner join cust_info_retail sgc on
scgc.cust_id = sgc.cust_id
left join sys_user su on
scgc.user_id = su.user_id
left join sys_dept sd on
scgc.dept_id = sd.dept_id
where sg.cust_type = #{custPattern} and scgc.del_flag = '0' and scgc.push_status = '1'
<if test="isOutlet == 0">
and case when #{deptId} is null then scgc.org_claim_status not in ('0','1')
else (scgc.dept_id in (select dept_id from sys_dept where dept_id = #{deptId} or find_in_set(#{deptId},ancestors)) and scgc.org_claim_status in ('0','1')) end
</if>
<if test="isOutlet == 1">
and scgc.outlets_id = #{userDept}
</if>
<if test="userDept != null and userDept != '' and isOutlet == 0">
and scgc.dept_id in
(select dept_id from sys_dept where dept_id = #{userDept} or find_in_set(#{userDept},ancestors))
</if>
<if test="groupId != null and groupId != ''">
and sg.group_id = #{groupId}
</if>
<if test="campaignId != null and campaignId != ''">
and scgc.campaign_id = #{campaignId}
</if>
<if test="custName != null and custName != ''">
and (sgc.cust_name like concat('%', #{custName}, '%') or sgc.cust_id like concat('%', #{custName}, '%') or scgc.cust_idc like concat('%', #{custName}, '%') or sgc.cust_phone like concat('%', #{custName}, '%') )
</if>
<if test="custClaimStatus != null and custClaimStatus != ''">
and scgc.cust_claim_status = #{custClaimStatus}
</if>
<if test="userId != null and userId != ''">
and scgc.user_id = #{userId}
</if>
<if test="custClaimStatus != null and custClaimStatus != ''">
and scgc.cust_claim_status = #{custClaimStatus}
</if>
<if test="topGridName!= null and topGridName != ''">
and scgc.grid_name like concat('%', #{topGridName}, '%')
</if>
<if test="secGridName != null and secGridName != ''">
and scgc.grid_name2 like concat('%', #{secGridName}, '%')
</if>
<if test="belongDept != null and belongDept != ''">
and sd.dept_name like concat('%', #{belongDept}, '%') and sd.dept_type ='branch'
</if>
<if test="outlets != null and outlets != ''">
and scgc.outlets like concat('%', #{outlets}, '%')
</if>
<if test="userName != null and userName != ''">
and su.nick_name like concat('%', #{userName}, '%')
</if>
</select>
<select id="selectCustListByBankMerchant" parameterType="ListSelectForUser" resultMap="ListSelectForUser">
select
sgc.cust_id,
sg.create_role,
sg.group_id,
sg.group_name,
sc.campaign_id,
sc.campaign_name,
scgc.cust_idc,
sgc.cust_name,
scgc.cust_phone,
sgc.cust_isn,
sgc.social_credit_code,
sgc.lp_name,
sc.start_time,
sc.end_time,
sc.campaign_degree,
sc.check_target,
scgc.dept_id,
sc.claim_type,
scgc.org_claim_status,
scgc.org_distribute_status,
scgc.cust_claim_status,
scgc.grid_name,
scgc.grid_name2,
scgc.outlets,
su.nick_name as nick_name,
sd.dept_name as dept_name
from
sys_campaign_group_customer scgc
inner join sys_campaign sc on
scgc.campaign_id = sc.campaign_id
inner join sys_group sg on
scgc.group_id = sg.group_id
inner join cust_info_merchant sgc on
scgc.cust_id = sgc.cust_id
left join sys_user su on
scgc.user_id = su.user_id
left join sys_dept sd on
scgc.dept_id = sd.dept_id
where sg.cust_type = #{custPattern} and scgc.del_flag = '0' and scgc.push_status = '1'
<if test="isOutlet == 0">
and case when #{deptId} is null then scgc.org_claim_status not in ('0','1')
else (scgc.dept_id in (select dept_id from sys_dept where dept_id = #{deptId} or find_in_set(#{deptId},ancestors)) and scgc.org_claim_status in ('0','1')) end
</if>
<if test="isOutlet == 1">
and scgc.outlets_id = #{userDept}
</if>
<if test="userDept != null and userDept != '' and isOutlet == 0">
and scgc.dept_id in
(select dept_id from sys_dept where dept_id = #{userDept} or find_in_set(#{userDept},ancestors))
</if>
<if test="groupId != null and groupId != ''">
and sg.group_id = #{groupId}
</if>
<if test="campaignId != null and campaignId != ''">
and scgc.campaign_id = #{campaignId}
</if>
<if test="custName != null and custName != ''">
and (sgc.cust_name like concat('%', #{custName}, '%') or sgc.cust_id like concat('%', #{custName}, '%') or scgc.cust_idc like concat('%', #{custName}, '%') or sgc.cust_phone like concat('%', #{custName}, '%'))
</if>
<if test="custClaimStatus != null and custClaimStatus != ''">
and scgc.cust_claim_status = #{custClaimStatus}
</if>
<if test="userId != null and userId != ''">
and scgc.user_id = #{userId}
</if>
<if test="custClaimStatus != null and custClaimStatus != ''">
and scgc.cust_claim_status = #{custClaimStatus}
</if>
<if test="topGridName!= null and topGridName != ''">
and scgc.grid_name like concat('%', #{topGridName}, '%')
</if>
<if test="secGridName != null and secGridName != ''">
and scgc.grid_name2 like concat('%', #{secGridName}, '%')
</if>
<if test="belongDept != null and belongDept != ''">
and sd.dept_name like concat('%', #{belongDept}, '%') and sd.dept_type ='branch'
</if>
<if test="outlets != null and outlets != ''">
and scgc.outlets like concat('%', #{outlets}, '%')
</if>
<if test="userName != null and userName != ''">
and su.nick_name like concat('%', #{userName}, '%')
</if>
</select>
<select id="selectCustListByBankBusiness" parameterType="ListSelectForUser" resultMap="ListSelectForUser">
select
sgc.cust_id,
sg.create_role,
sg.group_id,
sg.group_name,
sc.campaign_id,
sc.campaign_name,
scgc.cust_idc,
sgc.cust_name,
scgc.cust_phone,
sgc.cust_isn,
sgc.social_credit_code,
sgc.lp_name,
sc.start_time,
sc.end_time,
sc.campaign_degree,
sc.check_target,
scgc.dept_id,
sc.claim_type,
scgc.org_claim_status,
scgc.org_distribute_status,
scgc.cust_claim_status,
scgc.grid_name,
scgc.grid_name2,
scgc.outlets,
su.nick_name as nick_name,
sd.dept_name as dept_name
from
sys_campaign_group_customer scgc
inner join sys_campaign sc on
scgc.campaign_id = sc.campaign_id
inner join sys_group sg on
scgc.group_id = sg.group_id
inner join cust_info_business sgc on
scgc.cust_id = sgc.cust_id
left join sys_user su on
scgc.user_id = su.user_id
left join sys_dept sd on
scgc.dept_id = sd.dept_id
where sg.cust_type = #{custPattern} and scgc.del_flag = '0' and scgc.push_status = '1'
<if test="isOutlet == 0">
and case when #{deptId} is null then scgc.org_claim_status not in ('0','1')
else (scgc.dept_id in (select dept_id from sys_dept where dept_id = #{deptId} or find_in_set(#{deptId},ancestors)) and scgc.org_claim_status in ('0','1')) end
</if>
<if test="isOutlet == 1">
and scgc.outlets_id = #{userDept}
</if>
<if test="userDept != null and userDept != '' and isOutlet == 0">
and scgc.dept_id in
(select dept_id from sys_dept where dept_id = #{userDept} or find_in_set(#{userDept},ancestors))
</if>
<if test="groupId != null and groupId != ''">
and sg.group_id = #{groupId}
</if>
<if test="campaignId != null and campaignId != ''">
and scgc.campaign_id = #{campaignId}
</if>
<if test="custName != null and custName != ''">
and (sgc.cust_name like concat('%', #{custName}, '%') or sgc.cust_id like concat('%', #{custName}, '%') or scgc.cust_idc like concat('%', #{custName}, '%') or sgc.cust_phone like concat('%', #{custName}, '%') )
</if>
<if test="custClaimStatus != null and custClaimStatus != ''">
and scgc.cust_claim_status = #{custClaimStatus}
</if>
<if test="userId != null and userId != ''">
and scgc.user_id = #{userId}
</if>
<if test="custClaimStatus != null and custClaimStatus != ''">
and scgc.cust_claim_status = #{custClaimStatus}
</if>
<if test="topGridName!= null and topGridName != ''">
and scgc.grid_name like concat('%', #{topGridName}, '%')
</if>
<if test="secGridName != null and secGridName != ''">
and scgc.grid_name2 like concat('%', #{secGridName}, '%')
</if>
<if test="belongDept != null and belongDept != ''">
and sd.dept_name like concat('%', #{belongDept}, '%') and sd.dept_type ='branch'
</if>
<if test="outlets != null and outlets != ''">
and scgc.outlets like concat('%', #{outlets}, '%')
</if>
<if test="userName != null and userName != ''">
and su.nick_name like concat('%', #{userName}, '%')
</if>
</select>
<select id="selectCustListForExcel" resultMap="ListSelectForUser">
select
sgc.cust_id,
sg.create_role,
sg.group_id,
sg.group_name,
sg.cust_type,
sc.campaign_id,
sc.campaign_name ,
sgc.cust_idc,
sgc.cust_name,
sgc.cust_phone,
sgc.cust_isn,
sgc.social_credit_code,
sc.start_time,
sc.end_time,
sc.campaign_degree,
scgc.dept_id,
sc.claim_type,
scgc.org_claim_status,
scgc.org_distribute_status,
scgc.cust_claim_status,
scgc.grid_name,
scgc.grid_name2,
scgc.outlets,
su.nick_name as nick_name,
sd.dept_name as dept_name
from
sys_campaign_group_customer scgc
inner join sys_campaign sc on
scgc.campaign_id = sc.campaign_id
inner join sys_group sg on
scgc.group_id = sg.group_id
inner join sys_group_customer sgc on
scgc.cust_id = sgc.cust_id and scgc.group_id = sgc.group_id
left join sys_user su on
scgc.user_id = su.user_id
left join sys_dept sd on
scgc.dept_id = sd.dept_id
<where>
case when #{deptId} is null then scgc.org_claim_status not in ('0','1')
else (scgc.dept_id in
(select dept_id from sys_dept where dept_id = #{deptId} or find_in_set(#{deptId},ancestors)) and scgc.org_claim_status in ('0','1')) end
<if test="groupId != null and groupId != ''"> and sgc.group_id = #{groupId}</if>
and sgc.cust_id in <foreach collection="custIds" index="index" item="item" open="(" separator="," close=")">#{item}</foreach>
</where>
</select>
</mapper>

View File

@@ -0,0 +1,64 @@
<?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.visit.mapper.VisitInfoMapper">
<select id="queryVisitCustomerCount" resultType="VisitCustomerCount">
select
T.vis_id,
case when T.cust_type =2 then '企业' WHEN T.cust_type = 1 then '商户' else '个人' end as cust_type,
COUNT(DISTINCT T.cid) As customer_count_by_type
FROM (SELECT DISTINCT
campaign_name,
vis_id,
--- 脱敏客户 ID
concat(substr(md5(coalesce(cust_idc,'')),1,8),'^')as cid,
-- 脱敏社会信用代码(可选)
concat(substr(md5(coalesce(social_credit_code,'')),1,8),'^')as scc,
-- 客户类型(关键字段)
cust_type,
remark,
vis_time,
day(vis_time) As d
FROM visit_info_${deptCode}
WHERE length(remark) > 0
<if test="year != null and year != ''">
AND year(vis_time)= #{year}
</if>
<if test="month != null and month != ''">
AND month(vis_time)=#{month}
</if>
) T
GROUP BY T.vis_id, cust_type
ORDER BY T.vis_id, customer_count_by_type DESC ;
</select>
<select id="queryVisitIdRemark" resultType="VisitIdRemark">
SELECT DISTINCT
campaign_name,
CONCAT(cust_name, '') customer_name,
CONCAT(social_credit_code, '') AS ssc,
CASE WHEN cust_type = 2 THEN '企业' WHEN cust_type = 1 THEN '商户' ELSE '个人' end as cust_type,
-- 替换 regexp_replace 为 MySQL 低版本兼容写法
IF(
remark REGEXP '1[3-9][0-9]{4}[0-9]{4}',
CONCAT(
SUBSTRING(remark, 1, 2), -- 保留第一位数字和第二位数字
'****', -- 中间替换为****
SUBSTRING(remark, 7) -- 保留最后四位数字
),
remark -- 不匹配则返回原字符串
) AS remark_without_mobile,
DAY(vis_time) AS d,
HOUR(vis_time) AS h
FROM visit_info_${deptCode}
WHERE LENGTH(remark) > 0
<if test="year != null and year != ''">
AND year(vis_time)= #{year}
</if>
<if test="month != null and month != ''">
AND month(vis_time)=#{month}
</if>
AND vis_id = #{visId}
ORDER BY d, h, campaign_name, customer_name;
</select>
</mapper>