From b3b566ebdfed4005aaa513da3d5d2fd3924903cc Mon Sep 17 00:00:00 2001
From: linwei <872216696@qq.com>
Date: Wed, 31 Jan 2024 16:17:54 +0800
Subject: [PATCH] 拿不到地址总表数据,不设置网格信息

---
 src/main/java/org/springblade/modules/grid/mapper/GridWorkLogMapper.xml |   30 ++++++++++++++++++++----------
 1 files changed, 20 insertions(+), 10 deletions(-)

diff --git a/src/main/java/org/springblade/modules/grid/mapper/GridWorkLogMapper.xml b/src/main/java/org/springblade/modules/grid/mapper/GridWorkLogMapper.xml
index be9278d..bf70153 100644
--- a/src/main/java/org/springblade/modules/grid/mapper/GridWorkLogMapper.xml
+++ b/src/main/java/org/springblade/modules/grid/mapper/GridWorkLogMapper.xml
@@ -14,9 +14,9 @@
         bu.real_name as createUserName
         from jczz_grid_work_log jgwl
         left join jczz_household jh on jgwl.household_id = jh.id and jh.is_deleted = 0
+        left join jczz_house jhs on jhs.house_code = jh.house_code and jhs.is_deleted = 0
         LEFT JOIN jczz_doorplate_address jda ON jda.address_code = jh.house_code
-        LEFT JOIN jczz_grid_range jgr on jgr.house_code=jda.address_code
-        LEFT JOIN jczz_grid jg on jg.id = jgr.grid_id and jg.is_deleted = 0
+        LEFT JOIN jczz_grid jg on jhs.grid_code = jg.grid_code and jg.is_deleted = 0
         LEFT JOIN blade_user bu on bu.id = jgwl.create_user and bu.is_deleted = 0
         where jgwl.is_deleted = 0
         <if test="gridWorkLog.type !=null">
@@ -30,9 +30,6 @@
         </if>
         <if test="gridWorkLog.personType !=null">
             and jgwl.person_type = #{gridWorkLog.personType}
-        </if>
-        <if test="gridWorkLog.gridId !=null">
-            and jgr.grid_id = #{gridWorkLog.gridId}
         </if>
         <if test="gridWorkLog.name !=null and gridWorkLog.name!=''">
             and jh.name like concat('%',#{gridWorkLog.name},'%')
@@ -49,8 +46,21 @@
         <if test="gridWorkLog.neiName!=null and gridWorkLog.neiName!=''">
             and jda.nei_name like concat('%',#{gridWorkLog.neiName},'%')
         </if>
-        <if test="gridWorkLog.regionCode!=null and gridWorkLog.regionCode!=''">
-            and jg.community_code like concat('%',#{gridWorkLog.regionCode},'%')
+        <if test="gridWorkLog.gridId !=null">
+            and jg.id = #{gridWorkLog.gridId}
+        </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>
     </select>
 
@@ -58,13 +68,13 @@
     <select id="getGridWorkCountHandleCount" resultType="java.lang.Integer">
         select count(*) from jczz_grid_work_log jgwl
         left join jczz_household jh on jgwl.household_id = jh.id and jh.is_deleted = 0
-        left join jczz_grid_range jgr on jgr.house_code=jh.house_code
+        left join jczz_house jhs on jhs.house_code=jh.house_code and jhs.is_deleted = 0
         where jgwl.is_deleted = 0
         <if test="status!=null">
             and jgwl.status = #{status}
         </if>
-        <if test="gridId!=null">
-            and jgr.grid_id = #{gridId}
+        <if test="gridCode!=null and gridCode!=''">
+            and jhs.grid_code = #{gridCode}
         </if>
     </select>
 

--
Gitblit v1.9.3