From 526dbcc8dc168afad762346e24a77122db439f78 Mon Sep 17 00:00:00 2001
From: zhongrj <646384940@qq.com>
Date: Mon, 05 Feb 2024 22:17:30 +0800
Subject: [PATCH] 社区街道过滤调整
---
src/main/java/org/springblade/modules/doorplateAddress/mapper/DoorplateAddressMapper.xml | 97 ++++++++++++++++++++++++++++++++++++++++++------
1 files changed, 84 insertions(+), 13 deletions(-)
diff --git a/src/main/java/org/springblade/modules/doorplateAddress/mapper/DoorplateAddressMapper.xml b/src/main/java/org/springblade/modules/doorplateAddress/mapper/DoorplateAddressMapper.xml
index 31c77b0..4208aa7 100644
--- a/src/main/java/org/springblade/modules/doorplateAddress/mapper/DoorplateAddressMapper.xml
+++ b/src/main/java/org/springblade/modules/doorplateAddress/mapper/DoorplateAddressMapper.xml
@@ -21,6 +21,8 @@
</if>
</sql>
+
+
<!--过滤社区数据-->
<sql id="filterCommunity">
<if test="houseParam.roleName!=null and houseParam.roleName!=''">
@@ -39,6 +41,7 @@
</if>
</if>
</sql>
+
<!--门牌地址详情查询-->
<resultMap id="doorplateAddressDetailMap" type="org.springblade.modules.doorplateAddress.vo.DoorplateAddressVO"
@@ -68,27 +71,95 @@
<!--查询区域数据-街道-->
- <select id="getRegionListByGroupTwon" resultType="org.springblade.common.node.TreeStringNode" >
- select town_street_code as id,town_street_name as name from jczz_doorplate_address
- where 1=1
- <if test="houseParam.userId!=null and houseParam.userId!='' and houseParam.userId=='1726859808689696770'">
- and nei_name = '万达社区居民委员会'
+<!-- <select id="getRegionListByGroupTwon" resultType="org.springblade.common.node.TreeStringNode" >-->
+<!-- select town_street_code as id,town_street_name as name from jczz_doorplate_address-->
+<!-- where 1=1-->
+<!-- <if test="houseParam.userId!=null and houseParam.userId!='' and houseParam.userId=='1726859808689696770'">-->
+<!-- and nei_name = '万达社区居民委员会'-->
+<!-- </if>-->
+<!-- <include refid="filterHouseGrid"/>-->
+<!-- <include refid="filterCommunity"/>-->
+<!-- group by town_street_code,town_street_name-->
+<!-- </select>-->
+
+ <!--过滤网格数据-->
+ <sql id="filterHouseGridByTownOrCommunity">
+ <if test="houseParam.roleName!=null and houseParam.roleName!='' and houseParam.roleName!='系统管理员'">
+ <choose>
+ <when test="houseParam.roleName=='网格员' and houseParam.userId!='1726859808689696770'">
+ <choose>
+ <when test="list != null and list.size()>0">
+ and jg.grid_code in
+ <foreach collection="list" item="gridCode" separator ="," open="(" close=")">
+ #{gridCode}
+ </foreach>
+ </when>
+ <otherwise>
+ and jg.grid_code in ('')
+ </otherwise>
+ </choose>
+ </when>
+ <otherwise>
+ and jg.grid_code in ('')
+ </otherwise>
+ </choose>
</if>
- <include refid="filterHouseGrid"/>
- <include refid="filterCommunity"/>
- group by town_street_code,town_street_name
+ </sql>
+
+ <!--查询区域数据-街道-->
+ <select id="getRegionListByGroupTwon" resultType="org.springblade.common.node.TreeStringNode" >
+ select br.town_code as id,br.town_name as name from jczz_grid jg
+ left join blade_region br on jg.community_code = br.code
+ where jg.is_deleted = 0
+ <if test="houseParam.userId!=null and houseParam.userId!='' and houseParam.userId=='1726859808689696770'">
+ and br.name = '万达社区居民委员会'
+ </if>
+ <include refid="filterHouseGridByTownOrCommunity"/>
+ union
+ select br.town_code as id,br.town_name as name from jczz_police_affairs_grid jpag
+ left join blade_region br on jpag.community_code = br.code
+ where jpag.is_deleted = 0
+ <include refid="filterCommunityByTownOrCommunity"/>
</select>
+
+ <!--过滤社区数据-->
+ <sql id="filterCommunityByTownOrCommunity">
+ <if test="houseParam.roleName!=null and houseParam.roleName!=''">
+ <choose>
+ <when test="houseParam.roleName=='民警' and houseParam.userId!='1726859808689696770'">
+ <choose>
+ <when test="communityList != null and communityList.size()>0">
+ and br.code in
+ <foreach collection="communityList" item="code" separator ="," open="(" close=")">
+ #{code}
+ </foreach>
+ </when>
+ <otherwise>
+ and br.code in ('')
+ </otherwise>
+ </choose>
+ </when>
+ <otherwise>
+ and br.code in ('')
+ </otherwise>
+ </choose>
+ </if>
+ </sql>
<!--查询区域数据-社区-->
<select id="getRegionListByGroupNei" resultType="org.springblade.common.node.TreeStringNode" >
- select nei_code as id,nei_name as name,town_street_code as parentId from jczz_doorplate_address
- where 1=1
+ select br.village_code as id,br.village_name as name,br.town_code as parentId from jczz_grid jg
+ left join blade_region br on jg.community_code = br.code
+ where jg.is_deleted = 0
<if test="houseParam.userId!=null and houseParam.userId!='' and houseParam.userId=='1726859808689696770'">
and nei_name = '万达社区居民委员会'
</if>
- <include refid="filterHouseGrid"/>
- <include refid="filterCommunity"/>
- group by nei_code,nei_name,town_street_code
+ <include refid="filterHouseGridByTownOrCommunity"/>
+ union
+ select br.village_code as id,br.village_name as name,br.town_code as parentId from jczz_police_affairs_grid jpag
+ left join blade_region br on jpag.community_code = br.code
+ where jpag.is_deleted = 0
+ <include refid="filterCommunityByTownOrCommunity"/>
</select>
<!--根据社区名称查询小区集合-->
--
Gitblit v1.9.3