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,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>