From 8b7258c9427882bb1798f1502eaa35184c6e374e Mon Sep 17 00:00:00 2001
From: linwe <872216996@qq.com>
Date: Fri, 09 Aug 2024 14:29:18 +0800
Subject: [PATCH] 短信指定楼栋发送

---
 src/main/java/org/springblade/modules/house/mapper/HouseholdMapper.xml |  128 +++++++++++++++++++++++++-----------------
 1 files changed, 76 insertions(+), 52 deletions(-)

diff --git a/src/main/java/org/springblade/modules/house/mapper/HouseholdMapper.xml b/src/main/java/org/springblade/modules/house/mapper/HouseholdMapper.xml
index 8ac4f6a..ee42f01 100644
--- a/src/main/java/org/springblade/modules/house/mapper/HouseholdMapper.xml
+++ b/src/main/java/org/springblade/modules/house/mapper/HouseholdMapper.xml
@@ -175,6 +175,8 @@
         jh.marital_status,
         jh.card_number,
         jh.other_contact,
+        jh.create_time,
+        jh.update_time,
         IF
         ( jda.id IS NOT NULL, jda.address_name, jh.current_address ) AS current_address,
         jh.disability_cert,
@@ -347,10 +349,8 @@
                 and jhs.district_code = #{household.aoiCode}
             </if>
             and jh.is_deleted = 0
-            order by jh.create_time desc
+            order by jh.id desc
         </where>
-
-
     </select>
 
     <select id="getAllHouseHold" resultMap="householdPageAndLabelMap">
@@ -524,6 +524,8 @@
                jh.confirm_flag,
                jh.housing_rental_id,
                jh.volunteer_org,
+               jh.create_time,
+               jh.update_time,
                if(jda.id is not null, substring(jda.town_street_code, 1, 9), jh.home_adcode) as home_adcode,
                br1.name                                                                      as residentAdName,
                br1.province_code                                                             as residentProvinceAdCode,
@@ -669,7 +671,7 @@
             </if>
             <!-- 不等于18 就是非租户 -->
             <if test="household.relationship!=null and household.relationship != 18">
-                and jh.relationship != #{household.relationship}
+                and jh.relationship != 18
             </if>
 
             <if test="household.phoneNumber!=null and household.phoneNumber !=''">
@@ -762,7 +764,7 @@
             and jh.is_deleted = 0
         </where>
         order by jh.create_time desc
-        limit 0,10000
+        limit 0,20000
     </select>
 
 
@@ -778,6 +780,11 @@
         <where>
             <if test="household.communityCode != null and household.communityCode != ''">
                 and jg.community_code = #{household.communityCode}
+            </if>
+            <if test="household.userId!=null">
+                AND jg.grid_code IN ( SELECT DISTINCT jgm.grid_code FROM jczz_gridman jgm WHERE jgm.user_id =
+                #{household.userId}
+                )
             </if>
             <if test="household.confirmFlag != null">
                 and jh.confirm_flag =  #{household.confirmFlag}
@@ -890,36 +897,43 @@
         FROM
         jczz_household jh
         LEFT JOIN jczz_doorplate_address jda ON jh.house_code = jda.address_code
