648540858
2022-03-29 1553b39b4547418774ab2bd6da72f75bfd14b972
src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceChannelMapper.java
@@ -1,6 +1,7 @@
package com.genersoft.iot.vmp.storager.dao;
import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel;
import com.genersoft.iot.vmp.gb28181.bean.DeviceChannelInPlatform;
import com.genersoft.iot.vmp.vmanager.bean.DeviceChannelTree;
import com.genersoft.iot.vmp.vmanager.gb28181.platform.bean.ChannelReduce;
import org.apache.ibatis.annotations.*;
@@ -112,6 +113,19 @@
            " </script>"})
    List<ChannelReduce> queryChannelListInAll(String query, Boolean online, Boolean hasSubChannel, String platformId, String catalogId);
    @Select(value = {" <script>" +
            "SELECT " +
            "    dc.*,\n" +
            "    pgc.platformId as platformId,\n" +
            "    pgc.catalogId as catalogId " +
            " FROM device_channel dc " +
            " LEFT JOIN platform_gb_channel pgc on pgc.deviceChannelId = dc.id " +
            " WHERE pgc.platformId = #{platformId} " +
            " ORDER BY dc.deviceId, dc.channelId ASC" +
            " </script>"})
    List<DeviceChannelInPlatform> queryChannelByPlatformId(String platformId);
    @Select("SELECT * FROM device_channel WHERE channelId=#{channelId}")
    List<DeviceChannel> queryChannelByChannelId( String channelId);
@@ -135,6 +149,32 @@
            "'${item.ipAddress}', ${item.port}, '${item.password}', ${item.PTZType}, ${item.status}, " +
            "'${item.streamId}', ${item.longitude}, ${item.latitude},'${item.createTime}', '${item.updateTime}')" +
            "</foreach> " +
            "ON DUPLICATE KEY UPDATE " +
            "updateTime=VALUES(updateTime), " +
            "name=VALUES(name), " +
            "manufacture=VALUES(manufacture), " +
            "model=VALUES(model), " +
            "owner=VALUES(owner), " +
            "civilCode=VALUES(civilCode), " +
            "block=VALUES(block), " +
            "subCount=VALUES(subCount), " +
            "address=VALUES(address), " +
            "parental=VALUES(parental), " +
            "parentId=VALUES(parentId), " +
            "safetyWay=VALUES(safetyWay), " +
            "registerWay=VALUES(registerWay), " +
            "certNum=VALUES(certNum), " +
            "certifiable=VALUES(certifiable), " +
            "errCode=VALUES(errCode), " +
            "secrecy=VALUES(secrecy), " +
            "ipAddress=VALUES(ipAddress), " +
            "port=VALUES(port), " +
            "password=VALUES(password), " +
            "PTZType=VALUES(PTZType), " +
            "status=VALUES(status), " +
            "streamId=VALUES(streamId), " +
            "longitude=VALUES(longitude), " +
            "latitude=VALUES(latitude)" +
            "</script>")
    int batchAdd(List<DeviceChannel> addChannels);
@@ -205,10 +245,29 @@
            "        name as title,\n" +
            "        channelId as \"value\",\n" +
            "        channelId as \"key\",\n" +
            "        channelId,\n" +
            "        longitude,\n" +
            "        latitude\n" +
            "        from device_channel\n" +
            "        where deviceId = #{deviceId}")
    List<DeviceChannelTree> tree(String deviceId);
    @Delete(value = {" <script>" +
            "DELETE " +
            "from " +
            "device_channel " +
            "WHERE " +
            "deviceId = #{deviceId} " +
            " AND channelId NOT IN " +
            "<foreach collection='channels'  item='item'  open='(' separator=',' close=')' > #{item.channelId}</foreach>" +
            " </script>"})
    int cleanChannelsNotInList(String deviceId, List<DeviceChannel> channels);
    @Update(" update device_channel" +
            " set subCount = (select *" +
            "                from (select count(0)" +
            "                      from device_channel" +
            "                      where deviceId = #{deviceId} and parentId = #{channelId}) as temp)" +
            " where deviceId = #{deviceId} " +
            " and channelId = #{channelId}")
    int updateChannelSubCount(String deviceId, String channelId);
}