From 764d883b5ea3bdc06abbec548b6df0511e567978 Mon Sep 17 00:00:00 2001
From: linwe <872216996@qq.com>
Date: Tue, 03 Sep 2024 09:46:05 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/binlog' into binlog

---
 src/main/java/org/springblade/modules/task/mapper/TaskResidencePermitApplyMapper.xml |   54 ++++++++++++++++++++++++++++++++++++++++++++++++------
 1 files changed, 48 insertions(+), 6 deletions(-)

diff --git a/src/main/java/org/springblade/modules/task/mapper/TaskResidencePermitApplyMapper.xml b/src/main/java/org/springblade/modules/task/mapper/TaskResidencePermitApplyMapper.xml
index 61f54d3..5a71a03 100644
--- a/src/main/java/org/springblade/modules/task/mapper/TaskResidencePermitApplyMapper.xml
+++ b/src/main/java/org/springblade/modules/task/mapper/TaskResidencePermitApplyMapper.xml
@@ -33,6 +33,8 @@
             <if test="residen.minors!=null and residen.minors ==1">
                 and TIMESTAMPDIFF(year, substring(jtrpa.id_card, 7, 8), now()) &gt;= 18
             </if>
+            <if test="residen.communityCode != null  and residen.communityCode != ''"> and jg.community_code = #{residen.communityCode}</if>
+
             <if test="residen.id != null ">and jtrpa.id = #{residen.id}</if>
             <if test="residen.name != null  and residen.name != ''">and jtrpa.name like CONCAT('%',#{residen.name},'%')</if>
             <if test="residen.phone != null  and residen.phone != ''">and jtrpa.phone like CONCAT('%',#{residen.phone},'%')</if>
@@ -40,7 +42,10 @@
             <if test="residen.address != null  and residen.address != ''">and jtrpa.address like CONCAT('%',#{residen.address},'%')</if>
             <if test="residen.houseCode != null  and residen.houseCode != ''">and jtrpa.house_code = #{residen.houseCode}</if>
             <if test="residen.taskId != null ">and jtrpa.task_id = #{residen.taskId}</if>
-            <if test="residen.createTime != null ">and jtrpa.create_time = #{residen.createTime}</if>
+
+            <if test="residen.startTime != null and residen.startTime != '' and residen.endTime != null and residen.endTime != '' ">
+                AND jtrpa.create_time BETWEEN #{residen.startTime} and #{residen.endTime}
+            </if>
             <if test="residen.updateTime != null ">and jtrpa.update_time = #{residen.updateTime}</if>
             <if test="residen.createUser != null ">and jtrpa.create_user = #{residen.createUser}</if>
             <if test="residen.houseRentalId != null ">and jtrpa.house_rental_id = #{residen.houseRentalId}</if>
@@ -90,17 +95,54 @@
 
                 </if>
             </if>
-            order by jtrpa.create_time desc
         </where>
+        order by jtrpa.create_time desc
     </select>
 
 
     <select id="getCount" resultType="java.lang.Integer">
         SELECT count(1)
-        FROM jczz_task_residence_permit_apply jtrpa
-        WHERE jtrpa.jw_grid_code IN
-              (SELECT jpag.jw_grid_code FROM jczz_police_affairs_grid jpag WHERE jpag.police_user_id like concat('%',${userId},'%') )
-          AND jtrpa.`confirm_flag` = 1
+        from jczz_task_residence_permit_apply jtrpa
+        left join jczz_doorplate_address jda on jda.address_code = jtrpa.house_code
+        LEFT JOIN jczz_house jh on jh.house_code=jtrpa.house_code
+        left join jczz_grid jg on jg.grid_code = jh.grid_code and jg.is_deleted = 0
+        left join blade_region br on br.code = jg.community_code
+        <where>
+            and jtrpa.is_deleted = 0
+            <if test="neiCode != null  and neiCode != ''"> and jg.community_code = #{neiCode}</if>
+            <if test="status != null  and status != ''"> and jtrpa.confirm_flag = #{status}</if>
+
+           <if test="isAdministrator==2">
+<!--                <if test="residen.roleType ==null ">-->
+                    <choose>
+                        <when test="regionChildCodesList !=null and regionChildCodesList.size()>0">
+                            and (
+                            jg.grid_code in
+                            <foreach collection="regionChildCodesList" item="code" open="(" close=")" separator=",">
+                                #{code}
+                            </foreach>
+                            or
+                            jtrpa.jw_grid_code in
+                            <foreach collection="regionChildCodesList" item="code" open="(" close=")" separator=",">
+                                #{code}
+                            </foreach>
+                            )
+                        </when>
+                    </choose>
+
+                    <choose>
+                        <when test="gridCodeList !=null and gridCodeList.size()>0">
+                            and (
+                            jg.grid_code in
+                            <foreach collection="gridCodeList" item="code" open="(" close=")" separator=",">
+                                #{code}
+                            </foreach>
+                            )
+                        </when>
+                    </choose>
+<!--                </if>-->
+            </if>
+        </where>
 
     </select>
 

--
Gitblit v1.9.3