package com.genersoft.iot.vmp.storager.dao; import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel; import com.genersoft.iot.vmp.vmanager.bean.DeviceChannelTree; import com.genersoft.iot.vmp.vmanager.gb28181.platform.bean.ChannelReduce; import org.apache.ibatis.annotations.*; import org.springframework.stereotype.Repository; import java.util.List; /** * 用于存储设备通道信息 */ @Mapper @Repository public interface DeviceChannelMapper { @Insert("INSERT INTO device_channel (channelId, deviceId, name, manufacture, model, owner, civilCode, block, " + "address, parental, parentId, safetyWay, registerWay, certNum, certifiable, errCode, secrecy, " + "ipAddress, port, password, PTZType, status, streamId, longitude, latitude, createTime, updateTime) " + "VALUES ('${channelId}', '${deviceId}', '${name}', '${manufacture}', '${model}', '${owner}', '${civilCode}', '${block}'," + "'${address}', ${parental}, '${parentId}', ${safetyWay}, ${registerWay}, '${certNum}', ${certifiable}, ${errCode}, '${secrecy}', " + "'${ipAddress}', ${port}, '${password}', ${PTZType}, ${status}, '${streamId}', ${longitude}, ${latitude},'${createTime}', '${updateTime}')") int add(DeviceChannel channel); @Update(value = {" "}) int update(DeviceChannel channel); @Select(value = {" "}) List queryChannels(String deviceId, String parentChannelId, String query, Boolean hasSubChannel, Boolean online); @Select("SELECT * FROM device_channel WHERE deviceId=#{deviceId} AND channelId=#{channelId}") DeviceChannel queryChannel(String deviceId, String channelId); @Delete("DELETE FROM device_channel WHERE deviceId=#{deviceId}") int cleanChannelsByDeviceId(String deviceId); @Delete("DELETE FROM device_channel WHERE deviceId=#{deviceId} AND channelId=#{channelId}") int del(String deviceId, String channelId); @Update(value = {"UPDATE device_channel SET streamId=null WHERE deviceId=#{deviceId} AND channelId=#{channelId}"}) void stopPlay(String deviceId, String channelId); @Update(value = {"UPDATE device_channel SET streamId=#{streamId} WHERE deviceId=#{deviceId} AND channelId=#{channelId}"}) void startPlay(String deviceId, String channelId, String streamId); @Select(value = {" "}) List queryChannelListInAll(String query, Boolean online, Boolean hasSubChannel, String platformId, String catalogId); @Select("SELECT * FROM device_channel WHERE channelId=#{channelId}") List queryChannelByChannelId( String channelId); @Update(value = {"UPDATE device_channel SET status=0 WHERE deviceId=#{deviceId} AND channelId=#{channelId}"}) void offline(String deviceId, String channelId); @Update(value = {"UPDATE device_channel SET status=1 WHERE deviceId=#{deviceId} AND channelId=#{channelId}"}) void online(String deviceId, String channelId); @Insert("") int batchAdd(List addChannels); @Update({""}) int batchUpdate(List updateChannels); @Select(value = {" "}) List queryChannelsByDeviceIdWithStartAndLimit(String deviceId, String parentChannelId, String query, Boolean hasSubChannel, Boolean online, int start, int limit); @Select("SELECT * FROM device_channel WHERE deviceId=#{deviceId} AND status=1") List queryOnlineChannelsByDeviceId(String deviceId); @Select(" SELECT\n" + " channelId,\n" + " channelId as id,\n" + " deviceId,\n" + " parentId,\n" + " status,\n" + " 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 tree(String deviceId); }