From 9f8f9d13c42ca8cdccbf351069082a5fdccef2e4 Mon Sep 17 00:00:00 2001
From: lin <sbla5888@163.com>
Date: Mon, 25 Mar 2024 17:30:51 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 src/main/java/org/springblade/modules/house/mapper/HouseholdMapper.xml |   13 ++++++++++---
 1 files changed, 10 insertions(+), 3 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 4223c16..2b2f3c3 100644
--- a/src/main/java/org/springblade/modules/house/mapper/HouseholdMapper.xml
+++ b/src/main/java/org/springblade/modules/house/mapper/HouseholdMapper.xml
@@ -192,6 +192,10 @@
         jhs.building,
         jhs.district_code aoiCode,
         jh.volunteer_org,
+        case
+        when TIMESTAMPDIFF(year, substring(jh.id_card, 7, 8), now()) &lt; 18 then 2
+        when TIMESTAMPDIFF(year, substring(jh.id_card, 7, 8), now()) &gt;= 18 then 1
+        end as minors,
         jhs.unit
         FROM
         jczz_household jh
@@ -245,6 +249,9 @@
 
                 <if test="household.minors!=null and household.minors ==2">
                     and TIMESTAMPDIFF(year, substring(jh.id_card, 7, 8), now()) &lt; 18
+                </if>
+                <if test="household.minors!=null and household.minors ==1">
+                    and TIMESTAMPDIFF(year, substring(jh.id_card, 7, 8), now()) &gt;= 18
                 </if>
             </if>
             <!-- 不等于18 就是非租户 -->
@@ -588,10 +595,10 @@
         LEFT JOIN jczz_grid jg on jg.grid_code = jhs.grid_code and jg.is_deleted = 0
         LEFT JOIN jczz_police_affairs_grid jpag on jhs.jw_grid_code= jpag.jw_grid_code and jpag.is_deleted = 0
         <where>
-            <if test="household.neiCode != null and household.neiCode != ''">
-                and jda.nei_code = #{household.neiCode}
+            <if test="household.communityCode != null and household.communityCode != ''">
+                and jg.community_code = #{household.communityCode}
             </if>
-            <if test="household.confirmFlag != null and household.confirmFlag != ''">
+            <if test="household.confirmFlag != null">
                 and jh.confirm_flag =  #{household.confirmFlag}
             </if>
             <if test="isAdministrator==2">

--
Gitblit v1.9.3