From 76d431070dbe0647c0470632b1b70becb357debd Mon Sep 17 00:00:00 2001
From: zhongrj <646384940@qq.com>
Date: Tue, 21 Nov 2023 12:01:29 +0800
Subject: [PATCH] 新增商超展示,逻辑调整

---
 src/main/java/org/springblade/modules/doorplateAddress/mapper/DoorplateAddressMapper.xml |  130 +++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 125 insertions(+), 5 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 a04fcaa..6a11449 100644
--- a/src/main/java/org/springblade/modules/doorplateAddress/mapper/DoorplateAddressMapper.xml
+++ b/src/main/java/org/springblade/modules/doorplateAddress/mapper/DoorplateAddressMapper.xml
@@ -98,6 +98,19 @@
         <include refid="filterHouseGrid"/>
         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>
+        limit 1
+        )
     </select>
 
     <!--根据小区名称查询楼栋/商铺集合-->
@@ -138,7 +151,8 @@
             and floor != ''
             and house_name != ''
             and doorplate_type = '户室牌'
-            and building_code = #{code}
+            and building_code = #{houseParam.code}
+            <include refid="filterHouseGrid"/>
         )
         union all
         (
@@ -146,9 +160,10 @@
             '' as realName,'' as roleType,2 as addressType
             from jczz_doorplate_address
             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>
 
@@ -213,12 +228,14 @@
     <!--根据街路巷编号查询街路巷门牌名称集合-->
     <select id="getDoorplateNameList" resultType="org.springblade.modules.doorplateAddress.vo.FuncNode">
       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
+      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
+      <include refid="filterHouseGrid"/>
       order by doorplate_num,sub_door_plate_no
     </select>
 
@@ -252,4 +269,107 @@
         </if>
     </select>
 
+    <!--查询社区信息-->
+    <select id="getAllDoorplateAddress" resultType="org.springblade.modules.doorplateAddress.entity.DoorplateAddressEntity">
+        select * from jczz_doorplate_address where nei_name = #{name}
+    </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 * from jczz_doorplate_address
+        where 1=1 and doorplate_type = '户室牌'
+        and address_code not in (
+            select house_code from jczz_house
+        )
+    </select>
+
+    <!--查询商超-->
+    <select id="getPlaceRelList" resultType="org.springblade.common.node.TreeNode">
+        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,
+        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>
+
 </mapper>

--
Gitblit v1.9.3