From 10cb58391ab402d0e761a7c17f3740c081dc9042 Mon Sep 17 00:00:00 2001
From: 648540858 <648540858@qq.com>
Date: 星期一, 04 七月 2022 01:08:26 +0800
Subject: [PATCH] 修复轨迹的储存与查询展示

---
 src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceChannelMapper.java |   22 ++++++++++++++++++----
 1 files changed, 18 insertions(+), 4 deletions(-)

diff --git a/src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceChannelMapper.java b/src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceChannelMapper.java
index 69ce4a7..725d8e3 100644
--- a/src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceChannelMapper.java
+++ b/src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceChannelMapper.java
@@ -156,7 +156,8 @@
             "'${item.certNum}', ${item.certifiable}, ${item.errCode}, '${item.secrecy}', " +
             "'${item.ipAddress}', ${item.port}, '${item.password}', ${item.PTZType}, ${item.status}, " +
             "'${item.streamId}', ${item.longitude}, ${item.latitude},${item.longitudeGcj02}, " +
-            "${item.latitudeGcj02},${item.longitudeWgs84}, ${item.latitudeWgs84},'${item.createTime}', '${item.updateTime}, '${item.businessGroupId}')" +
+            "${item.latitudeGcj02},${item.longitudeWgs84}, ${item.latitudeWgs84},'${item.createTime}', '${item.updateTime}', " +
+            "'${item.businessGroupId}') " +
             "</foreach> " +
             "ON DUPLICATE KEY UPDATE " +
             "updateTime=VALUES(updateTime), " +
@@ -226,7 +227,7 @@
             "<if test='item.latitudeGcj02 != null'>, latitudeGcj02=${item.latitudeGcj02}</if>" +
             "<if test='item.longitudeWgs84 != null'>, longitudeWgs84=${item.longitudeWgs84}</if>" +
             "<if test='item.latitudeWgs84 != null'>, latitudeWgs84=${item.latitudeWgs84}</if>" +
-            "<if test='item.businessGroupId != null'>, businessGroupId=${item.businessGroupId}</if>" +
+            "<if test='item.businessGroupId != null'>, businessGroupId=#{item.businessGroupId}</if>" +
             "WHERE deviceId='${item.deviceId}' AND channelId='${item.channelId}'"+
             "</foreach>" +
             "</script>"})
@@ -275,8 +276,19 @@
             " and channelId = #{channelId}")
     int updateChannelSubCount(String deviceId, String channelId);
 
-    @Update(value = {"UPDATE device_channel SET latitude=${latitude}, longitude=${longitude} WHERE deviceId=#{deviceId} AND channelId=#{channelId}"})
-    void updatePotion(String deviceId, String channelId, double longitude, double latitude);
+    @Update(value = {" <script>" +
+            "UPDATE device_channel " +
+            "SET " +
+            "latitude=${latitude}, " +
+            "longitude=${longitude}, " +
+            "longitudeGcj02=${longitudeGcj02}," +
+            "latitudeGcj02=${latitudeGcj02}," +
+            "longitudeWgs84=${longitudeWgs84}," +
+            "latitudeWgs84=${latitudeWgs84} " +
+            "WHERE deviceId=#{deviceId} " +
+            " <if test='channelId != null' >  AND channelId=#{channelId}</if>" +
+            " </script>"})
+    void updatePosition(DeviceChannel deviceChannel);
 
     @Select("SELECT * FROM device_channel WHERE length(trim(streamId)) > 0")
     List<DeviceChannel> getAllChannelInPlay();
@@ -312,4 +324,6 @@
 
     @Select("select * from device_channel where deviceId=#{deviceId} and SUBSTRING(channelId, 11, 3)=#{typeCode}")
     List<DeviceChannel> getBusinessGroups(String deviceId, String typeCode);
+
+
 }

--
Gitblit v1.8.0