package com.genersoft.iot.vmp.storager.dao; import com.genersoft.iot.vmp.gb28181.bean.Device; import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel; import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform; import com.genersoft.iot.vmp.gb28181.bean.PlatformCatalog; import com.genersoft.iot.vmp.vmanager.gb28181.platform.bean.ChannelReduce; import org.apache.ibatis.annotations.Delete; import org.apache.ibatis.annotations.Insert; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Select; import org.springframework.stereotype.Repository; import java.util.List; @Mapper @Repository public interface PlatformChannelMapper { /** * 查询列表里已经关联的 */ @Select("") List findChannelRelatedPlatform(@Param("platformId") String platformId, @Param("channelReduces") List channelReduces); @Insert("") int addChannels(@Param("platformId") String platformId, @Param("channelReducesToAdd") List channelReducesToAdd); @Delete("") int delChannelForGB(@Param("platformId") String platformId, @Param("channelReducesToDel") List channelReducesToDel); @Delete("") int delChannelForDeviceId(String deviceId); @Delete("") int cleanChannelForGB(String platformId); @Select("SELECT dc.* from wvp_platform_gb_channel pgc left join wvp_device_channel dc on dc.id = pgc.device_channel_id WHERE dc.channel_id=#{channelId} and pgc.platform_id=#{platformId}") List queryChannelInParentPlatform(@Param("platformId") String platformId, @Param("channelId") String channelId); @Select("SELECT dc.* from wvp_platform_gb_channel pgc left join wvp_device_channel dc on dc.id = pgc.device_channel_id WHERE pgc.platform_id=#{platformId} and pgc.catalog_id=#{catalogId}") List queryAllChannelInCatalog(@Param("platformId") String platformId, @Param("catalogId") String catalogId); @Select(" select dc.channel_id as id, dc.name as name, pgc.platform_id as platform_id, pgc.catalog_id as parent_id, 0 as children_count, 1 as type " + " from wvp_device_channel dc left join wvp_platform_gb_channel pgc on dc.id = pgc.device_channel_id " + " where pgc.platform_id=#{platformId} and pgc.catalog_id=#{catalogId}") List queryChannelInParentPlatformAndCatalog(@Param("platformId") String platformId, @Param("catalogId") String catalogId); @Select("select d.*\n" + "from wvp_platform_gb_channel pgc\n" + " left join wvp_device_channel dc on dc.id = pgc.device_channel_id\n" + " left join wvp_device d on dc.device_id = d.device_id\n" + "where dc.channel_id = #{channelId} and pgc.platform_id=#{platformId}") List queryVideoDeviceByPlatformIdAndChannelId(@Param("platformId") String platformId, @Param("channelId") String channelId); @Delete("") int delByCatalogId(@Param("platformId") String platformId, @Param("id") String id); @Delete("") int delByCatalogIdAndChannelIdAndPlatformId(PlatformCatalog platformCatalog); @Select(" ") List queryPlatFormListForGBWithGBId(@Param("channelId") String channelId, @Param("platforms") List platforms); @Delete("") void delByPlatformId(String serverGBId); @Delete("") int delChannelForGBByCatalogId(@Param("platformId") String platformId, @Param("catalogId") String catalogId); @Select("select dc.channel_id dc.device_id,dc.name,d.manufacturer,d.model,d.firmware\n" + "from wvp_platform_gb_channel pgc\n" + " left join wvp_device_channel dc on dc.id = pgc.device_channel_id\n" + " left join wvp_device d on dc.device_id = d.device_id\n" + "where dc.channel_id = #{channelId} and pgc.platform_id=#{platformId}") List queryDeviceInfoByPlatformIdAndChannelId(@Param("platformId") String platformId, @Param("channelId") String channelId); @Select("SELECT pgc.platform_id from wvp_platform_gb_channel pgc left join wvp_device_channel dc on dc.id = pgc.device_channel_id WHERE dc.channel_id='${channelId}'") List queryParentPlatformByChannelId(String channelId); }