From c10d6358b9f014375a13821465bc978d0c0da22e Mon Sep 17 00:00:00 2001
From: linwe <872216996@qq.com>
Date: Wed, 29 May 2024 17:17:08 +0800
Subject: [PATCH] 通过E呼即办数据统计

---
 src/main/java/org/springblade/modules/doorplateAddress/mapper/DoorplateAddressMapper.xml |  457 +++++++++++++++++++++++++++++++++++++++++++++++++--------
 1 files changed, 392 insertions(+), 65 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 6341475..7f251b8 100644
--- a/src/main/java/org/springblade/modules/doorplateAddress/mapper/DoorplateAddressMapper.xml
+++ b/src/main/java/org/springblade/modules/doorplateAddress/mapper/DoorplateAddressMapper.xml
@@ -5,7 +5,7 @@
     <!--过滤网格数据-->
     <sql id="filterHouseGrid">
         <if test="houseParam.roleName!=null and houseParam.roleName!=''">
-            <if test="houseParam.roleName=='网格员' and houseParam.userId!='1726859808689696770'">
+            <if test="houseParam.roleName=='wgy' and houseParam.userId!='1726859808689696770'">
                 <choose>
                     <when test="list != null and list.size()>0">
                         and address_code in
@@ -21,10 +21,12 @@
         </if>
     </sql>
 
+
+
     <!--过滤社区数据-->
     <sql id="filterCommunity">
         <if test="houseParam.roleName!=null and houseParam.roleName!=''">
-            <if test="houseParam.roleName=='民警' and houseParam.userId!='1726859808689696770'">
+            <if test="houseParam.roleName=='mj' and houseParam.userId!='1726859808689696770'">
                 <choose>
                     <when test="communityList != null and communityList.size()>0">
                         and nei_code in
@@ -40,6 +42,7 @@
         </if>
     </sql>
 
+
     <!--门牌地址详情查询-->
     <resultMap id="doorplateAddressDetailMap" type="org.springblade.modules.doorplateAddress.vo.DoorplateAddressVO"
                autoMapping="true">
@@ -54,41 +57,134 @@
 
     <!--自定义分页查询-->
     <select id="selectDoorplateAddressPage" resultType="org.springblade.modules.doorplateAddress.vo.DoorplateAddressVO">
-        select * from jczz_doorplate_address where 1=1
+        SELECT
+        jda.*
+        FROM
+        jczz_doorplate_address jda LEFT JOIN jczz_district jd on jda.aoi_code=jd.aoi_code
+        where 1=1
         <if test="doorplateAddress.aoiName!=null and doorplateAddress.aoiName!=''">
