From 7d888274150e9415ae0fc16e67fefd1cdb4a69cc Mon Sep 17 00:00:00 2001
From: 648540858 <648540858@qq.com>
Date: 星期四, 20 一月 2022 16:48:30 +0800
Subject: [PATCH] 处理服务重启或设备重新上线时的订阅,优化通道导入重复的处理

---
 src/main/java/com/genersoft/iot/vmp/storager/dao/StreamPushMapper.java |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/main/java/com/genersoft/iot/vmp/storager/dao/StreamPushMapper.java b/src/main/java/com/genersoft/iot/vmp/storager/dao/StreamPushMapper.java
index c5b22f8..9a5d3be 100644
--- a/src/main/java/com/genersoft/iot/vmp/storager/dao/StreamPushMapper.java
+++ b/src/main/java/com/genersoft/iot/vmp/storager/dao/StreamPushMapper.java
@@ -40,7 +40,7 @@
             "</script>")
     int delAll(List<StreamPushItem> streamPushItems);
 
-    @Select("SELECT st.*, pgs.gbId, pgs.status, pgs.name, pgs.longitude, pgs.latitude FROM stream_push st LEFT JOIN gb_stream pgs on st.app = pgs.app AND st.stream = pgs.stream")
+    @Select("SELECT st.*, pgs.gbId, pgs.status, pgs.name, pgs.longitude, pgs.latitude FROM stream_push st LEFT JOIN gb_stream pgs on st.app = pgs.app AND st.stream = pgs.stream order by st.createStamp desc")
     List<StreamPushItem> selectAll();
 
     @Select("SELECT st.*, pgs.gbId, pgs.status, pgs.name, pgs.longitude, pgs.latitude FROM stream_push st LEFT JOIN gb_stream pgs on st.app = pgs.app AND st.stream = pgs.stream WHERE st.enable=${enable}")
@@ -50,9 +50,9 @@
     StreamPushItem selectOne(String app, String stream);
 
     @Insert("<script>"  +
-            "INSERT INTO stream_push (app, stream, totalReaderCount, originType, originTypeStr, " +
+            "REPLACE INTO stream_push (app, stream, totalReaderCount, originType, originTypeStr, " +
             "createStamp, aliveSecond, mediaServerId) " +
-            "VALUES <foreach collection='streamPushItems' item='item' index='index' >" +
+            "VALUES <foreach collection='streamPushItems' item='item' index='index' separator=','>" +
             "( '${item.app}', '${item.stream}', '${item.totalReaderCount}', '${item.originType}', " +
             "'${item.originTypeStr}','${item.createStamp}', '${item.aliveSecond}', '${item.mediaServerId}' )" +
             " </foreach>" +

--
Gitblit v1.8.0