From aae9bc1ebc7f65cebaec65ac7128f79ca6c827d1 Mon Sep 17 00:00:00 2001
From: linwei <872216696@qq.com>
Date: Wed, 07 Feb 2024 10:24:39 +0800
Subject: [PATCH] 代码优化

---
 src/main/java/org/springblade/modules/taskPlaceRectification/mapper/TaskPlaceRectificationMapper.xml |  114 +++++++++++++++++++++++++++++++++------------------------
 1 files changed, 66 insertions(+), 48 deletions(-)

diff --git a/src/main/java/org/springblade/modules/taskPlaceRectification/mapper/TaskPlaceRectificationMapper.xml b/src/main/java/org/springblade/modules/taskPlaceRectification/mapper/TaskPlaceRectificationMapper.xml
index 1cdcf2e..8a8a47c 100644
--- a/src/main/java/org/springblade/modules/taskPlaceRectification/mapper/TaskPlaceRectificationMapper.xml
+++ b/src/main/java/org/springblade/modules/taskPlaceRectification/mapper/TaskPlaceRectificationMapper.xml
@@ -209,11 +209,11 @@
         LEFT JOIN jczz_doorplate_address jda on jda.address_code=jtpr.house_code
         LEFT JOIN jczz_police_affairs_grid jpag on jp.jw_grid_code= jpag.jw_grid_code
         <where>
-            <if test="taskPalce.id != null ">and id = #{taskPalce.id}</if>
-            <if test="taskPalce.placeCheckId != null ">and place_check_id = #{taskPalce.placeCheckId}</if>
-            <if test="taskPalce.taskId != null ">and task_id = #{taskPalce.taskId}</if>
-            <if test="taskPalce.status != null ">and status = #{taskPalce.status}</if>
-            <if test="taskPalce.taskName != null  and taskPalce.taskName != ''">and task_name = #{taskPalce.taskName}
+            <if test="taskPalce.id != null ">and jtpr.id = #{taskPalce.id}</if>
+            <if test="taskPalce.placeCheckId != null ">and jtpr.place_check_id = #{taskPalce.placeCheckId}</if>
+            <if test="taskPalce.taskId != null ">and jtpr.task_id = #{taskPalce.taskId}</if>
+            <if test="taskPalce.status != null ">and jtpr.status = #{taskPalce.status}</if>
+            <if test="taskPalce.taskName != null  and taskPalce.taskName != ''">and jtpr.task_name = #{taskPalce.taskName}
             </if>
 
             <if test="taskPalce.startTime!=null and taskPalce.startTime!=''">
@@ -232,7 +232,7 @@
             </if>
 
             <if test="taskPalce.deptName!=null and taskPalce.deptName!=''">