-            and aoi_name like concat('%',#{doorplateAddress.aoiName},'%')
+            and jda.aoi_name like concat('%',#{doorplateAddress.aoiName},'%')
         </if>
         <if test="doorplateAddress.addressName!=null and doorplateAddress.addressName!=''">
-            and address_name like concat('%',#{doorplateAddress.addressName},'%')
+            and jda.address_name like concat('%',#{doorplateAddress.addressName},'%')
         </if>
         <if test="doorplateAddress.townStreetCode != null and doorplateAddress.townStreetCode != ''">
-            and town_street_code like concat('%',#{doorplateAddress.townStreetCode},'%')
+            and jda.town_street_code like concat('%',#{doorplateAddress.townStreetCode},'%')
+        </if>
+
+        <if test="doorplateAddress.houseName != null and doorplateAddress.houseName != ''">
+            and jda.house_name like concat('%',#{doorplateAddress.houseName},'%')
+        </if>
+
+        <if test="doorplateAddress.buildingName != null and doorplateAddress.buildingName != ''">
+            and jda.building_name like concat('%',#{doorplateAddress.buildingName},'%')
+        </if>
+
+        <if test="doorplateAddress.unitName != null and doorplateAddress.unitName != ''">
+            and jda.unit_name like concat('%',#{doorplateAddress.unitName},'%')
+        </if>
+
+        <if test="doorplateAddress.districtIds != null ">
+            and jd.id in
+        <foreach collection="doorplateAddress.districtIds" item="districtId" separator ="," open="("  close=")">
+            #{districtId}
+        </foreach>
         </if>
     </select>
 
 
     <!--查询区域数据-街道-->
-    <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!='admin'">
+            <choose>
+                <when test="(houseParam.roleName=='wgy' or houseParam.roleName=='wzcj') 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"/>
+        group by br.town_code,br.town_name
+        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 and br.town_code is not null
+        <include refid="filterCommunityByTownOrCommunity"/>
+        group by br.town_code,br.town_name
     </select>
+
+    <!--过滤社区数据-->
+    <sql id="filterCommunityByTownOrCommunity">
+        <if test="houseParam.roleName!=null and houseParam.roleName!=''">
+            <choose>
+                <when test="houseParam.roleName=='mj'">
+                    <choose>
+                        <when test="communityList != null and communityList.size()>0">
+                            and jpag.jw_grid_code in
+                            <foreach collection="communityList" item="code" separator ="," open="("  close=")">
+                                #{code}
+                            </foreach>
+                        </when>
+                        <otherwise>
+                            and jpag.jw_grid_code in ('')
+                        </otherwise>
+                    </choose>
+                </when>
+                <otherwise>
+                    and jpag.jw_grid_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 and br.village_code is not null
+        <include refid="filterCommunityByTownOrCommunity"/>
     </select>
 
     <!--根据社区名称查询小区集合-->
@@ -111,6 +207,7 @@
         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}
@@ -145,9 +242,6 @@
         <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>
@@ -178,17 +272,34 @@
         )
     </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,
+            juhlh.color as houseColor
             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 juhl.lable_type=1
+            left join jczz_user_house_label juhlh on juhlh.house_code = jda.address_code and juhlh.lable_type=2
             where 1=1
             and floor != ''
             and house_name != ''
@@ -201,9 +312,13 @@
         )
         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,
+            juhlh.color as houseColor
+            from jczz_doorplate_address jda2
+            left join jczz_user_house_label juhl on juhl.house_code = jda2.address_code and juhl.lable_type=1
+            left join jczz_user_house_label juhlh on juhlh.house_code = jda2.address_code and juhlh.lable_type=2
             where 1=1
             and building_code = #{houseParam.code}
             and building_name != ''
@@ -292,7 +407,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 jda.address_code = jp.house_code= 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 != ''">
@@ -317,10 +432,21 @@
 
     <!--查询社区信息-->
     <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}
+        select
+        jda.id,
+        jda.address_code,
+        jda.aoi_code,
+        jda.aoi_name,
+        jda.x,
+        jda.y
+        from jczz_doorplate_address jda
+        left join jczz_grid_range jgr on jda.address_code = jgr.house_code
+        where 1=1 and jgr.id is null
+        <if test="doorplateAddressEntity.neiName!=null and doorplateAddressEntity.neiName!=''">
+            and jda.nei_name = #{doorplateAddressEntity.neiName}
+        </if>
+        <if test="doorplateAddressEntity.townStreetName!=null and doorplateAddressEntity.townStreetName!=''">
+            and jda.town_street_name = #{doorplateAddressEntity.townStreetName}
         </if>
     </select>
 
@@ -387,6 +513,10 @@
         where 1=1
         and jh.house_code is null
         and doorplate_type = '户室牌'
+        <if test="townName!=null and townName!=''">
+            and jda.town_street_name like concat('%',#{townName},'%')
+        </if>
+        limit 0,1000
     </select>
 
     <!--查询商超-->
@@ -397,25 +527,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}
@@ -442,47 +569,171 @@
     <!--查询所有的地址表id集合-->
     <select id="getAoiCodeList" resultType="java.lang.Long">
         select
-        max(id)
+        min(id)
         from jczz_doorplate_address
         where aoi_code != "" and aoi_name !=""
+				and doorplate_type = '大门牌'
         GROUP BY aoi_code
         union all
         (
         select
-        max(id)
+        min(id)
         from jczz_doorplate_address
         where aoi_code != "" and sub_aoi != ""
+				and doorplate_type = '大门牌'
         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 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>
+        limit 0,1000
     </select>
 
-    <!--查询所有的地址表和场所表差集集合(小区和非小区的)-->
-    <select id="getDoorplateAddressVODetail" resultType="org.springblade.modules.doorplateAddress.vo.DoorplateAddressVO">
-        select jda.* from jczz_doorplate_address jda where address_code = #{doorplateAddress.addressCode}
+    <!--查询未入库的场所-->
+    <select id="getNotPlaceListCount" resultType="java.lang.Integer">
+        select count(*) 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 jda.*
+        from jczz_doorplate_address jda
+        left join jczz_grid_range jgr on jda.address_code = jgr.house_code
+        where 1=1
+--         and (doorplate_type = '小门牌' or (doorplate_type = '中门牌' and address_level = 1))
+        <if test="doorplateAddress.addressName!=null and doorplateAddress.addressName!=''">
+            and jda.address_name like concat('%',#{doorplateAddress.addressName},'%')
+        </if>
+        <if test="doorplateAddress.poi!=null and doorplateAddress.poi!=''">
+            and jda.poi like concat('%',#{doorplateAddress.poi},'%')
+        </if>
+        <if test="doorplateAddress.addressCode!=null and doorplateAddress.addressCode!=''">
+            and jda.address_code in
+            <foreach collection="addressCode.split(',')" item="addressCode" open="(" close=")" separator=",">
+                #{addressCode}
+            </foreach>
+        </if>
+        <if test="isAdministrator==2">
+            <choose>
+                <when test="doorplateAddress.roleName != null and doorplateAddress.roleName != ''">
+                    <if test="doorplateAddress.roleName=='wgy'">
+                        <choose>
+                            <when test="gridCodeList !=null and gridCodeList.size()>0">
+                                and jgr.grid_code in
+                                <foreach collection="gridCodeList" item="code" open="(" close=")" separator=",">
+                                    #{code}
+                                </foreach>
+                            </when>
+                            <otherwise>
+                                and jgr.grid_code in ('')
+                            </otherwise>
+                        </choose>
+                    </if>
+                    <if test="doorplateAddress.roleName=='mj'">
+                        <choose>
+                            <when test="regionChildCodesList !=null and regionChildCodesList.size()>0">
+                                and jda.nei_code in
+                                <foreach collection="regionChildCodesList" item="code" open="(" close=")" separator=",">
+                                    #{code}
+                                </foreach>
+                            </when>
+                            <otherwise>
+                                and jda.nei_code in ('')
+                            </otherwise>
+                        </choose>
+                    </if>
+                </when>
+                <otherwise>
+                    <choose>
+                        <when test="regionChildCodesList !=null and regionChildCodesList.size()>0">
+                            and
+                            (
+                            jgr.grid_code in
+                            <foreach collection="regionChildCodesList" item="code" open="(" close=")" separator=",">
+                                #{code}
+                            </foreach>
+                            or
+                            jda.nei_code in
+                            <foreach collection="regionChildCodesList" item="code" open="(" close=")" separator=",">
+                                #{code}
+                            </foreach>
+                            )
+                        </when>
+                        <otherwise>
+                            and
+                            (
+                            jgr.grid_code in ('') or jda.nei_code in ('')
+                            )
+                        </otherwise>
+                    </choose>
+                </otherwise>
+            </choose>
+        </if>
+        limit 0,#{size}
+    </select>
+
+    <!--查询地址表详情-->
+    <select id="getDoorplateAddressVODetail" resultMap="detailMap">
+        select
+        jda.*,
+        jh.id as hid,
+        jh.name as hname,
+        jh.phone_number,
+        jh.card_no,
+        jh.occupation,
+        jh.current_address,
+        jp.id as pid,
+        jp.principal,
+        jp.principal_phone,
+        jp.principal_id_card,
+        case
+        when jh.id is not null then 1
+        when jp.id is not null then 2
+        when jp.id is not null and jh.id is not null then 3
+        when jp.id is null and jh.id is null then 4
+        end as addType
+        from jczz_doorplate_address jda
+        left join jczz_place jp on jp.house_code = jda.address_code and jp.is_deleted = 0
+        left join jczz_household jh on jh.house_code = jda.address_code and jh.is_deleted = 0 and jh.relationship = 1
+        where address_code = #{doorplateAddress.addressCode}
+    </select>
+
+    <!--门牌地址详情查询-->
+    <resultMap id="detailMap" type="org.springblade.modules.doorplateAddress.vo.DoorplateAddressVO"
+               autoMapping="true">
+        <id property="id" column="id"/>
+        <association property="place" javaType="org.springblade.modules.place.vo.PlaceVO">
+            <id property="id" column="pid"/>
+            <result property="principal" column="principal"/>
+            <result property="principalPhone" column="principal_phone"/>
+            <result property="principalIdCard" column="principal_id_card"/>
+        </association>
+        <collection property="householdList" javaType="java.util.List"
+                    ofType="org.springblade.modules.house.vo.HouseholdVO">
+            <id property="id" column="hid"/>
+            <result property="name" column="hname"/>
+            <result property="phoneNumber" column="phone_number"/>
+            <result property="cardNo" column="card_no"/>
+            <result property="occupation" column="occupation"/>
+            <result property="currentAddress" column="current_address"/>
+        </collection>
+    </resultMap>
 
     <!--查询所有的社区集合信息-->
     <select id="getAllCommunityList" resultType="org.springblade.modules.doorplateAddress.entity.DoorplateAddressEntity">
@@ -499,4 +750,80 @@
             jda.nei_name,
             jda.town_street_code
     </select>
+
+
+    <select id="getHouseBuildingCode"
+            resultType="org.springblade.modules.doorplateAddress.vo.DoorplateAddressVO">
+
+        SELECT DISTINCT
+            jda.building_code,
+            jda.building_name
+        FROM
+            jczz_doorplate_address jda
+                LEFT JOIN jczz_district jd ON jd.aoi_code = jda.aoi_code
+        WHERE
+            jd.id = #{districtId}
+          and jda.building_code is not null
+
+    </select>
+
+
+    <!--查询所有户室数据-->
+    <select id="getNotHouseListCount" resultType="java.lang.Integer">
+        select count(*) 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 = '户室牌'
+        <if test="townName!=null and townName!=''">
+            and jda.town_street_name like concat('%',#{townName},'%')
+        </if>
+        limit 0,1000
+    </select>
+
+    <!--查询网格范围表未绑定的地址表信息数量-->
+    <select id="getNotBindGridRangeDoorListCount" resultType="java.lang.Integer">
+        select count(*) from jczz_doorplate_address jda
+        left join jczz_grid_range jgr on jgr.house_code = jda.address_code
+        where 1=1
+        and jgr.house_code is null
+        <if test="townName!=null and townName!=''">
+            and jda.town_street_name like concat('%',#{townName},'%')
+        </if>
+        <if test="communityName!=null and communityName!=''">
+            and jda.nei_name like concat('%',#{communityName},'%')
+        </if>
+        limit 0,1000
+    </select>
+
+    <!--查询所有未匹配的网格范围地址数据-->
+    <select id="getNotBindGridRangeDoorList" resultType="org.springblade.modules.doorplateAddress.entity.DoorplateAddressEntity">
+        select
+        jda.address_code,
+        jda.aoi_code,
+        jda.building_code,
+        jda.x,
+        jda.y
+        from jczz_doorplate_address jda
+        left join jczz_grid_range jgr on jgr.house_code = jda.address_code
+        where 1=1
+        and jgr.house_code is null
+        <if test="townName!=null and townName!=''">
+            and jda.town_street_name like concat('%',#{townName},'%')
+        </if>
+        <if test="communityName!=null and communityName!=''">
+            and jda.nei_name like concat('%',#{communityName},'%')
+        </if>
+        limit 0,1000
+    </select>
+
+    <!--查询所有未匹配的网格范围地址数据-->
+    <select id="getDoorplateAddressDetailByHouseId" resultType="org.springblade.modules.doorplateAddress.vo.DoorplateAddressVO">
+        select
+        jda.*
+        from jczz_doorplate_address jda
+        left join jczz_house jh on jh.house_code = jda.address_code and jh.is_deleted = 0
+        where 1=1
+        and jh.id = #{houseId}
+    </select>
 </mapper>

--
Gitblit v1.9.3