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.Select;
import org.springframework.stereotype.Repository;
import java.util.List;
@Mapper
@Repository
public interface PlatformChannelMapper {
/**
* 查询列表里已经关联的
*/
@Select("")
List findChannelRelatedPlatform(String platformId, List channelReduces);
@Insert("")
int addChannels(String platformId, List channelReducesToAdd);
@Delete("")
int delChannelForGB(String platformId, List channelReducesToDel);
@Delete("")
int delChannelForDeviceId(String deviceId);
@Delete("")
int cleanChannelForGB(String platformId);
@Select("SELECT dc.* FROM platform_gb_channel pgc left join device_channel dc on dc.id = pgc.deviceChannelId WHERE dc.channelId='${channelId}' and pgc.platformId='${platformId}'")
List queryChannelInParentPlatform(String platformId, String channelId);
@Select(" select dc.channelId as id, dc.name as name, pgc.platformId as platformId, pgc.catalogId as parentId, 0 as childrenCount, 1 as type " +
" from device_channel dc left join platform_gb_channel pgc on dc.id = pgc.deviceChannelId " +
" where pgc.platformId=#{platformId} and pgc.catalogId=#{catalogId}")
List queryChannelInParentPlatformAndCatalog(String platformId, String catalogId);
@Select("select d.*\n" +
"from platform_gb_channel pgc\n" +
" left join device_channel dc on dc.id = pgc.deviceChannelId\n" +
" left join device d on dc.deviceId = d.deviceId\n" +
"where dc.channelId = #{channelId} and pgc.platformId=#{platformId}")
List queryVideoDeviceByPlatformIdAndChannelId(String platformId, String channelId);
@Delete("")
int delByCatalogId(String id);
@Delete("")
int delByCatalogIdAndChannelIdAndPlatformId(PlatformCatalog platformCatalog);
@Select(" ")
List queryPlatFormListForGBWithGBId(String channelId, List platforms);
@Delete("")
void delByPlatformId(String serverGBId);
}