From ad2ec97fe0c60eee4bb7c8cdacff7c876f280ea7 Mon Sep 17 00:00:00 2001
From: linwei <872216696@qq.com>
Date: Mon, 08 Jan 2024 11:30:18 +0800
Subject: [PATCH] 公安安全监管
---
src/main/java/org/springblade/modules/doorplateAddress/mapper/DoorplateAddressMapper.xml | 379 ++++++++++++++++++++++++++++++++++++++++++++++++-----
1 files changed, 340 insertions(+), 39 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 d35b482..0822896 100644
--- a/src/main/java/org/springblade/modules/doorplateAddress/mapper/DoorplateAddressMapper.xml
+++ b/src/main/java/org/springblade/modules/doorplateAddress/mapper/DoorplateAddressMapper.xml
@@ -2,6 +2,44 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.springblade.modules.doorplateAddress.mapper.DoorplateAddressMapper">
+ <!--过滤网格数据-->
+ <sql id="filterHouseGrid">
+ <if test="houseParam.roleName!=null and houseParam.roleName!=''">
+ <if test="houseParam.roleName=='网格员' and houseParam.userId!='1726859808689696770'">
+ <choose>
+ <when test="list != null and list.size()>0">
+ and address_code in
+ <foreach collection="list" item="houseCode" separator ="," open="(" close=")">
+ #{houseCode}
+ </foreach>
+ </when>
+ <otherwise>
+ and address_code in ('')
+ </otherwise>
+ </choose>
+ </if>
+ </if>
+ </sql>
+
+ <!--过滤社区数据-->
+ <sql id="filterCommunity">
+ <if test="houseParam.roleName!=null and houseParam.roleName!=''">
+ <if test="houseParam.roleName=='民警' and houseParam.userId!='1726859808689696770'">
+ <choose>
+ <when test="communityList != null and communityList.size()>0">
+ and nei_code in
+ <foreach collection="communityList" item="neiCode" separator ="," open="(" close=")">
+ #{neiCode}
+ </foreach>
+ </when>
+ <otherwise>
+ and nei_code in ('')
+ </otherwise>
+ </choose>
+ </if>
+ </if>
+ </sql>
+
<!--门牌地址详情查询-->
<resultMap id="doorplateAddressDetailMap" type="org.springblade.modules.doorplateAddress.vo.DoorplateAddressVO"
autoMapping="true">
@@ -17,44 +55,72 @@
<!--自定义分页查询-->
<select id="selectDoorplateAddressPage" resultType="org.springblade.modules.doorplateAddress.vo.DoorplateAddressVO">
select * from jczz_doorplate_address where 1=1
+ <if test="doorplateAddress.aoiName!=null and doorplateAddress.aoiName!=''">
+ and aoi_name like concat('%',#{doorplateAddress.aoiName},'%')
+ </if>
+ <if test="doorplateAddress.addressName!=null and doorplateAddress.addressName!=''">
+ and address_name like concat('%',#{doorplateAddress.addressName},'%')
+ </if>
+ <if test="doorplateAddress.townStreetCode != null and doorplateAddress.townStreetCode != ''">
+ and town_street_code like concat('%',#{doorplateAddress.townStreetCode},'%')
+ </if>
</select>
<!--查询区域数据-街道-->
- <select id="getRegionListByGroupTwon" resultType="org.springblade.common.node.TreeNode" >
- select town_street_code as id,town_street_name as name from jczz_doorplate_address group by town_street_code,town_street_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>
<!--查询区域数据-社区-->
- <select id="getRegionListByGroupNei" resultType="org.springblade.common.node.TreeNode" >
- select nei_code as id,nei_name as name from jczz_doorplate_address group by nei_code,nei_name
+ <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
+ <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
</select>
<!--根据社区名称查询小区集合-->
- <select id="getDistrictList" resultType="org.springblade.common.node.TreeNode" >
+ <select id="getDistrictList" resultType="org.springblade.common.node.TreeStringNode" >
select aoi_code as id,aoi_name as name,1 as addressType from jczz_doorplate_address
where 1=1
and aoi_name !=''
and aoi_code !=''
- <if test="name != null and name!=''">
- and nei_name = #{name}
+ <if test="houseParam.name != null and houseParam.name!=''">
+ and nei_name = #{houseParam.name}
</if>
- <if test="code != null and code!=''">
- and nei_code = #{code}
+ <if test="houseParam.code != null and houseParam.code!=''">
+ and nei_code = #{houseParam.code}
</if>
+ <include refid="filterHouseGrid"/>
+ <include refid="filterCommunity"/>
group by aoi_code,aoi_name
union all
(
select aoi_code as id,sub_aoi as name,1 as addressType from jczz_doorplate_address
where 1=1
and aoi_code !=''
+ and aoi_name =''
and sub_aoi != ''
- <if test="name != null and name!=''">
- and nei_name = #{name}
+ <if test="houseParam.name != null and houseParam.name!=''">
+ and nei_name = #{houseParam.name}
</if>
- <if test="code != null and code!=''">
- and nei_code = #{code}
+ <if test="houseParam.code != null and houseParam.code!=''">
+ and nei_code = #{houseParam.code}
</if>
+ <include refid="filterHouseGrid"/>
+ <include refid="filterCommunity"/>
group by aoi_code,sub_aoi
)
union all
@@ -62,25 +128,43 @@
select nei_code as id,'自建房/商铺' as name,2 as addressType from jczz_doorplate_address
where 1=1
and aoi_code is null
- <if test="name != null and name!=''">
- and nei_name = #{name}
+ <if test="houseParam.name != null and houseParam.name!=''">
+ and nei_name = #{houseParam.name}
</if>
- <if test="code != null and code!=''">
- and nei_code = #{code}
+ <if test="houseParam.code != null and houseParam.code!=''">
+ and nei_code = #{houseParam.code}
</if>
+ <include refid="filterHouseGrid"/>
+ <include refid="filterCommunity"/>
group by nei_code
+ )
+ union all
+ (
+ select '企业商超' as id,'企业商超' as name,4 as addressType from jczz_place_rel jpl
+ join jczz_place jp on jpl.place_id = jp.id and jp.is_deleted = 0
+ where jpl.is_deleted = 0
+ <if test="houseParam.communityName!=null and houseParam.communityName!=''">
+ and community_name like concat('%',#{houseParam.communityName},'%')
+ </if>
+ <if test="houseParam.gridName!=null and houseParam.gridName!=''">
+ and grid_name like concat('%',#{houseParam.gridName},'%')
+ </if>
+ <if test="houseParam.code != null and houseParam.code!=''">
+ and community_code = #{houseParam.code}
+ </if>
+ limit 1
)
</select>
<!--根据小区名称查询楼栋/商铺集合-->
- <select id="getBuildingList" resultType="org.springblade.common.node.TreeNode" >
+ <select id="getBuildingList" resultType="org.springblade.common.node.TreeStringNode" >
(
- select building_code as id,building_name as name,1 as addressType from jczz_doorplate_address
+ select building_code as id,ifnull(building_name,'1栋') as name,1 as addressType from jczz_doorplate_address
where 1=1
- and aoi_code = #{code}
+ and aoi_code = #{houseParam.code}
and building_code !=''
- and building_name !=''
and doorplate_type = '户室牌'
+ <include refid="filterHouseGrid"/>
group by building_code,building_name
order by building_name
)
@@ -88,37 +172,61 @@
(
select address_code as id,doorplate_name as name,2 as addressType from jczz_doorplate_address
where 1=1
- and aoi_code = #{code}
+ and aoi_code = #{houseParam.code}
and building_name is null
and (doorplate_type = '小门牌' or (doorplate_type = '中门牌' and address_level = 1))
+ <include refid="filterHouseGrid"/>
)
</select>
+ <!--户室map-->
+ <resultMap id="houseFuncNodeMap" type="org.springblade.modules.doorplateAddress.vo.FuncNode" autoMapping="true" >
+ <id column="id" property="id"/>
+ <collection property="householdLabelList" javaType="java.util.List"
+ ofType="org.springblade.modules.house.vo.HouseholdLabelVO" autoMapping="true">
+ <id property="id" column="cid"/>
+ </collection>
+ </resultMap>
+
<!--查询户室及住户相关信息,单元中包含住户-->
- <select id="getUnitHouseholdList" resultType="org.springblade.modules.doorplateAddress.vo.FuncNode" >
+ <select id="getUnitHouseholdList" resultMap="houseFuncNodeMap" >
(
select
- jda.unit_code unitCode,jda.floor,jda.house_name as houseNo,jda.address_code addressCode,
- jh.name as realName,jh.role_type as roleType,1 as addressType
+ jda.id,ifnull(jda.unit_name,"未知单元") unitName,jda.unit_code unitCode,jda.floor,jda.house_name as houseNo,
+ jda.address_code addressCode,
+ jh.name as realName,jh.relationship as roleType,1 as addressType,
+ juhl.id as cid,juhl.house_code,juhl.label_id,juhl.label_name,juhl.color,juhl.household_id
from jczz_doorplate_address jda
left join
- (select house_code,name,role_type from jczz_household where role_type = '业主') jh
+ (
+ SELECT house_code, NAME, relationship FROM jczz_household WHERE id in(
+ SELECT max(id) FROM jczz_household where is_deleted =0 and relationship = 1 GROUP BY house_code
+ )
+ ) jh
on jda.address_code = jh.house_code
+ left join jczz_user_house_label juhl on juhl.house_code = jda.address_code and lable_type=1
where 1=1
and floor != ''
and house_name != ''
and doorplate_type = '户室牌'
- and building_code = #{code}
+ and building_code = #{houseParam.code}
+ <if test="houseParam.searchKey!=null and houseParam.searchKey!=''">
+ and jh.name like concat('%',#{houseParam.searchKey},'%')
+ </if>
+ <include refid="filterHouseGrid"/>
)
union all
(
- select address_code as unitCode,doorplate_name as floor,'' as houseNo,address_code as addressCode,
- '' as realName,'' as roleType,2 as addressType
- from jczz_doorplate_address
+ select jda2.id,'' as unitName,address_code as unitCode,doorplate_name as floor,'' as houseNo,address_code as addressCode,
+ '' as realName,'' as roleType,2 as addressType,
+ juhl.id as cid,juhl.house_code,juhl.label_id,juhl.label_name,juhl.color,juhl.household_id
+ from jczz_doorplate_address jda2
+ left join jczz_user_house_label juhl on juhl.house_code = jda2.address_code and lable_type=1
where 1=1
- and building_code = #{code}
+ and building_code = #{houseParam.code}
and building_name != ''
and (doorplate_type = '小门牌' or (doorplate_type = '中门牌' and address_level = 1))
+ <include refid="filterHouseGrid"/>
)
</select>
@@ -166,26 +274,33 @@
</select>
<!--根据社区查询街路巷集合-->
- <select id="getStreetRuList" resultType="org.springblade.common.node.TreeNode" >
+ <select id="getStreetRuList" resultType="org.springblade.common.node.TreeStringNode" >
select street_ru_code as id,street_ru_name as name,3 as addressType from jczz_doorplate_address
where 1=1
and aoi_code is null
- <if test="name != null and name!=''">
- and nei_name = #{name}
+ <if test="houseParam.name != null and houseParam.name!=''">
+ and nei_name = #{houseParam.name}
</if>
- <if test="code != null and code!=''">
- and nei_code = #{code}
+ <if test="houseParam.code != null and houseParam.code!=''">
+ and nei_code = #{houseParam.code}
</if>
+ <include refid="filterHouseGrid"/>
group by street_ru_code,street_ru_name
</select>
<!--根据街路巷编号查询街路巷门牌名称集合-->
<select id="getDoorplateNameList" resultType="org.springblade.modules.doorplateAddress.vo.FuncNode">
- select address_code as addressCode,doorplate_name as floor from jczz_doorplate_address
+ select address_code as addressCode,
+ IFNULL(CONCAT(doorplate_num,sub_door_plate_no), IF(doorplate_num IS NULL, sub_door_plate_no, doorplate_num)) as floor,
+ 3 as addressType
+ from jczz_doorplate_address
where 1=1
- and street_ru_code = #{code}
- and nei_code = #{name}
+ and street_ru_code = #{houseParam.code}
+ and nei_code = #{houseParam.name}
and aoi_code is null
+ and doorplate_type = '中门牌'
+ <include refid="filterHouseGrid"/>
+ order by doorplate_num,sub_door_plate_no
</select>
<select id="getDoorplateAddressDetail"
@@ -218,4 +333,190 @@
</if>
</select>
+ <!--查询社区信息-->
+ <select id="getAllDoorplateAddress" resultType="org.springblade.modules.doorplateAddress.entity.DoorplateAddressEntity">
+ select * from jczz_doorplate_address
+ where 1=1
+ <if test="name!=null and name!=''">
+ and nei_name = #{name}
+ </if>
+ </select>
+
+ <!--获取房屋树-->
+ <select id="getHouseTree" resultType="org.springblade.modules.doorplateAddress.vo.DoorplateAddressVOTree">
+ SELECT
+ aoi_code as code,
+ aoi_name as name,
+ nei_code as parentCode
+ FROM jczz_doorplate_address
+ WHERE nei_code = #{houseParam.code}
+ and aoi_code is not null and aoi_code !=''
+ and aoi_name is not null and aoi_name !=''
+ GROUP BY aoi_code,aoi_name,nei_code
+ <include refid="filterHouseGrid"/>
+ union all
+ (
+ SELECT
+ building_code as code,
+ building_name as name,
+ aoi_code as parentCode
+ FROM jczz_doorplate_address
+ WHERE nei_code = #{houseParam.code}
+ and building_code is not null and building_code !=''
+ and building_name is not null and building_name !=''
+ GROUP BY building_code,building_name,aoi_code
+ <include refid="filterHouseGrid"/>
+ )
+ union all
+ (
+ select
+ jda.unit_code as code,
+ ifnull(jda.unit_name,"一单元") name,
+ jda.building_code as parentCode
+ from jczz_doorplate_address jda
+ where 1=1
+ and floor != ''
+ and house_name != ''
+ and doorplate_type = '户室牌'
+ and nei_code = #{houseParam.code}
+ <include refid="filterHouseGrid"/>
+ group by unit_name,unit_code,building_code
+ )
+ union all
+ (
+ select
+ jda.address_code as code,
+ jda.house_name as name,
+ jda.unit_code as parentCode
+ from jczz_doorplate_address jda
+ where 1=1
+ and floor != ''
+ and house_name != ''
+ and doorplate_type = '户室牌'
+ and nei_code = #{houseParam.code}
+ <include refid="filterHouseGrid"/>
+ )
+ </select>
+
+ <!--查询所有户室数据-->
+ <select id="getHouseList" resultType="org.springblade.modules.doorplateAddress.entity.DoorplateAddressEntity">
+ select jda.* from jczz_doorplate_address jda
+ left join jczz_house jh on jh.house_code = jda.address_code
+ where 1=1
+ and jh.house_code is null
+ and doorplate_type = '户室牌'
+ </select>
+
+ <!--查询商超-->
+ <select id="getPlaceRelList" resultType="org.springblade.common.node.TreeStringNode">
+ select building_name as id,building_name as name,4 as addressType from jczz_place_rel jpl
+ join jczz_place jp on jpl.place_id = jp.id and jp.is_deleted = 0
+ where jpl.is_deleted = 0
+ <if test="houseParam.communityName!=null and houseParam.communityName!=''">
+ and community_name like concat('%',#{houseParam.communityName},'%')
+ </if>
+ <if test="houseParam.gridName!=null and houseParam.gridName!=''">
+ and grid_name like concat('%',#{houseParam.gridName},'%')
+ </if>
+ group by building_name
+ </select>
+
+ <!--查询商超详情集合-->
+ <select id="getPlaceRelDetailList" resultType="org.springblade.modules.doorplateAddress.vo.FuncNode">
+ select jp.id as addressCode,
+ jpl.grid_name as unitName,
+ jpl.community_code as unitCode,
+ doorplate_num as floor,
+ 4 as addressType
+ from jczz_place_rel jpl
+ join jczz_place jp on jpl.place_id = jp.id and jp.is_deleted = 0
+ where jpl.is_deleted = 0
+ <if test="houseParam.communityName!=null and houseParam.communityName!=''">
+ and community_name like concat('%',#{houseParam.communityName},'%')
+ </if>
+ <if test="houseParam.gridName!=null and houseParam.gridName!=''">
+ and grid_name like concat('%',#{houseParam.gridName},'%')
+ </if>
+ <if test="houseParam.buildingName!=null and houseParam.buildingName!=''">
+ and building_name = #{houseParam.buildingName}
+ </if>
+ </select>
+
+ <!--查询小区集合-->
+ <select id="getAoiList" resultType="org.springblade.modules.doorplateAddress.entity.DoorplateAddressEntity">
+ select nei_code,aoi_code,ifnull(aoi_name,sub_aoi) as aoi_name,x,y,address_name from jczz_doorplate_address
+ where 1=1
+ <choose>
+ <when test="list != null and list.size()>0">
+ and id in
+ <foreach collection="list" item="id" separator ="," open="(" close=")">
+ #{id}
+ </foreach>
+ </when>
+ <otherwise>
+ and id in ('')
+ </otherwise>
+ </choose>
+ </select>
+
+ <!--查询所有的地址表id集合-->
+ <select id="getAoiCodeList" resultType="java.lang.Long">
+ select
+ max(id)
+ from jczz_doorplate_address
+ where aoi_code != "" and aoi_name !=""
+ GROUP BY aoi_code
+ union all
+ (
+ select
+ max(id)
+ from jczz_doorplate_address
+ where aoi_code != "" and sub_aoi != ""
+ group by aoi_code
+ )
+ </select>
+
+ <!--查询所有的地址表和场所表差集集合(小区和非小区的)-->
+ <select id="getPlaceList" resultType="org.springblade.modules.doorplateAddress.entity.DoorplateAddressEntity">
+ select jda.* from jczz_doorplate_address jda join (
+ select
+ min(jda.id) as id
+ from jczz_doorplate_address jda
+ left join jczz_district jd on jda.aoi_code = jd.aoi_code
+ where jda.aoi_code != "" and jda.aoi_name !="" and jd.id is null
+ and (doorplate_type = '大门牌' or doorplate_type = '楼幢牌' or doorplate_type = '中门牌' or doorplate_type = '单元牌')
+ GROUP BY jda.aoi_code
+ union all
+ (
+ select
+ min(jda.id) as id
+ from jczz_doorplate_address jda
+ left join jczz_district jd on jda.aoi_code = jd.aoi_code
+ where jda.aoi_code != "" and jda.sub_aoi != ""
+ and (doorplate_type = '大门牌' or doorplate_type = '楼幢牌' or doorplate_type = '中门牌')
+ group by jda.aoi_code
+ )
+ ) a on jda.id = a.id
+ </select>
+
+ <!--查询所有的地址表和场所表差集集合(小区和非小区的)-->
+ <select id="getDoorplateAddressVODetail" resultType="org.springblade.modules.doorplateAddress.vo.DoorplateAddressVO">
+ select jda.* from jczz_doorplate_address jda where address_code = #{doorplateAddress.addressCode}
+ </select>
+
+ <!--查询所有的社区集合信息-->
+ <select id="getAllCommunityList" resultType="org.springblade.modules.doorplateAddress.entity.DoorplateAddressEntity">
+ SELECT
+ jda.nei_code,
+ jda.nei_name,
+ jda.town_street_code
+ FROM
+ jczz_doorplate_address jda
+ WHERE
+ 1 = 1
+ GROUP BY
+ jda.nei_code,
+ jda.nei_name,
+ jda.town_street_code
+ </select>
</mapper>
--
Gitblit v1.9.3