From b3b566ebdfed4005aaa513da3d5d2fd3924903cc Mon Sep 17 00:00:00 2001
From: linwei <872216696@qq.com>
Date: Wed, 31 Jan 2024 16:17:54 +0800
Subject: [PATCH] 拿不到地址总表数据,不设置网格信息
---
src/main/java/org/springblade/modules/doorplateAddress/mapper/DoorplateAddressMapper.xml | 140 +++++++++++++++++++++++++++++++++++-----------
1 files changed, 107 insertions(+), 33 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 3b27113..4346da8 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,25 @@
</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">
@@ -36,6 +55,15 @@
<!--自定义分页查询-->
<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>
@@ -47,6 +75,7 @@
and nei_name = '万达社区居民委员会'
</if>
<include refid="filterHouseGrid"/>
+ <include refid="filterCommunity"/>
group by town_street_code,town_street_name
</select>
@@ -58,6 +87,7 @@
and nei_name = '万达社区居民委员会'
</if>
<include refid="filterHouseGrid"/>
+ <include refid="filterCommunity"/>
group by nei_code,nei_name,town_street_code
</select>
@@ -74,12 +104,14 @@
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 is null
and sub_aoi != ''
<if test="houseParam.name != null and houseParam.name!=''">
and nei_name = #{houseParam.name}
@@ -88,6 +120,7 @@
and nei_code = #{houseParam.code}
</if>
<include refid="filterHouseGrid"/>
+ <include refid="filterCommunity"/>
group by aoi_code,sub_aoi
)
union all
@@ -102,6 +135,7 @@
and nei_code = #{houseParam.code}
</if>
<include refid="filterHouseGrid"/>
+ <include refid="filterCommunity"/>
group by nei_code
)
union all
@@ -111,9 +145,6 @@
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}
@@ -145,29 +176,49 @@
)
</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
- ifnull(jda.unit_name,"未知单元") unitName,jda.unit_code unitCode,jda.floor,jda.house_name as houseNo,
+ 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.role_type as roleType,1 as addressType
+ 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 = 1) 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 = #{houseParam.code}
+ <if test="houseParam.searchKey!=null and houseParam.searchKey!=''">
+ and jh.name like concat('%',#{houseParam.searchKey},'%')
+ </if>
<include refid="filterHouseGrid"/>
)
union all
(
- select '' as unitName,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 = #{houseParam.code}
and building_name != ''
@@ -256,7 +307,7 @@
jp.id as cid,jp.*,jp.create_time as pcreateTime,
bu.real_name as createUserName
FROM jczz_doorplate_address jda
- left join jczz_place jp on jda.address_code = jp.house_code and jp.is_deleted = 0
+ left join jczz_place jp on locate(jda.address_code,jp.house_code)>0 and jp.is_deleted = 0
left join blade_user bu on bu.id = jp.create_user and bu.is_deleted = 0
WHERE 1=1
<if test="vo.stdId != null and vo.stdId != ''">
@@ -361,25 +412,22 @@
<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
+ and doorplate_num!=''
<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}
@@ -421,23 +469,49 @@
</select>
<!--查询所有的地址表和场所表差集集合(小区和非小区的)-->
+ <select id="getNotInPlaceList" resultType="org.springblade.modules.doorplateAddress.entity.DoorplateAddressEntity">
+ select jda.* from jczz_doorplate_address jda
+ left join jczz_place jp on jda.address_code=jp.house_code and jp.is_deleted = 0
+ where 1=1
+ and (doorplate_type = '小门牌' or (doorplate_type = '中门牌' and address_level = 1))
+ and jp.id is null
+ <if test="townName!=null and townName!=''">
+ and jda.town_street_name like concat('%',#{townName},'%')
+ </if>
+ </select>
+
+ <!--查询场所标准地址数据-->
<select id="getPlaceList" resultType="org.springblade.modules.doorplateAddress.entity.DoorplateAddressEntity">
- select
- min(jda.id)
+ select jda.*
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)
- 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
- )
+ where 1=1
+ and (doorplate_type = '小门牌' or (doorplate_type = '中门牌' and address_level = 1))
+ <if test="doorplateAddress.addressName!=null and doorplateAddress.addressName!=''">
+ and address_name like concat('%',#{doorplateAddress.addressName},'%')
+ </if>
+ <if test="doorplateAddress.poi!=null and doorplateAddress.poi!=''">
+ and poi like concat('%',#{doorplateAddress.poi},'%')
+ </if>
+ </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