From ebd41b7b2e44dc8b96f177d7bf88d2f5f997b75c Mon Sep 17 00:00:00 2001
From: zhongrj <646384940@qq.com>
Date: Sun, 28 Apr 2024 14:30:07 +0800
Subject: [PATCH] 民警导入修改

---
 src/main/java/org/springblade/modules/house/mapper/HouseMapper.xml |   88 +++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 87 insertions(+), 1 deletions(-)

diff --git a/src/main/java/org/springblade/modules/house/mapper/HouseMapper.xml b/src/main/java/org/springblade/modules/house/mapper/HouseMapper.xml
index 36d88cf..b477a44 100644
--- a/src/main/java/org/springblade/modules/house/mapper/HouseMapper.xml
+++ b/src/main/java/org/springblade/modules/house/mapper/HouseMapper.xml
@@ -803,7 +803,6 @@
         <if test="type == 2">
             and jw_grid_code is null
         </if>
-        and create_time > '2024-03-20 11:00:00'
     </select>
 
     <!--按房屋标签统计-->
@@ -891,5 +890,92 @@
         ) b on a.label_name =b.labelName
     </select>
 
+    <!--查询对应的社区编号-->
+    <select id="getCommunityCode" resultType="java.lang.String">
+        SELECT
+        jpag.community_code
+        FROM
+        jczz_house jh
+        LEFT JOIN jczz_police_affairs_grid jpag on jh.jw_grid_code= jpag.jw_grid_code and jpag.is_deleted = 0
+        where jh.is_deleted = 0
+        and jh.id = #{id}
+    </select>
+
+    <!--查询所有房屋总数-->
+    <select id="getAllListTotal" resultType="java.lang.Integer">
+        SELECT
+        count(*)
+        FROM
+        jczz_house jh
+        where jh.is_deleted = 0
+    </select>
+
+    <!--查询所有的房屋-->
+    <select id="getAllList" resultType="org.springblade.modules.house.vo.HouseVO">
+        SELECT
+        jh.*,
+        jpag.community_code
+        FROM
+        jczz_house jh
+        LEFT JOIN jczz_police_affairs_grid jpag on jh.jw_grid_code= jpag.jw_grid_code and jpag.is_deleted = 0
+        where jh.is_deleted = 0
+        limit #{i},#{size}
+    </select>
+
+    <!--查询无房屋状态的房屋数量-->
+    <select id="getNotBindLabelHouseNum" resultType="java.lang.Integer">
+        select count(*) from (
+            SELECT
+            jh.house_code,
+            case when c.house_code is not null then 1
+            when a.house_code is not null and b.house_code is null then 2
+            when b.house_code is not null then 3
+            end as status
+            FROM
+            jczz_house jh
+            left join
+            (
+            select house_code from jczz_household where is_deleted = 0 and relationship = 1 and house_code is not null and house_code != '' GROUP BY house_code
+            ) a on a.house_code = jh.house_code
+            left join
+            (
+            select house_code from jczz_household where is_deleted = 0 and relationship = 18 and house_code is not null and house_code != '' GROUP BY house_code
+            ) b on b.house_code = jh.house_code
+            left join
+            (
+            select house_code from jczz_household where is_deleted = 0 and relationship is null or (relationship!=1 and relationship!=18) and house_code is not null and house_code != '' GROUP BY house_code
+            ) c on c.house_code = jh.house_code
+        ) d left join jczz_user_house_label juhl on d.house_code = juhl.house_code and lable_type = 2
+        where juhl.id is null and status is not null
+    </select>
+
+    <!--查询无房屋状态的房屋列表集合-->
+    <select id="getNotBindLabelHouseList" resultType="org.springblade.modules.house.vo.HouseVO">
+        select d.* from (
+            SELECT
+            jh.house_code,
+            case when c.house_code is not null then 1
+            when a.house_code is not null and b.house_code is null then 2
+            when b.house_code is not null then 3
+            end as status
+            FROM
+            jczz_house jh
+            left join
+            (
+            select house_code from jczz_household where is_deleted = 0 and relationship = 1 and house_code is not null and house_code != '' GROUP BY house_code
+            ) a on a.house_code = jh.house_code
+            left join
+            (
+            select house_code from jczz_household where is_deleted = 0 and relationship = 18 and house_code is not null and house_code != '' GROUP BY house_code
+            ) b on b.house_code = jh.house_code
+            left join
+            (
+            select house_code from jczz_household where is_deleted = 0 and relationship is null or (relationship!=1 and relationship!=18) and house_code is not null and house_code != '' GROUP BY house_code
+            ) c on c.house_code = jh.house_code
+        ) d left join jczz_user_house_label juhl on d.house_code = juhl.house_code and lable_type = 2
+        where juhl.id is null and status is not null
+        limit #{i},#{size}
+    </select>
+
 
 </mapper>

--
Gitblit v1.9.3