From 5d901b5e3f033e8b04e53420d68626cbd87431c8 Mon Sep 17 00:00:00 2001
From: 648540858 <648540858@qq.com>
Date: 星期五, 06 五月 2022 10:12:34 +0800
Subject: [PATCH] 使用阿里代码规范。规范代码写法

---
 src/main/java/com/genersoft/iot/vmp/storager/dao/ParentPlatformMapper.java |   50 +++++++++++++++++++++++++++++++++++++++-----------
 1 files changed, 39 insertions(+), 11 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 149b22a..2cbb426 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
@@ -1,6 +1,7 @@
 package com.genersoft.iot.vmp.storager.dao;
 
 import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform;
+import com.genersoft.iot.vmp.storager.dao.dto.ChannelSourceInfo;
 import org.apache.ibatis.annotations.*;
 import org.springframework.stereotype.Repository;
 
@@ -15,10 +16,10 @@
 
     @Insert("INSERT INTO parent_platform (enable, name, serverGBId, serverGBDomain, serverIP, serverPort, deviceGBId, deviceIp,  " +
             "            devicePort, username, password, expires, keepTimeout, transport, characterSet, ptz, rtcp, " +
-            "            status) " +
+            "            status, shareAllLiveStream, startOfflinePush, catalogId, administrativeDivision, catalogGroup) " +
             "            VALUES (${enable}, '${name}', '${serverGBId}', '${serverGBDomain}', '${serverIP}', ${serverPort}, '${deviceGBId}', '${deviceIp}', " +
             "            '${devicePort}', '${username}', '${password}', '${expires}', '${keepTimeout}', '${transport}', '${characterSet}', ${ptz}, ${rtcp}, " +
-            "            ${status})")
+            "            ${status}, ${shareAllLiveStream},  ${startOfflinePush}, #{catalogId}, #{administrativeDivision}, #{catalogGroup})")
     int addParentPlatform(ParentPlatform parentPlatform);
 
     @Update("UPDATE parent_platform " +
@@ -39,20 +40,29 @@
             "characterSet=#{characterSet}, " +
             "ptz=#{ptz}, " +
             "rtcp=#{rtcp}, " +
-            "status=#{status} " +
+            "status=#{status}, " +
+            "shareAllLiveStream=#{shareAllLiveStream}, " +
+            "startOfflinePush=${startOfflinePush}, " +
+            "catalogGroup=#{catalogGroup}, " +
+            "administrativeDivision=#{administrativeDivision}, " +
+            "catalogId=#{catalogId} " +
             "WHERE id=#{id}")
     int updateParentPlatform(ParentPlatform parentPlatform);
 
     @Delete("DELETE FROM parent_platform WHERE serverGBId=#{serverGBId}")
     int delParentPlatform(ParentPlatform parentPlatform);
 
-    @Select("SELECT *,(" +
-            "select sum(sum1) from ( " +
-            "SELECT count(0) as sum1 FROM platform_gb_channel pc WHERE pc.platformId = pp.serverGBId " +
-            "union all " +
-            "SELECT count(0) as sum1 FROM platform_gb_stream pgs WHERE pgs.platformId = pp.serverGBId " +
-            ") " +
-            ") as channelCount " +
+    @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)\n" +
+            "              +\n" +
+            "              (SELECT count(0)\n" +
+            "              FROM platform_catalog pgc\n" +
+            "              WHERE pgc.platformId = pp.serverGBId)) as channelCount\n" +
             "FROM parent_platform pp ")
     List<ParentPlatform> getParentPlatformList();
 
@@ -66,5 +76,23 @@
     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();
+
+    @Update(value = {" <script>" +
+            "UPDATE parent_platform " +
+            "SET catalogId=#{catalogId}" +
+            "WHERE serverGBId=#{platformId}"+
+            "</script>"})
+    int setDefaultCatalog(String platformId, String catalogId);
+
+    @Select("select 'channel' as name, count(pgc.platformId) count from platform_gb_channel pgc left join device_channel dc on dc.id = pgc.deviceChannelId where  pgc.platformId=#{platformId} and dc.channelId =#{gbId} " +
+            "union " +
+            "select 'stream' as name, count(pgs.platformId) count from platform_gb_stream pgs left join gb_stream gs on pgs.gbStreamId = gs.gbStreamId where  pgs.platformId=#{platformId} and gs.gbId = #{gbId}")
+    List<ChannelSourceInfo> getChannelSource(String platformId, String gbId);
 }

--
Gitblit v1.8.0