-                and bd.dept_name like concat('%',#{taskPalce.deptName},'%')
+                and jpag.pcs_name like concat('%',#{taskPalce.deptName},'%')
             </if>
 
             <if test="taskPalce.nineType!=null">
@@ -243,34 +243,34 @@
                 and jp.punish_flag = #{taskPalce.punishFlag}
             </if>
 
-            <if test="taskPalce.remark != null  and taskPalce.remark != ''">and remark = #{taskPalce.remark}</if>
-            <if test="taskPalce.updateTime != null ">and update_time = #{taskPalce.updateTime}</if>
-            <if test="taskPalce.createTime != null ">and create_time = #{taskPalce.createTime}</if>
-            <if test="taskPalce.houseCode != null  and taskPalce.houseCode != ''">and house_code =
+            <if test="taskPalce.remark != null  and taskPalce.remark != ''">and jtpr.remark = #{taskPalce.remark}</if>
+            <if test="taskPalce.updateTime != null ">and jtpr.update_time = #{taskPalce.updateTime}</if>
+            <if test="taskPalce.createTime != null ">and jtpr.create_time = #{taskPalce.createTime}</if>
+            <if test="taskPalce.houseCode != null  and taskPalce.houseCode != ''">and jtpr.house_code =
                 #{taskPalce.houseCode}
             </if>
-            <if test="taskPalce.rectificationNoticeFlag != null ">and rectification_notice_flag =
+            <if test="taskPalce.rectificationNoticeFlag != null ">and jtpr.rectification_notice_flag =
                 #{taskPalce.rectificationNoticeFlag}
             </if>
-            <if test="taskPalce.rectificationEndTime != null ">and rectification_end_time =
+            <if test="taskPalce.rectificationEndTime != null ">and jtpr.rectification_end_time =
                 #{taskPalce.rectificationEndTime}
             </if>
-            <if test="taskPalce.rectificationCompleteTime != null ">and rectification_complete_time =
+            <if test="taskPalce.rectificationCompleteTime != null ">and jtpr.rectification_complete_time =
                 #{taskPalce.rectificationCompleteTime}
             </if>
-            <if test="taskPalce.rectificationFlag != null ">and rectification_flag = #{taskPalce.rectificationFlag}</if>
-            <if test="taskPalce.punishFlag != null ">and punish_flag = #{taskPalce.punishFlag}</if>
-            <if test="taskPalce.policeStation != null  and taskPalce.policeStation != ''">and police_station =
+            <if test="taskPalce.rectificationFlag != null ">and jtpr.rectification_flag = #{taskPalce.rectificationFlag}</if>
+            <if test="taskPalce.punishFlag != null ">and jtpr.punish_flag = #{taskPalce.punishFlag}</if>
+            <if test="taskPalce.policeStation != null  and taskPalce.policeStation != ''">and jtpr.police_station =
                 #{taskPalce.policeStation}
             </if>
             <if test="taskPalce.rectificationNoticeImgUrl != null  and taskPalce.rectificationNoticeImgUrl != ''">and
-                rectification_notice_img_url = #{taskPalce.rectificationNoticeImgUrl}
+                jtpr.rectification_notice_img_url = #{taskPalce.rectificationNoticeImgUrl}
             </if>
-            <if test="taskPalce.signaturePath != null  and taskPalce.signaturePath != ''">and signature_path =
+            <if test="taskPalce.signaturePath != null  and taskPalce.signaturePath != ''">and jtpr.signature_path =
                 #{taskPalce.signaturePath}
             </if>
-            <if test="taskPalce.createUser != null ">and create_user = #{taskPalce.createUser}</if>
-            <if test="taskPalce.imageUrls != null  and taskPalce.imageUrls != ''">and image_urls =
+            <if test="taskPalce.createUser != null ">and jtpr.create_user = #{taskPalce.createUser}</if>
+            <if test="taskPalce.imageUrls != null  and taskPalce.imageUrls != ''">and jtpr.image_urls =
                 #{taskPalce.imageUrls}
             </if>
             <if test="isAdministrator==2">
@@ -283,7 +283,7 @@
                             #{code}
                         </foreach>
                         or
-                        jpag.community_code in
+                        br.village_code in
                         <foreach collection="regionChildCodesList" item="code" open="(" close=")" separator=",">
                             #{code}
                         </foreach>
@@ -292,7 +292,7 @@
                     <otherwise>
                         and
                         (
-                        jg.grid_code in ('') or jpag.community_code in ('')
+                        jg.grid_code in ('') or br.village_code in ('')
                         )
                     </otherwise>
                 </choose>
@@ -397,7 +397,6 @@
 
     <select id="export"
             resultMap="TaskPlaceRectificationExcelResult">
-
         SELECT
         jtpr.id,
         jtpr.place_check_id,
@@ -440,13 +439,20 @@
         LEFT JOIN jczz_place_ext jpe ON jpe.place_id = jp.id
         LEFT JOIN blade_user bu ON bu.id = jtpr.create_user
         LEFT JOIN jczz_doorplate_address jda on jda.address_code=jtpr.house_code
-        LEFT JOIN jczz_police_affairs_grid jpag on jpag.community_code= jg.community_code
+        LEFT JOIN jczz_police_affairs_grid jpag on jp.jw_grid_code= jpag.jw_grid_code
         <where>
-            <if test="taskPalce.id != null ">and id = #{taskPalce.id}</if>
-            <if test="taskPalce.placeCheckId != null ">and place_check_id = #{taskPalce.placeCheckId}</if>
-            <if test="taskPalce.taskId != null ">and task_id = #{taskPalce.taskId}</if>
-            <if test="taskPalce.status != null ">and status = #{taskPalce.status}</if>
-            <if test="taskPalce.taskName != null  and taskPalce.taskName != ''">and task_name = #{taskPalce.taskName}
+            <if test="taskPalce.id != null ">and jtpr.id = #{taskPalce.id}</if>
+            <if test="taskPalce.placeCheckId != null ">and jtpr.place_check_id = #{taskPalce.placeCheckId}</if>
+            <if test="taskPalce.taskId != null ">and jtpr.task_id = #{taskPalce.taskId}</if>
+            <if test="taskPalce.status != null ">and jtpr.status = #{taskPalce.status}</if>
+            <if test="taskPalce.taskName != null  and taskPalce.taskName != ''">and jtpr.task_name = #{taskPalce.taskName}
+            </if>
+
+            <if test="taskPalce.startTime!=null and taskPalce.startTime!=''">
+                and jtpr.create_time&gt;=#{taskPalce.startTime}
+            </if>
+            <if test="taskPalce.endTime!=null and taskPalce.endTime!=''">
+                and jtpr.create_time&lt;=#{taskPalce.endTime}
             </if>
 
             <if test="taskPalce.placeName!=null and taskPalce.placeName!=''">
@@ -458,7 +464,7 @@
             </if>
 
             <if test="taskPalce.deptName!=null and taskPalce.deptName!=''">
-                and bd.dept_name like concat('%',#{taskPalce.deptName},'%')
+                and jpag.pcs_name like concat('%',#{taskPalce.deptName},'%')
             </if>
 
             <if test="taskPalce.nineType!=null">
@@ -469,50 +475,62 @@
                 and jp.punish_flag = #{taskPalce.punishFlag}
             </if>
 
-            <if test="taskPalce.remark != null  and taskPalce.remark != ''">and remark = #{taskPalce.remark}</if>
-            <if test="taskPalce.updateTime != null ">and update_time = #{taskPalce.updateTime}</if>
-            <if test="taskPalce.createTime != null ">and create_time = #{taskPalce.createTime}</if>
-            <if test="taskPalce.houseCode != null  and taskPalce.houseCode != ''">and house_code =
+            <if test="taskPalce.remark != null  and taskPalce.remark != ''">and jtpr.remark = #{taskPalce.remark}</if>
+            <if test="taskPalce.updateTime != null ">and jtpr.update_time = #{taskPalce.updateTime}</if>
+            <if test="taskPalce.createTime != null ">and jtpr.create_time = #{taskPalce.createTime}</if>
+            <if test="taskPalce.houseCode != null  and taskPalce.houseCode != ''">and jtpr.house_code =
                 #{taskPalce.houseCode}
             </if>
-            <if test="taskPalce.rectificationNoticeFlag != null ">and rectification_notice_flag =
+            <if test="taskPalce.rectificationNoticeFlag != null ">and jtpr.rectification_notice_flag =
                 #{taskPalce.rectificationNoticeFlag}
             </if>
-            <if test="taskPalce.rectificationEndTime != null ">and rectification_end_time =
+            <if test="taskPalce.rectificationEndTime != null ">and jtpr.rectification_end_time =
                 #{taskPalce.rectificationEndTime}
             </if>
-            <if test="taskPalce.rectificationCompleteTime != null ">and rectification_complete_time =
+            <if test="taskPalce.rectificationCompleteTime != null ">and jtpr.rectification_complete_time =
                 #{taskPalce.rectificationCompleteTime}
             </if>
-            <if test="taskPalce.rectificationFlag != null ">and rectification_flag = #{taskPalce.rectificationFlag}</if>
-            <if test="taskPalce.punishFlag != null ">and punish_flag = #{taskPalce.punishFlag}</if>
-            <if test="taskPalce.policeStation != null  and taskPalce.policeStation != ''">and police_station =
+            <if test="taskPalce.rectificationFlag != null ">and jtpr.rectification_flag = #{taskPalce.rectificationFlag}</if>
+            <if test="taskPalce.punishFlag != null ">and jtpr.punish_flag = #{taskPalce.punishFlag}</if>
+            <if test="taskPalce.policeStation != null  and taskPalce.policeStation != ''">and jtpr.police_station =
                 #{taskPalce.policeStation}
             </if>
             <if test="taskPalce.rectificationNoticeImgUrl != null  and taskPalce.rectificationNoticeImgUrl != ''">and
-                rectification_notice_img_url = #{taskPalce.rectificationNoticeImgUrl}
+                jtpr.rectification_notice_img_url = #{taskPalce.rectificationNoticeImgUrl}
             </if>
-            <if test="taskPalce.signaturePath != null  and taskPalce.signaturePath != ''">and signature_path =
+            <if test="taskPalce.signaturePath != null  and taskPalce.signaturePath != ''">and jtpr.signature_path =
                 #{taskPalce.signaturePath}
             </if>
-            <if test="taskPalce.createUser != null ">and create_user = #{taskPalce.createUser}</if>
-            <if test="taskPalce.imageUrls != null  and taskPalce.imageUrls != ''">and image_urls =
+            <if test="taskPalce.createUser != null ">and jtpr.create_user = #{taskPalce.createUser}</if>
+            <if test="taskPalce.imageUrls != null  and taskPalce.imageUrls != ''">and jtpr.image_urls =
                 #{taskPalce.imageUrls}
             </if>
             <if test="isAdministrator==2">
                 <choose>
                     <when test="regionChildCodesList !=null and regionChildCodesList.size()>0">
-                        and jg.grid_code in
+                        and
+                        (
+                        jg.grid_code in
                         <foreach collection="regionChildCodesList" item="code" open="(" close=")" separator=",">
                             #{code}
                         </foreach>
+                        or
+                        br.village_code in
+                        <foreach collection="regionChildCodesList" item="code" open="(" close=")" separator=",">
+                            #{code}
+                        </foreach>
+                        )
                     </when>
+                    <otherwise>
+                        and
+                        (
+                        jg.grid_code in ('') or br.village_code in ('')
+                        )
+                    </otherwise>
                 </choose>
             </if>
-
         </where>
-
-
+        order by jtpr.create_time desc
     </select>
 
 

--
Gitblit v1.9.3