From 87c81cb045fb89a74901613405e6c4ccf4bd03bd Mon Sep 17 00:00:00 2001
From: linwei <872216696@qq.com>
Date: Fri, 12 Jan 2024 11:43:45 +0800
Subject: [PATCH] 住户+居民管理

---
 src/main/java/org/springblade/modules/house/mapper/HouseholdMapper.xml |   24 +++++++++++++++---------
 1 files changed, 15 insertions(+), 9 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 00a1ac9..8174be5 100644
--- a/src/main/java/org/springblade/modules/house/mapper/HouseholdMapper.xml
+++ b/src/main/java/org/springblade/modules/house/mapper/HouseholdMapper.xml
@@ -828,17 +828,20 @@
             <if test="household.aoiCode!=null and household.aoiCode!=''">
                 and jhs.district_code = #{household.aoiCode}
             </if>
-            AND EXISTS (
-            SELECT
-            *
+            and jh.id in (
+            SELECT DISTINCT
+            juhl.household_id
             FROM
             jczz_user_house_label juhl
             LEFT JOIN jczz_label jl ON juhl.label_id = jl.id
             WHERE
             juhl.lable_type = 1
-            AND jl.id = #{household.labelId}
-            AND jl.parent_id = #{household.parentId}
-            AND juhl.household_id = jh.id
+            <if test="household.labelId != null ">
+                AND jl.id = #{household.labelId}
+            </if>
+            <if test="household.parentId != null ">
+                AND jl.parent_id = #{household.parentId}
+            </if>
             AND juhl.label_id IS NOT NULL
             )
             and jh.is_deleted = 0
@@ -854,7 +857,8 @@
         and juhl.lable_type = 1
         and juhl.color = '#30D17C'
         and jh.id in (
-        select household_id from jczz_grid_work_log where is_deleted = 0 and source = 2 and TIMESTAMPDIFF( day, now(), create_time )=30
+        select household_id from jczz_grid_work_log where is_deleted = 0 and source = 2 and TIMESTAMPDIFF( day, now(),
+        create_time )=30
         )
         <choose>
             <when test="list!=null and list.size()>0">
@@ -875,7 +879,8 @@
         and juhl.lable_type = 1
         and juhl.color = '#FFB42B'
         and jh.id in (
-        select household_id from jczz_grid_work_log where is_deleted = 0 and source = 2 and TIMESTAMPDIFF( day, now(), create_time )=14
+        select household_id from jczz_grid_work_log where is_deleted = 0 and source = 2 and TIMESTAMPDIFF( day, now(),
+        create_time )=14
         )
         <choose>
             <when test="list!=null and list.size()>0">
@@ -897,7 +902,8 @@
         and juhl.lable_type = 1
         and juhl.color = '#EA1F1F'
         and jh.id in (
-        select household_id from jczz_grid_work_log where is_deleted = 0 and source = 2 and TIMESTAMPDIFF( day, now(), create_time )=7
+        select household_id from jczz_grid_work_log where is_deleted = 0 and source = 2 and TIMESTAMPDIFF( day, now(),
+        create_time )=7
         )
         <choose>
             <when test="list!=null and list.size()>0">

--
Gitblit v1.9.3