From 22efd0f56c20e1aedb18fa7b9bcdc48007fcc954 Mon Sep 17 00:00:00 2001
From: 648540858 <648540858@qq.com>
Date: 星期一, 20 十二月 2021 09:51:51 +0800
Subject: [PATCH] 添加心跳到期时验证zlm是否真的离线。

---
 src/main/java/com/genersoft/iot/vmp/storager/dao/ParentPlatformMapper.java |   42 ++++++++++++++++++++++++++++++------------
 1 files changed, 30 insertions(+), 12 deletions(-)

diff --git a/src/main/java/com/genersoft/iot/vmp/storager/dao/ParentPlatformMapper.java b/src/main/java/com/genersoft/iot/vmp/storager/dao/ParentPlatformMapper.java
index 6d5d83b..c92711a 100644
--- a/src/main/java/com/genersoft/iot/vmp/storager/dao/ParentPlatformMapper.java
+++ b/src/main/java/com/genersoft/iot/vmp/storager/dao/ParentPlatformMapper.java
@@ -14,17 +14,18 @@
 public interface ParentPlatformMapper {
 
     @Insert("INSERT INTO parent_platform (enable, name, serverGBId, serverGBDomain, serverIP, serverPort, deviceGBId, deviceIp,  " +
-            "            devicePort, username, password, expires, keepTimeout, transport, characterSet, PTZEnable, rtcp, " +
-            "            status) " +
+            "            devicePort, username, password, expires, keepTimeout, transport, characterSet, ptz, rtcp, " +
+            "            status, shareAllLiveStream) " +
             "            VALUES (${enable}, '${name}', '${serverGBId}', '${serverGBDomain}', '${serverIP}', ${serverPort}, '${deviceGBId}', '${deviceIp}', " +
-            "            '${devicePort}', '${username}', '${password}', '${expires}', '${keepTimeout}', '${transport}', '${characterSet}', ${PTZEnable}, ${rtcp}, " +
-            "            ${status})")
+            "            '${devicePort}', '${username}', '${password}', '${expires}', '${keepTimeout}', '${transport}', '${characterSet}', ${ptz}, ${rtcp}, " +
+            "            ${status}, ${shareAllLiveStream})")
     int addParentPlatform(ParentPlatform parentPlatform);
 
     @Update("UPDATE parent_platform " +
             "SET enable=#{enable}, " +
             "name=#{name}," +
-            "serverGBId=#{serverGBId}," +
+            "deviceGBId=#{deviceGBId}," +
+            "serverGBId=#{serverGBId}, " +
             "serverGBDomain=#{serverGBDomain}, " +
             "serverIP=#{serverIP}," +
             "serverPort=#{serverPort}, " +
@@ -36,24 +37,41 @@
             "keepTimeout=#{keepTimeout}, " +
             "transport=#{transport}, " +
             "characterSet=#{characterSet}, " +
-            "PTZEnable=#{PTZEnable}, " +
+            "ptz=#{ptz}, " +
             "rtcp=#{rtcp}, " +
-            "status=#{status} " +
-            "WHERE deviceGBId=#{deviceGBId}")
+            "status=#{status}, " +
+            "shareAllLiveStream=#{shareAllLiveStream} " +
+            "WHERE id=#{id}")
     int updateParentPlatform(ParentPlatform parentPlatform);
 
-    @Delete("DELETE FROM parent_platform WHERE deviceGBId=#{deviceGBId}")
+    @Delete("DELETE FROM parent_platform WHERE serverGBId=#{serverGBId}")
     int delParentPlatform(ParentPlatform parentPlatform);
 
-    @Select("SELECT *,( SELECT count(0) FROM platform_gb_channel pc WHERE pc.platformId = pp.deviceGBId) as channelCount FROM parent_platform pp ")
+    @Select("SELECT *, ((SELECT count(0)\n" +
+            "              FROM platform_gb_channel pc\n" +
+            "              WHERE pc.platformId = pp.serverGBId)\n" +
+            "              +\n" +
+            "              (SELECT count(0)\n" +
+            "              FROM platform_gb_stream pgs\n" +
+            "              WHERE pgs.platformId = pp.serverGBId)) as channelCount\n" +
+            "FROM parent_platform pp ")
     List<ParentPlatform> getParentPlatformList();
 
     @Select("SELECT * FROM parent_platform WHERE enable=#{enable}")
     List<ParentPlatform> getEnableParentPlatformList(boolean enable);
 
     @Select("SELECT * FROM parent_platform WHERE serverGBId=#{platformGbId}")
-    ParentPlatform getParentPlatById(String platformGbId);
+    ParentPlatform getParentPlatByServerGBId(String platformGbId);
+
+    @Select("SELECT * FROM parent_platform WHERE id=#{id}")
+    ParentPlatform getParentPlatById(int id);
 
     @Update("UPDATE parent_platform SET status=false" )
-    void outlineForAllParentPlatform();
+    int outlineForAllParentPlatform();
+
+    @Update("UPDATE parent_platform SET status=#{online} WHERE serverGBId=#{platformGbID}" )
+    int updateParentPlatformStatus(String platformGbID, boolean online);
+
+    @Select("SELECT * FROM parent_platform WHERE shareAllLiveStream=true")
+    List<ParentPlatform> selectAllAhareAllLiveStream();
 }

--
Gitblit v1.8.0