From b2e3d6532dbbb3929e01a598dcef7eb07f39b826 Mon Sep 17 00:00:00 2001
From: 无关风月 <443237572@qq.com>
Date: 星期五, 11 七月 2025 09:30:27 +0800
Subject: [PATCH] 保洁巡检本周代码

---
 ruoyi-system/src/main/resources/mapper/system/TTaskMapper.xml |   25 +++++++++++++++++--------
 1 files changed, 17 insertions(+), 8 deletions(-)

diff --git a/ruoyi-system/src/main/resources/mapper/system/TTaskMapper.xml b/ruoyi-system/src/main/resources/mapper/system/TTaskMapper.xml
index 8bb2557..b3120d7 100644
--- a/ruoyi-system/src/main/resources/mapper/system/TTaskMapper.xml
+++ b/ruoyi-system/src/main/resources/mapper/system/TTaskMapper.xml
@@ -65,7 +65,7 @@
         select t1.*,t2.location_name as locationName,t3.location_name as locationTypeName,
                t2.location_address as locationAddress,
         t2.location_address_end as locationAddressEnd,
-        t3.location_icon as locatioTypeIcon,
+        t3.location_icon as locationTypeIcon,
         t5.clear_status as clearStatus,
         t4.nick_name as patrolInspectorName,
         t4.phonenumber as phonenumber,
@@ -95,22 +95,30 @@
         left join t_location t2 on t1.location_id = t2.id
         left join t_location_type t3 on t2.location_type = t3.id
         left join sys_user t4 on t1.patrol_inspector = t4.user_id
-        LEFT JOIN (
+        inner JOIN (
         SELECT t1.*
         FROM t_task_detail t1
-        JOIN (SELECT task_id, MAX(create_time) AS max_time
+        left join (SELECT task_id, MAX(create_time) AS max_time
         FROM t_task_detail
-        GROUP BY task_id) AS t2 ON t1.task_id = t2.task_id AND t1.create_time = t2.max_time
-        where 1=1
-        <if test="query.clearStatus != null">
-            and t1.clear_status = #{query.clearStatus}
-        </if>
+        GROUP BY task_id
+        order by create_time desc
+        ) AS t2 ON t1.task_id = t2.task_id AND t1.create_time = t2.max_time
+
         ) t5 on t1.id = t5.task_id
         where 1=1
         and t1.`disabled` = ${@com.ruoyi.common.enums.DisabledEnum@NO.getCode()}
 
         <if test="query.userId != null and query.userId != ''">
             and t1.patrol_inspector = #{query.userId}
+        </if>
+        <if test="query.clearStatus != null and query.clearStatus == 1">
+            and (t1.status = 5 or t1.status = 6)
+        </if>
+        <if test="query.clearStatus != null and query.clearStatus == 2">
+            and (t1.status = 4 )
+        </if>
+        <if test="query.clearStatus == null">
+            and (t1.status = 4 or t1.status = 5 or t1.status = 6 )
         </if>
         <if test="query.startTime != null and query.startTime != ''">
             and (t1.implement_time between #{query.startTime} and #{query.endTime})
@@ -150,6 +158,7 @@
         <if test="query.startTime != null and startTime != ''">
             and (t1.implement_time between #{query.startTime} and #{query.endTime})
         </if>
+        order by t1.update_time desc
     </select>
     <select id="taskProgress" resultType="com.ruoyi.system.vo.system.ProgressListVO">
         select t1.*,t2.nick_name as nickName,t2.phonenumber,t3.template_name as templateName,count(*) as num2,

--
Gitblit v1.7.1