From b7df6735bcb2d447cae7fcfba2d12accf3dd2fcc Mon Sep 17 00:00:00 2001
From: linwei <872216696@qq.com>
Date: Sat, 03 Feb 2024 17:27:21 +0800
Subject: [PATCH] 消防检查优化

---
 src/main/java/org/springblade/modules/taskPlaceRectification/mapper/TaskPlaceRectificationMapper.xml |   34 ++++++++++++++++------------------
 1 files changed, 16 insertions(+), 18 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 045adea..633b081 100644
--- a/src/main/java/org/springblade/modules/taskPlaceRectification/mapper/TaskPlaceRectificationMapper.xml
+++ b/src/main/java/org/springblade/modules/taskPlaceRectification/mapper/TaskPlaceRectificationMapper.xml
@@ -165,7 +165,7 @@
         jtpr.signature_path,
         jtpr.create_user,
         jtpr.image_urls,
-        bd.dept_name,
+        jpag.pcs_name deptName,
         jp.id jpid,
         jp.place_name,
         jp.location,
@@ -186,14 +186,21 @@
         LEFT JOIN blade_region br ON br.`code` = jg.community_code
         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 blade_dept bd ON bu.dept_id = bd.id
         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
         <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>
+
+            <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!=''">
@@ -256,12 +263,8 @@
                     </when>
                 </choose>
             </if>
-            and jtpr.create_time=(
-            SELECT MAX(create_time) FROM jczz_task_place_rectification where jtpr.house_code=house_code
-            )
-            order by jtpr.create_time desc
         </where>
-
+        order by jtpr.create_time desc
     </select>
 
 
@@ -326,15 +329,12 @@
             and jpr.state = '0'
             and jp.nine_type = bd.dict_key
             and br.town_code =#{code}
-            and jpc.create_time=(
-            SELECT MAX(create_time) FROM jczz_place_check where jpc.house_code=house_code
             <if test="taskPlaceRectification.startTime!=null and taskPlaceRectification.startTime!=''">
-                and create_time&gt;=#{taskPlaceRectification.startTime}
+                and jpc.create_time&gt;=#{taskPlaceRectification.startTime}
             </if>
             <if test="taskPlaceRectification.endTime!=null and taskPlaceRectification.endTime!=''">
-                and create_time&lt;=#{taskPlaceRectification.endTime}
+                and jpc.create_time&lt;=#{taskPlaceRectification.endTime}
             </if>
-            )
         </where>
         ) number
         FROM
@@ -384,7 +384,7 @@
         jtpr.signature_path,
         jtpr.create_user,
         jtpr.image_urls,
-        bd.dept_name,
+        jpag.pcs_name deptName,
         jp.id jpid,
         jp.place_name,
         jp.location,
@@ -405,8 +405,8 @@
         LEFT JOIN blade_region br ON br.`code` = jg.community_code
         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 blade_dept bd ON bu.dept_id = bd.id
-        LEFT JOIN jczz_doorplate_address jda on jda.address_code=jp.house_code
+        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
         <where>
             <if test="taskPalce.id != null ">and id = #{taskPalce.id}</if>
             <if test="taskPalce.placeCheckId != null ">and place_check_id = #{taskPalce.placeCheckId}</if>
@@ -475,9 +475,7 @@
                     </when>
                 </choose>
             </if>
-            and jtpr.create_time=(
-            SELECT MAX(create_time) FROM jczz_task_place_rectification where jtpr.house_code=house_code
-            )
+
         </where>
 
 

--
Gitblit v1.9.3