package com.genersoft.iot.vmp.gb28181.dao; import com.genersoft.iot.vmp.gb28181.bean.Device; import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel; import com.genersoft.iot.vmp.gb28181.controller.bean.ChannelReduce; import com.genersoft.iot.vmp.gb28181.dao.provider.DeviceChannelProvider; import com.genersoft.iot.vmp.service.bean.GPSMsgInfo; import com.genersoft.iot.vmp.web.gb28181.dto.DeviceChannelExtend; import org.apache.ibatis.annotations.*; import org.springframework.stereotype.Repository; import java.util.List; /** * 用于存储设备通道信息 */ @Mapper @Repository public interface DeviceChannelMapper { @Insert("") @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id") int add(DeviceChannel channel); @Update(value = {" "}) int update(DeviceChannel channel); @SelectProvider(type = DeviceChannelProvider.class, method = "queryChannels") List queryChannels(@Param("deviceDbId") int deviceDbId, @Param("civilCode") String civilCode, @Param("businessGroupId") String businessGroupId, @Param("parentChannelId") String parentChannelId, @Param("query") String query, @Param("hasSubChannel") Boolean hasSubChannel, @Param("online") Boolean online, @Param("channelIds") List channelIds); @SelectProvider(type = DeviceChannelProvider.class, method = "queryChannelsByDeviceDbId") List queryChannelsByDeviceDbId(@Param("deviceDbId") int deviceDbId); @Select(value = {" "}) List queryChaneIdListByDeviceDbIds(List deviceDbIds); @Delete("DELETE FROM wvp_device_channel WHERE device_db_id=#{deviceId}") int cleanChannelsByDeviceId(@Param("deviceId") int deviceId); @Delete("DELETE FROM wvp_device_channel WHERE id=#{id}") int del(@Param("id") int id); @Select(value = {" "}) List queryChannelsWithDeviceInfo(@Param("deviceId") String deviceId, @Param("parentChannelId") String parentChannelId, @Param("query") String query, @Param("hasSubChannel") Boolean hasSubChannel, @Param("online") Boolean online, @Param("channelIds") List channelIds); @Update(value = {"UPDATE wvp_device_channel SET stream_id=#{streamId} WHERE id=#{channelId}"}) void startPlay(@Param("channelId") Integer channelId, @Param("streamId") String streamId); @Select(value = {" "}) List queryChannelListInAll(@Param("query") String query, @Param("online") Boolean online, @Param("hasSubChannel") Boolean hasSubChannel, @Param("platformId") String platformId, @Param("catalogId") String catalogId); @Update(value = {"UPDATE wvp_device_channel SET status='OFF' WHERE id=#{id}"}) void offline(@Param("id") int id); @Insert("") int batchAdd(@Param("addChannels") List addChannels); @Update(value = {"UPDATE wvp_device_channel SET status='ON' WHERE id=#{id}"}) void online(@Param("id") int id); @Update({""}) int batchUpdate(List updateChannels); @Update({""}) int batchUpdateForNotify(List updateChannels); @Update(" update wvp_device_channel" + " set sub_count = (select *" + " from (select count(0)" + " from wvp_device_channel" + " where device_db_id = #{deviceDbId} and parent_id = #{channelId}) as temp)" + " where device_db_id = #{deviceDbId} and device_id = #{channelId}") int updateChannelSubCount(@Param("deviceDbId") int deviceDbId, @Param("channelId") String channelId); @Update(value = {" "}) int updatePosition(DeviceChannel deviceChannel); @Select("select " + " id,\n" + " device_db_id,\n" + " create_time,\n" + " update_time,\n" + " sub_count,\n" + " stream_id,\n" + " has_audio,\n" + " gps_time,\n" + " stream_identification,\n" + " channel_type,\n" + " device_id,\n" + " name,\n" + " manufacturer,\n" + " model,\n" + " owner,\n" + " civil_code,\n" + " block,\n" + " address,\n" + " parental,\n" + " parent_id,\n" + " safety_way,\n" + " register_way,\n" + " cert_num,\n" + " certifiable,\n" + " err_code,\n" + " end_time,\n" + " secrecy,\n" + " ip_address,\n" + " port,\n" + " password,\n" + " status,\n" + " longitude,\n" + " latitude,\n" + " ptz_type,\n" + " position_type,\n" + " room_type,\n" + " use_type,\n" + " supply_light_type,\n" + " direction_type,\n" + " resolution,\n" + " business_group_id,\n" + " download_speed,\n" + " svc_space_support_mod,\n" + " svc_time_support_mode\n" + " from wvp_device_channel where device_db_id = #{deviceDbId}") List queryAllChannelsForRefresh(@Param("deviceDbId") int deviceDbId); @Select("select de.* from wvp_device de left join wvp_device_channel dc on de.device_id = dc.device_id where dc.device_id=#{channelId}") List getDeviceByChannelDeviceId(String channelId); @Delete({""}) int batchDel(List deleteChannelList); @Update({""}) int batchUpdateStatus(List channels); @Select("select count(1) from wvp_device_channel where status = 'ON'") int getOnlineCount(); @Select("select count(1) from wvp_device_channel") int getAllChannelCount(); @Update("") void updateChannelStreamIdentification(DeviceChannel channel); @Update({""}) void batchUpdatePosition(List channelList); @SelectProvider(type = DeviceChannelProvider.class, method = "getOne") DeviceChannel getOne(@Param("id") int id); @Select(value = {" "}) DeviceChannel getOneForSource(@Param("id") int id); @SelectProvider(type = DeviceChannelProvider.class, method = "getOneByDeviceId") DeviceChannel getOneByDeviceId(@Param("deviceDbId") int deviceDbId, @Param("channelId") String channelId); @Select(value = {" "}) DeviceChannel getOneByDeviceIdForSource(@Param("deviceDbId") int deviceDbId, @Param("channelId") String channelId); @Update(value = {"UPDATE wvp_device_channel SET stream_id=null WHERE id=#{channelId}"}) void stopPlayById(@Param("channelId") Integer channelId); @Update(value = {" "}) void changeAudio(@Param("channelId") int channelId, @Param("audio") boolean audio); @Update("") void updateStreamGPS(List gpsMsgInfoList); @Update("UPDATE wvp_device_channel SET status=#{status} WHERE device_db_id=#{deviceDbId} AND device_id=#{deviceId}") void updateStatus(DeviceChannel channel); @Update({""}) void updateChannelForNotify(DeviceChannel channel); @Select(value = {" "}) DeviceChannel getOneBySourceChannelId(int deviceDbId, String channelId); }