From f67945d53b20f6a45ae50b27d74c966eb1355bb4 Mon Sep 17 00:00:00 2001
From: wlzboy <66905212@qq.com>
Date: 星期日, 16 十一月 2025 22:53:54 +0800
Subject: [PATCH] feat: 增加分段GPS计算行程距离

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

diff --git a/ruoyi-system/src/main/resources/mapper/system/VehicleGpsMapper.xml b/ruoyi-system/src/main/resources/mapper/system/VehicleGpsMapper.xml
index 5d8d093..3abe287 100644
--- a/ruoyi-system/src/main/resources/mapper/system/VehicleGpsMapper.xml
+++ b/ruoyi-system/src/main/resources/mapper/system/VehicleGpsMapper.xml
@@ -136,4 +136,19 @@
         where collect_time &gt;= DATE_SUB(NOW(), INTERVAL 7 DAY)
         order by vehicle_id
     </select>
+    
+    <!-- 鏌ヨ鏈璁$畻鐨凣PS鍧愭爣锛堜笉鍦╰b_vehicle_gps_calculated琛ㄤ腑鐨勮褰曪級 -->
+    <select id="selectUncalculatedGps" resultMap="VehicleGpsResult">
+        SELECT g.gps_id, g.vehicle_id, g.device_id, g.longitude, g.latitude, g.altitude, 
+               g.speed, g.direction, g.collect_time, g.device_report_time, 
+               g.platform_process_time, g.create_time, v.vehicle_no
+        FROM tb_vehicle_gps g
+        LEFT JOIN tb_vehicle_info v ON g.vehicle_id = v.vehicle_id
+        LEFT JOIN tb_vehicle_gps_calculated c ON g.gps_id = c.gps_id
+        WHERE g.vehicle_id = #{vehicleId}
+          AND g.collect_time &gt;= #{startTime}
+          AND g.collect_time &lt;= #{endTime}
+          AND c.gps_id IS NULL  -- 鏈璁$畻鐨凣PS鐐�
+        ORDER BY g.collect_time
+    </select>
 </mapper> 
\ No newline at end of file

--
Gitblit v1.9.1