From 09faa36132c8cbada5327649875534ef01c1a3b1 Mon Sep 17 00:00:00 2001
From: wlzboy <66905212@qq.com>
Date: 星期四, 11 十二月 2025 20:44:31 +0800
Subject: [PATCH] feat: 优化任务里程统计

---
 ruoyi-system/src/main/resources/mapper/system/SysTaskMapper.xml |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/ruoyi-system/src/main/resources/mapper/system/SysTaskMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysTaskMapper.xml
index a7efd95..1b5cfbb 100644
--- a/ruoyi-system/src/main/resources/mapper/system/SysTaskMapper.xml
+++ b/ruoyi-system/src/main/resources/mapper/system/SysTaskMapper.xml
@@ -186,6 +186,20 @@
             t.create_time desc
     </select>
 
+    <select id="selectTaskByVehicleIdAndDate" resultMap="SysTaskResult">
+        select tv.task_id, t.actual_start_time,
+        IFNULL(t.actual_end_time, NOW()) as t.actual_end_time
+        from sys_task_vehicle tv
+        inner join sys_task t on tv.task_id = t.task_id
+        where tv.vehicle_id = #{vehicleId}
+        and t.del_flag = '0'
+        and (
+        (t.actual_end_time is not null and t.actual_start_time > #{startTime} and t.actual_end_time &lt; #{endTime} )
+        or (t.actual_end_time is null and t.actual_start_time > ${endTime} )
+        )
+        order by t.actual_start_time
+    </select>
+
     <select id="selectTaskStatistics" resultType="TaskStatisticsVO">
         select 
             count(*) as totalTasks,

--
Gitblit v1.9.1