From a4bfa94e3d97406c410e6975d9ab1b625ed05fe1 Mon Sep 17 00:00:00 2001
From: huliguo <2023611923@qq.com>
Date: 星期三, 28 五月 2025 18:00:22 +0800
Subject: [PATCH] 新增任务管理、任务记录等搜索字段,可重复审核,添加导出任务记录字段

---
 guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/TaskDetailMapper.xml |   38 ++++++++++++++++++++++++++++++++++----
 1 files changed, 34 insertions(+), 4 deletions(-)

diff --git a/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/TaskDetailMapper.xml b/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/TaskDetailMapper.xml
index bb066cb..39d15ba 100644
--- a/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/TaskDetailMapper.xml
+++ b/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/TaskDetailMapper.xml
@@ -9,15 +9,30 @@
 			b.`name`,
 			b.type,
 			a.status,
+			ifnull(c.num, 0) as vehicleNum,
 			DATE_FORMAT(a.execution_time, '%Y-%m-%d %H:%i:%s') as executionTime
 		from t_task_detail a
 		left join t_patrol_task b on (a.patrol_task_id = b.id)
+		left join (select task_detail_id, count(1) as num from t_task_detail_vehicles group by task_detail_id) c on (a.id = c.task_detail_id)
 		where a.del_flag = 0
 		<if test="null != item.code and '' != item.code">
 			and a.code like CONCAT('%', #{item.code}, '%')
 		</if>
-		<if test="null != item.status">
-			and a.status = #{item.status}
+
+		<if test="null != item.status and item.status.size() > 0">
+			and a.status in
+			<foreach collection="item.status" item="item" index="index" open="(" separator="," close=")">
+					#{item}
+			</foreach>
+		</if>
+		<if test="null != item.type">
+			and b.type = #{item.type}
+		</if>
+		<if test="null != item.name and '' != item.name">
+			and b.name like CONCAT('%', #{item.name}, '%')
+		</if>
+		<if test="null != item.startTime and null != item.endTime">
+			and a.execution_time between #{item.startTime} and #{item.endTime}
 		</if>
 		order by a.execution_time desc
 	</select>
@@ -49,8 +64,20 @@
 		<if test="null != item.code and '' != item.code">
 			and a.code like CONCAT('%', #{item.code}, '%')
 		</if>
-		<if test="null != item.status">
-			and a.status = #{item.status}
+		<if test="null != item.status and item.status.size() > 0">
+			and a.status in
+			<foreach collection="item.status" item="item" index="index" open="(" separator="," close=")">
+				#{item}
+			</foreach>
+		</if>
+		<if test="null != item.type">
+			and b.type = #{item.type}
+		</if>
+		<if test="null != item.name and '' != item.name">
+			and b.name like CONCAT('%', #{item.name}, '%')
+		</if>
+		<if test="null != item.startTime and null != item.endTime">
+			and a.execution_time between #{item.startTime} and #{item.endTime}
 		</if>
 		order by a.execution_time desc
 	</select>
@@ -90,6 +117,9 @@
 		<if test="null != status">
 			and b.status = #{status}
 		</if>
+		<if test="null != sysStatus">
+			and d.sys_status = #{sysStatus}
+		</if>
 		order by b.execution_time desc
 	</select>
 </mapper>
\ No newline at end of file

--
Gitblit v1.7.1