init
This commit is contained in:
62
ibs/src/main/resources/mapper/draw/DrawGridCustMapper.xml
Normal file
62
ibs/src/main/resources/mapper/draw/DrawGridCustMapper.xml
Normal file
@@ -0,0 +1,62 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.ruoyi.ibs.draw.mapper.DrawGridCustUserUnbindMapper">
|
||||
<resultMap id="DrawGridCustVO" type="DrawGridCustVO">
|
||||
<result property="gridId" column="grid_id"/>
|
||||
<result property="gridName" column="grid_name"/>
|
||||
<result property="gridDutyType" column="grid_duty_type"/>
|
||||
<result property="layerId" column="layer_id"/>
|
||||
<result property="shapeId" column="shape_id"/>
|
||||
<result property="custId" column="cust_id"/>
|
||||
<result property="custName" column="cust_name"/>
|
||||
<result property="custType" column="cust_type"/>
|
||||
<result property="userName" column="user_name"/>
|
||||
<result property="nickName" column="nick_name"/>
|
||||
<result property="branchId" column="branch_id"/>
|
||||
<result property="branchName" column="branch_name"/>
|
||||
<result property="outletId" column="outlet_id"/>
|
||||
<result property="outletName" column="outlet_id"/>
|
||||
<result property="unbindFlag" column="unbind_flag"/>
|
||||
</resultMap>
|
||||
|
||||
<select id="getCustList" parameterType="DrawGridCustListDTO" resultMap="DrawGridCustVO">
|
||||
select e.grid_id, e.grid_name, e.grid_duty_type, b.layer_id , b.shape_id , b.cust_id , b.cust_name , b.cust_type
|
||||
, a.user_name, a.nick_name,
|
||||
e.dept_id as branch_id, e.dept_name as branch_name, sd.dept_id as outlet_id, sd.dept_name as outlet_name,
|
||||
(select count(0) from grid_draw_cust_user_unbind d where d.grid_id = #{gridId} and d.cust_id = b.cust_id and
|
||||
d.user_name = a.user_name and d.delete_flag = '0') as unbind_flag
|
||||
from (select * from grid_draw_user_relate where delete_flag = '0') a
|
||||
left join (select * from grid_draw_shape_relate where delete_flag = '0') c on c.grid_id = a.grid_id
|
||||
left join draw_shape_cust b on b.shape_id = c.shape_id
|
||||
left join (select * from grid_draw_grid where delete_flag = '0') e on a.grid_id = e.grid_id
|
||||
left join sys_dept sd on sd.dept_id = a.relate_dept_id and sd.dept_type = "outlet"
|
||||
where a.grid_id = #{gridId}
|
||||
<if test="custId != null and custId != ''">AND b.cust_id like concat('%', #{custId}, '%')</if>
|
||||
<if test="custName != null and custName != ''">AND b.cust_name like concat('%', #{custName}, '%')</if>
|
||||
<if test="custType != null and custType != ''">AND b.cust_type = #{custType}</if>
|
||||
</select>
|
||||
|
||||
<select id="getCustListByManager" parameterType="DrawGridCustListDTO" resultMap="DrawGridCustVO">
|
||||
select e.grid_id, e.grid_name, e.grid_duty_type, b.layer_id , b.shape_id , b.cust_id , b.cust_name , b.cust_type
|
||||
, a.user_name, a.nick_name
|
||||
from (select * from grid_draw_user_relate where delete_flag = '0') a
|
||||
left join (select * from grid_draw_shape_relate where delete_flag = '0') c on c.grid_id = a.grid_id
|
||||
left join draw_shape_cust b on b.shape_id = c.shape_id
|
||||
left join (select * from grid_draw_grid where delete_flag = '0') e on a.grid_id = e.grid_id
|
||||
left join sys_dept sd on sd.dept_id = a.relate_dept_id
|
||||
where a.grid_id = #{gridId} and a.user_name = #{userName}
|
||||
and not exists
|
||||
(select 1 from grid_draw_cust_user_unbind d where d.grid_id = #{gridId} and d.cust_id = b.cust_id and
|
||||
d.user_name =
|
||||
a.user_name and d.delete_flag = '0')
|
||||
<if test="custId != null and custId != ''">AND b.cust_id like concat('%', #{custId}, '%')</if>
|
||||
<if test="custName != null and custName != ''">AND b.cust_name like concat('%', #{custName}, '%')</if>
|
||||
<if test="custType != null and custType != ''">AND b.cust_type = #{custType}</if>
|
||||
</select>
|
||||
<select id="">
|
||||
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
120
ibs/src/main/resources/mapper/draw/DrawGridMapper.xml
Normal file
120
ibs/src/main/resources/mapper/draw/DrawGridMapper.xml
Normal file
@@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.ruoyi.ibs.draw.mapper.DrawGridMapper">
|
||||
<resultMap id="DrawGridListVO" type="DrawGridListVO">
|
||||
<result property="gridId" column="grid_id"/>
|
||||
<result property="gridName" column="grid_name"/>
|
||||
<result property="layerId" column="layer_id"/>
|
||||
<result property="gridDutyType" column="grid_duty_type"/>
|
||||
<result property="deptId" column="dept_id"/>
|
||||
<result property="deptName" column="dept_name"/>
|
||||
</resultMap>
|
||||
|
||||
<select id="getGridList" parameterType="DrawGridListDTO" resultMap="DrawGridListVO">
|
||||
SELECT distinct d.*, CONCAT(su.nick_name, '-',d.create_by) as creator FROM grid_draw_grid d
|
||||
left join grid_draw_user_relate u on d.grid_id = u.grid_id
|
||||
left join sys_user su on su.user_name = d.create_by
|
||||
WHERE d.delete_flag = '0' and u.delete_flag = '0'
|
||||
AND (d.dept_id in (select dept_id from sys_dept where dept_id = #{deptId} or find_in_set(#{deptId},ancestors))
|
||||
or (u.relate_dept_id in (select dept_id from sys_dept where dept_id = #{deptId} or
|
||||
find_in_set(#{deptId},ancestors)))
|
||||
)
|
||||
<if test="gridName != null and gridName != ''">AND d.grid_name like concat('%', #{gridName}, '%')</if>
|
||||
<if test="gridDutyType != null and gridDutyType != ''">AND d.grid_duty_type = #{gridDutyType}</if>
|
||||
<if test="layerId != null and layerId != ''">AND d.layer_id = #{layerId}</if>
|
||||
<if test="opsDept != null and opsDept != ''">AND d.ops_dept = #{opsDept}</if>
|
||||
<if test="relateDeptName != null and relateDeptName != ''">
|
||||
AND EXISTS(
|
||||
SELECT 1 FROM grid_draw_user_relate a WHERE a.delete_flag = '0' AND a.grid_id = d.grid_id AND
|
||||
a.relate_dept_name like concat('%', #{relateDeptName}, '%')
|
||||
)
|
||||
</if>
|
||||
<if test="relateUserName != null and relateUserName != ''">
|
||||
AND EXISTS(
|
||||
SELECT 1 FROM grid_draw_user_relate b WHERE b.delete_flag = '0' AND b.grid_id = d.grid_id AND b.user_name
|
||||
like concat('%', #{relateUserName}, '%')
|
||||
)
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="getGridListByManager" parameterType="DrawGridListDTO" resultMap="DrawGridListVO">
|
||||
SELECT d.*, CONCAT(su.nick_name, '-',d.create_by) as creator FROM grid_draw_user_relate u
|
||||
LEFT JOIN (SELECT * FROM grid_draw_grid WHERE delete_flag = '0') d ON u.grid_id = d.grid_id
|
||||
left join sys_user su on su.user_name = d.create_by
|
||||
WHERE u.user_name = #{userName}
|
||||
AND u.delete_flag = '0'
|
||||
<if test="gridName != null and gridName != ''">AND d.grid_name like concat('%', #{gridName}, '%')</if>
|
||||
<if test="gridDutyType != null and gridDutyType != ''">AND d.grid_duty_type = #{gridDutyType}</if>
|
||||
<if test="layerId != null and layerId != ''">AND d.layer_id = #{layerId}</if>
|
||||
<if test="opsDept != null and opsDept != ''">AND d.ops_dept = #{opsDept}</if>
|
||||
<if test="relateUserName != null and relateUserName != ''">
|
||||
AND EXISTS(
|
||||
SELECT 1 FROM grid_draw_user_relate b WHERE b.delete_flag = '0' AND b.grid_id = d.grid_id AND b.user_name
|
||||
like concat('%', #{relateUserName}, '%')
|
||||
)
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="getGridCount" resultType="Long">
|
||||
SELECT count(distinct d.grid_id)
|
||||
from grid_draw_grid d
|
||||
left join grid_draw_user_relate u on d.grid_id = u.grid_id
|
||||
WHERE d.delete_flag = '0'
|
||||
and u.delete_flag = '0'
|
||||
<if test="opsDept != null and opsDept != ''">AND d.ops_dept = #{opsDept}</if>
|
||||
AND (d.dept_id in
|
||||
(select dept_id from sys_dept where dept_id = #{deptId} or find_in_set(#{deptId}, ancestors))
|
||||
or u.relate_dept_id in
|
||||
(select dept_id from sys_dept where dept_id = #{deptId} or find_in_set(#{deptId}, ancestors))
|
||||
)
|
||||
</select>
|
||||
|
||||
<select id="getGridCountByManager" resultType="Long">
|
||||
SELECT count(distinct grid_id)
|
||||
from grid_draw_user_relate
|
||||
WHERE delete_flag = '0'
|
||||
and user_name = #{userName}
|
||||
</select>
|
||||
|
||||
<select id="getCustCount" resultType="Long">
|
||||
select count(distinct a.cust_id)
|
||||
from draw_shape_cust a
|
||||
left join grid_draw_shape_relate b on a.shape_id = b.shape_id
|
||||
left join grid_draw_user_relate c on b.grid_id = c.grid_id
|
||||
left join grid_draw_grid d on b.grid_id = d.grid_id
|
||||
where b.delete_flag = '0'
|
||||
and c.delete_flag = '0'
|
||||
and d.delete_flag = '0'
|
||||
<if test="opsDept != null and opsDept != ''">AND d.ops_dept = #{opsDept}</if>
|
||||
and a.cust_type = #{custType}
|
||||
and c.relate_dept_id in
|
||||
(select dept_id from sys_dept where dept_id = #{deptId} or find_in_set(#{deptId}, ancestors));
|
||||
</select>
|
||||
|
||||
<select id="getCustCountByManager" resultType="Long">
|
||||
select count(distinct a.cust_id)
|
||||
from draw_shape_cust a
|
||||
left join grid_draw_shape_relate b on a.shape_id = b.shape_id
|
||||
left join grid_draw_user_relate c on b.grid_id = c.grid_id
|
||||
where b.delete_flag = '0'
|
||||
and c.delete_flag = '0'
|
||||
and a.cust_type = #{custType}
|
||||
and c.user_name = #{userName};
|
||||
</select>
|
||||
|
||||
<select id="getGridListByOpsAndLayer" parameterType="LayerGridDTO" resultType="DrawGrid">
|
||||
select d.*
|
||||
from grid_draw_grid d
|
||||
left join grid_draw_user_relate u on d.grid_id = u.grid_id
|
||||
WHERE d.delete_flag = '0'
|
||||
and u.delete_flag = '0'
|
||||
AND d.layer_id = #{layerId}
|
||||
and d.ops_dept = #{opsDept}
|
||||
AND (d.dept_id in
|
||||
(select dept_id from sys_dept where dept_id = #{deptId} or find_in_set(#{deptId}, ancestors))
|
||||
or (u.relate_dept_id in
|
||||
(select dept_id from sys_dept where dept_id = #{deptId} or find_in_set(#{deptId}, ancestors))))
|
||||
</select>
|
||||
</mapper>
|
||||
50
ibs/src/main/resources/mapper/draw/DrawLayerMapper.xml
Normal file
50
ibs/src/main/resources/mapper/draw/DrawLayerMapper.xml
Normal file
@@ -0,0 +1,50 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.ruoyi.ibs.draw.mapper.DrawLayerMapper">
|
||||
|
||||
|
||||
<select id="getLayerList" resultType="com.ruoyi.ibs.draw.domain.vo.LayerRuleVO">
|
||||
select layer_id,layer_name from draw_layer
|
||||
where delete_flag = 0
|
||||
and layer_id in
|
||||
(select layer_id from draw_shape where ops_dept = #{opsDept} and delete_flag = 0 and dept_id like concat(#{deptId},'%') group by layer_id)
|
||||
</select>
|
||||
|
||||
|
||||
<select id="getDrawLayerList" resultType="DrawLayerVO">
|
||||
select dl.layer_id, dl.layer_name, dl.layer_color, ifnull(sum(ds.shape_id) = 0, 1) as disabled from draw_layer dl
|
||||
left join (
|
||||
select * from draw_shape where delete_flag = '0'
|
||||
<if test="deptId != null and deptId != ''"> and left(dept_id,3) = left(#{deptId},3) </if>
|
||||
and relate_flag = '0'
|
||||
) ds on ds.layer_id = dl.layer_id
|
||||
where dl.delete_flag = '0' and dl.dept_id like concat(#{deptHead},'%')
|
||||
<if test="layerName != null and layerName != ''"> and dl.layer_name like concat('%', #{layerName}, '%') </if>
|
||||
group by dl.layer_id, dl.layer_name
|
||||
order by dl.layer_id desc
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
<select id="getValidDrawLayerList" resultType="DrawLayerVO">
|
||||
select dl.layer_id, dl.layer_name, dl.layer_color, ifnull(sum(ds.audit_flag) = 0, 1) as disabled from draw_layer dl
|
||||
left join (
|
||||
select *, if(audit_status ='1', 1, 0) as audit_flag from draw_shape
|
||||
where delete_flag = '0' and ops_dept = #{opsDept} and dept_id = #{deptId} and relate_flag = '0'
|
||||
) ds on ds.layer_id = dl.layer_id
|
||||
where dl.delete_flag = '0'
|
||||
and dl.dept_id like concat(#{deptHead},'%')
|
||||
group by dl.layer_id, dl.layer_name
|
||||
order by disabled
|
||||
</select>
|
||||
|
||||
<select id="queryBusinessFreqList" resultType="MapCustCountVO">
|
||||
select round(iaa.longitude, 4) as lng, round(iaa.latitude, 4) as lat, count(*) as count from cust_info_business cir
|
||||
left join ibs_anchor ia on cir.cust_id = ia.cust_id
|
||||
left join ibs_anchor_address iaa on ia.address_id = iaa.id
|
||||
where iaa.longitude is not null and length(iaa.longitude) != 0 and iaa.latitude is not null and length(iaa.latitude) != 0
|
||||
group by lng, lat;
|
||||
</select>
|
||||
</mapper>
|
||||
19
ibs/src/main/resources/mapper/draw/DrawShapeCustMapper.xml
Normal file
19
ibs/src/main/resources/mapper/draw/DrawShapeCustMapper.xml
Normal file
@@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.ruoyi.ibs.draw.mapper.DrawShapeCustMapper">
|
||||
<insert id="batchInsert">
|
||||
INSERT INTO draw_shape_cust_${dept} (shape_id, layer_id, cust_id, cust_name, cust_type, address_name, province,
|
||||
city, county, street, community, address_detail) VALUES
|
||||
<foreach collection="custList" item="cust" separator=",">
|
||||
(#{cust.shapeId}, #{cust.layerId}, #{cust.custId}, #{cust.custName}, #{cust.custType}, #{cust.addressName},
|
||||
#{cust.province},#{cust.city},#{cust.county},#{cust.street},#{cust.community},#{cust.addressDetail})
|
||||
</foreach>
|
||||
</insert>
|
||||
<delete id="batchDelete">
|
||||
DELETE
|
||||
FROM draw_shape_cust_${dept}
|
||||
WHERE shape_id = #{shapeId}
|
||||
</delete>
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user