From 40a8157440e3b906da8f52e07d939d78c3f4c313 Mon Sep 17 00:00:00 2001
From: wlzboy <66905212@qq.com>
Date: 星期日, 12 四月 2026 16:14:06 +0800
Subject: [PATCH] feat: 任务增加统计、同步增加通知

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

diff --git a/ruoyi-system/src/main/resources/mapper/system/VehicleGpsMapper.xml b/ruoyi-system/src/main/resources/mapper/system/VehicleGpsMapper.xml
index 0aa55dd..df86c7f 100644
--- a/ruoyi-system/src/main/resources/mapper/system/VehicleGpsMapper.xml
+++ b/ruoyi-system/src/main/resources/mapper/system/VehicleGpsMapper.xml
@@ -37,10 +37,10 @@
             <if test="direction != null "> and direction = #{direction}</if>
             <if test="collectTime != null "> and collect_time = #{collectTime}</if>
             <if test="beginTime != null and beginTime != ''"><!-- 寮�濮嬫椂闂存绱� -->
-                AND date_format(collect_time,'%y%m%d') &gt;= date_format(#{beginTime},'%y%m%d')
+                AND collect_time &gt;= #{beginTime}
             </if>
             <if test="endTime != null and endTime != ''"><!-- 缁撴潫鏃堕棿妫�绱� -->
-                AND date_format(collect_time,'%y%m%d') &lt;= date_format(#{endTime},'%y%m%d')
+                AND collect_time &lt;= #{endTime}
             </if>
         </where>
         order by collect_time desc
@@ -112,14 +112,20 @@
     </select>
 
     <delete id="deleteVehicleGpsBeforeDate">
-        delete g from tb_vehicle_gps g
-        where g.collect_time &lt; (
-            select date_sub(max(collect_time), interval 2 day)
-            from tb_vehicle_gps g2
-            where g2.vehicle_id = g.vehicle_id
-        )
+        delete from tb_vehicle_gps
+        where collect_time &lt; DATE_SUB(NOW(), INTERVAL 2 MONTH)
     </delete>
 
+    <delete id="deleteVehicleGpsBeforeDateBatch">
+        delete from tb_vehicle_gps
+        where collect_time &lt; DATE_SUB(NOW(), INTERVAL 2 MONTH)
+        LIMIT #{batchSize}
+    </delete>
+
+    <update id="optimizeVehicleGpsTable">
+        OPTIMIZE TABLE tb_vehicle_gps
+    </update>
+
     <select id="selectGpsDataByTimeRange" resultMap="VehicleGpsResult">
         select gps_id, vehicle_id, device_id, longitude, latitude, altitude, speed, direction, 
                collect_time, device_report_time, platform_process_time, create_time

--
Gitblit v1.9.1