648540858
2022-02-22 2157bb0270663df35b7267c3d10c8b594400102e
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
package com.genersoft.iot.vmp.storager.dao;
 
import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;
 
import java.util.List;
 
/**
 * 用于存储上级平台
 */
@Mapper
@Repository
public interface ParentPlatformMapper {
 
    @Insert("INSERT INTO parent_platform (enable, name, serverGBId, serverGBDomain, serverIP, serverPort, deviceGBId, deviceIp,  " +
            "            devicePort, username, password, expires, keepTimeout, transport, characterSet, ptz, rtcp, " +
            "            status, shareAllLiveStream, catalogId) " +
            "            VALUES (${enable}, '${name}', '${serverGBId}', '${serverGBDomain}', '${serverIP}', ${serverPort}, '${deviceGBId}', '${deviceIp}', " +
            "            '${devicePort}', '${username}', '${password}', '${expires}', '${keepTimeout}', '${transport}', '${characterSet}', ${ptz}, ${rtcp}, " +
            "            ${status}, ${shareAllLiveStream}, #{catalogId})")
    int addParentPlatform(ParentPlatform parentPlatform);
 
    @Update("UPDATE parent_platform " +
            "SET enable=#{enable}, " +
            "name=#{name}," +
            "deviceGBId=#{deviceGBId}," +
            "serverGBId=#{serverGBId}, " +
            "serverGBDomain=#{serverGBDomain}, " +
            "serverIP=#{serverIP}," +
            "serverPort=#{serverPort}, " +
            "deviceIp=#{deviceIp}, " +
            "devicePort=#{devicePort}, " +
            "username=#{username}, " +
            "password=#{password}, " +
            "expires=#{expires}, " +
            "keepTimeout=#{keepTimeout}, " +
            "transport=#{transport}, " +
            "characterSet=#{characterSet}, " +
            "ptz=#{ptz}, " +
            "rtcp=#{rtcp}, " +
            "status=#{status}, " +
            "shareAllLiveStream=#{shareAllLiveStream}, " +
            "catalogId=#{catalogId} " +
            "WHERE id=#{id}")
    int updateParentPlatform(ParentPlatform parentPlatform);
 
    @Delete("DELETE FROM parent_platform WHERE serverGBId=#{serverGBId}")
    int delParentPlatform(ParentPlatform parentPlatform);
 
    @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();
 
    @Select("SELECT * FROM parent_platform WHERE enable=#{enable}")
    List<ParentPlatform> getEnableParentPlatformList(boolean enable);
 
    @Select("SELECT * FROM parent_platform WHERE serverGBId=#{platformGbId}")
    ParentPlatform getParentPlatByServerGBId(String platformGbId);
 
    @Select("SELECT * FROM parent_platform WHERE id=#{id}")
    ParentPlatform getParentPlatById(int id);
 
    @Update("UPDATE parent_platform SET status=false" )
    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);
}