From 8ffcd66acb57d4e34ced2906a0049e40affe8b1b Mon Sep 17 00:00:00 2001
From: lin <sbla5888@163.com>
Date: Wed, 20 Mar 2024 16:03:49 +0800
Subject: [PATCH] 重点人员管理接口调整

---
 src/main/java/org/springblade/modules/house/mapper/HouseholdMapper.xml |   35 ++++++++++++++++++++---------------
 1 files changed, 20 insertions(+), 15 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 1b11184..ac7de1b 100644
--- a/src/main/java/org/springblade/modules/house/mapper/HouseholdMapper.xml
+++ b/src/main/java/org/springblade/modules/house/mapper/HouseholdMapper.xml
@@ -199,16 +199,22 @@
         LEFT JOIN jczz_doorplate_address jda ON jda.address_code = jh.house_code
         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
-        LEFT JOIN jczz_user_house_label juhl ON juhl.household_id = jh.id
-        LEFT JOIN jczz_label jl ON juhl.label_id = jl.id
         <where>
             <if test="household.labelIdList !=null and household.labelIdList.size() >0 ">
+                EXISTS (
+                SELECT
+                *
+                FROM
+                jczz_user_house_label juhl
+                LEFT JOIN jczz_label jl ON juhl.label_id = jl.id
+                where  juhl.household_id = jh.id
                 and juhl.lable_type = 1
                 AND juhl.household_id IS NOT NULL
                 AND jl.id in
                 <foreach collection="household.labelIdList" item="code" open="(" close=")" separator=",">
                     #{code}
                 </foreach>
+                )
             </if>
             <if test="household.userId!=null">
                 AND jg.grid_code IN ( SELECT DISTINCT jgm.grid_code FROM jczz_gridman jgm WHERE jgm.user_id =
@@ -216,6 +222,9 @@
                 )
             </if>
 
+            <if test="household.searchKey!=null and household.searchKey!=''">
+                and CONCAT(jh.name,jh.phone_number) like CONCAT ('%', #{household.searchKey},'%')
+            </if>
 
             <if test="household.name!=null and household.name !=''">
                 and jh.name like concat('%',#{household.name},'%')
@@ -226,6 +235,15 @@
             <if test="household.houseCode!=null and household.houseCode !=''">
                 and jh.house_code = #{household.houseCode}
             </if>
+                <!-- 等于18 就是租户 -->
+            <if test="household.relationship!=null and household.relationship == 18">
+                and jh.relationship = #{household.relationship}
+            </if>
+            <!-- 不等于18 就是非租户 -->
+            <if test="household.relationship!=null and household.relationship != 18">
+                and jh.relationship != #{household.relationship}
+            </if>
+
             <if test="household.phoneNumber!=null and household.phoneNumber !=''">
                 and jh.phone_number like concat('%',#{household.phoneNumber},'%')
             </if>
@@ -304,19 +322,6 @@
                     </otherwise>
                 </choose>
             </if>
-<!--            <if test="isAdministrator==2">-->
-<!--                <choose>-->
-<!--                    <when test="regionChildCodesList !=null and regionChildCodesList.size()>0">-->
-<!--                        and jg.community_code in-->
-<!--                        <foreach collection="regionChildCodesList" item="code" open="(" close=")" separator=",">-->
-<!--                            #{code}-->
-<!--                        </foreach>-->
-<!--                    </when>-->
-<!--                    <otherwise>-->
-<!--                        and jg.community_code in ('')-->
-<!--                    </otherwise>-->
-<!--                </choose>-->
-<!--            </if>-->
             <if test="household.building!=null and household.building!=''">
                 and jhs.building like concat(#{household.building},'%')
             </if>

--
Gitblit v1.9.3