-        WHERE
-        jda.nei_code = #{code}
-        AND jh.is_deleted = 0
-        and jda.doorplate_type = '户室牌'
-        <if test="userId != null and roleType == '1'">
-            AND jda.address_code IN (
-            SELECT DISTINCT
-            jgr.house_code
-            FROM
-            jczz_grid jg
-            LEFT JOIN jczz_gridman jgm ON jg.id = jgm.grid_id
-            LEFT JOIN jczz_grid_range jgr ON jgr.grid_id = jg.id
-            WHERE
-            jgm.user_id = #{userId}
-            AND jg.is_deleted = 0
-            )
-        </if>
-        <if test="userId != null and roleType == '3'">
-            AND jda.address_code IN (SELECT
-            jda.address_code
-            FROM
-            jczz_doorplate_address jda
-            LEFT JOIN jczz_community jc ON jc.CODE = jda.nei_code
-            WHERE
-            jc.res_police_user_id like concat('%',#{userId},'%'))
-            )
-        </if>
-        ) a
-        GROUP BY
-        a.gender
+        <where>
+            <if test="communityCodeList != null and communityCodeList.size()>0">
+                jda.nei_code in
+                <foreach collection="communityCodeList" item="code" open="(" close=")" separator=",">
+                    #{code}
+                </foreach>
+            </if>
+            AND jh.is_deleted = 0
+            and jda.doorplate_type = '户室牌'
+            <if test="userId != null and roleType == '1'">
+                AND jda.address_code IN (
+                SELECT DISTINCT
+                jgr.house_code
+                FROM
+                jczz_grid jg
+                LEFT JOIN jczz_gridman jgm ON jg.id = jgm.grid_id
+                LEFT JOIN jczz_grid_range jgr ON jgr.grid_id = jg.id
+                WHERE
+                jgm.user_id = #{userId}
+                AND jg.is_deleted = 0
+                )
+            </if>
+            <if test="userId != null and roleType == '3'">
+                AND jda.address_code IN (SELECT
+                jda.address_code
+                FROM
+                jczz_doorplate_address jda
+                LEFT JOIN jczz_community jc ON jc.CODE = jda.nei_code
+                WHERE
+                jc.res_police_user_id like concat('%',#{userId},'%'))
+                )
+            </if>
+            ) a
+            GROUP BY
+            a.gender
+        </where>
+
     </select>
     <select id="getHouseHoldStatisticsAge" resultType="java.util.Map">
 
@@ -941,23 +955,30 @@
         count(1) as number FROM
         jczz_household jh
         LEFT JOIN jczz_doorplate_address jda ON jh.house_code = jda.address_code
-        WHERE
-        jda.nei_code = #{code}
-        and jda.doorplate_type = '户室牌'
-        AND jh.is_deleted = 0
-        <if test="userId != null and roleType == '1'">
-            AND jda.address_code IN (
-            SELECT
-            distinct jgr.house_code
-            FROM
-            jczz_grid jg
-            LEFT JOIN jczz_gridman jgm ON jg.id = jgm.grid_id
-            LEFT JOIN jczz_grid_range jgr ON jgr.grid_id = jg.id
-            WHERE
-            jgm.user_id = #{userId}
-            AND jg.is_deleted = 0
-            )
-        </if>
+        <where>
+            <if test="communityCodeList != null and communityCodeList.size()>0">
+                jda.nei_code in
+                <foreach collection="communityCodeList" item="code" open="(" close=")" separator=",">
+                    #{code}
+                </foreach>
+            </if>
+            and jda.doorplate_type = '户室牌'
+            AND jh.is_deleted = 0
+            <if test="userId != null and roleType == '1'">
+                AND jda.address_code IN (
+                SELECT
+                distinct jgr.house_code
+                FROM
+                jczz_grid jg
+                LEFT JOIN jczz_gridman jgm ON jg.id = jgm.grid_id
+                LEFT JOIN jczz_grid_range jgr ON jgr.grid_id = jg.id
+                WHERE
+                jgm.user_id = #{userId}
+                AND jg.is_deleted = 0
+                )
+            </if>
+        </where>
+
         GROUP BY age
     </select>
 
@@ -1050,6 +1071,9 @@
             <if test="household.confirmFlag != null ">
                 and jh.confirm_flag = #{household.confirmFlag}
             </if>
+            <if test="household.relationship != null ">
+                and jh.relationship = #{household.relationship}
+            </if>
             <if test="household.townStreetName!=null and household.townStreetName!=''">
                 and jda.town_street_name like concat('%',#{household.townStreetName},'%')
             </if>

--
Gitblit v1.9.3