From 7de1396e315896dbc72a9d54e44f77434ea90f18 Mon Sep 17 00:00:00 2001
From: wlzboy <66905212@qq.com>
Date: 星期日, 14 十二月 2025 23:47:34 +0800
Subject: [PATCH] feat:增加企业微信自动登录

---
 ruoyi-system/src/main/resources/mapper/system/VehicleMileageStatsMapper.xml |   22 ++++++++++++++++------
 1 files changed, 16 insertions(+), 6 deletions(-)

diff --git a/ruoyi-system/src/main/resources/mapper/system/VehicleMileageStatsMapper.xml b/ruoyi-system/src/main/resources/mapper/system/VehicleMileageStatsMapper.xml
index 4179acf..1a2218f 100644
--- a/ruoyi-system/src/main/resources/mapper/system/VehicleMileageStatsMapper.xml
+++ b/ruoyi-system/src/main/resources/mapper/system/VehicleMileageStatsMapper.xml
@@ -83,21 +83,20 @@
                s.non_task_mileage, s.task_ratio, s.gps_point_count, s.task_count, s.segment_count, 
                s.data_source, s.create_time, s.update_time
         from tb_vehicle_mileage_stats s
-        where s.vehicle_id = #{vehicleId} and s.stat_date = #{statDate}
+        where s.vehicle_id = #{vehicleId} and DATE(s.stat_date) = DATE(#{statDate})
         limit 1
     </select>
 
     <select id="selectTaskTimeIntervals" resultMap="TaskTimeIntervalResult">
-        select tv.task_id, t.create_time as start_time, 
+        select tv.task_id, t.actual_start_time as start_time,
                IFNULL(t.actual_end_time, NOW()) as 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.create_time &lt; #{endTime}
-          and t.actual_end_time &gt; #{startTime}
-        order by t.create_time
+          and (t.actual_start_time &lt;= #{endTime} and (t.actual_end_time is null or t.actual_end_time &gt;= #{startTime}))
+
+        order by t.actual_start_time
     </select>
         
     <insert id="insertVehicleMileageStats" parameterType="VehicleMileageStats" useGeneratedKeys="true" keyProperty="statsId">
@@ -130,6 +129,17 @@
             <if test="dataSource != null">#{dataSource},</if>
             NOW()
          </trim>
+        ON DUPLICATE KEY UPDATE
+            vehicle_no = VALUES(vehicle_no),
+            total_mileage = VALUES(total_mileage),
+            task_mileage = VALUES(task_mileage),
+            non_task_mileage = VALUES(non_task_mileage),
+            task_ratio = VALUES(task_ratio),
+            gps_point_count = VALUES(gps_point_count),
+            task_count = VALUES(task_count),
+            segment_count = VALUES(segment_count),
+            data_source = VALUES(data_source),
+            update_time = NOW()
     </insert>
 
     <update id="updateVehicleMileageStats" parameterType="VehicleMileageStats">

--
Gitblit v1.9.1