fix(channel): 解决设备通道按通道类型筛选不准确的问题

区分通道是否是设备应该按 parental 字段而不是 sub_count, 因为部分子目录没有设备
pull/911/head^2
xiaoQQya 2023-06-15 10:47:32 +08:00
parent fb6bdce283
commit 450b867e2e
3 changed files with 15 additions and 16 deletions

View File

@ -57,7 +57,7 @@ public interface IVideoManagerStorage {
* @param count
* @return
*/
public PageInfo<DeviceChannel> queryChannelsByDeviceId(String deviceId, String query, Boolean hasSubChannel, Boolean online, Boolean catalogUnderDevice, int page, int count);
public PageInfo<DeviceChannel> queryChannelsByDeviceId(String deviceId, String query, Boolean channelType, Boolean online, Boolean catalogUnderDevice, int page, int count);
public List<DeviceChannelExtend> queryChannelsByDeviceIdWithStartAndLimit(String deviceId, List<String> channelIds, String query, Boolean hasSubChannel, Boolean online, int start, int limit);

View File

@ -67,22 +67,21 @@ public interface DeviceChannelMapper {
@Select(value = {" <script>" +
"SELECT " +
"dc.* " +
"from " +
"FROM " +
"wvp_device_channel dc " +
"WHERE " +
"dc.device_id = #{deviceId} " +
" <if test='query != null'> AND (dc.channel_id LIKE concat('%',#{query},'%') OR dc.name LIKE concat('%',#{query},'%') OR dc.name LIKE concat('%',#{query},'%'))</if> " +
"<if test='query != null'> AND (dc.channel_id LIKE concat('%', #{query}, '%') OR dc.name LIKE concat('%', #{query}, '%'))</if>" +
"<if test='parentChannelId != null'> AND (dc.parent_id = #{parentChannelId} OR dc.civil_code = #{parentChannelId})</if>" +
" <if test='online == true' > AND dc.status= true</if>" +
" <if test='online == false' > AND dc.status= false</if>" +
" <if test='hasSubChannel == true' > AND dc.sub_count > 0 </if>" +
" <if test='hasSubChannel == false' > AND dc.sub_count = 0 </if>" +
"<if test='channelIds != null'> AND dc.channel_id in <foreach item='item' index='index' collection='channelIds' open='(' separator=',' close=')'>" +
"<if test='online != null' > AND dc.status = #{online}</if>" +
"<if test='channelType == true' > AND dc.parental = 1 </if>" +
"<if test='channelType == false' > AND dc.parental = 0 </if>" +
"<if test='channelIds != null'> AND dc.channel_id IN <foreach item='item' INDEX='index' collection='channelIds' OPEN='(' separator=',' CLOSE=')'>" +
"#{item}" +
"</foreach> </if>" +
"ORDER BY dc.channel_id " +
"</script>"})
List<DeviceChannel> queryChannels(String deviceId, String parentChannelId, String query, Boolean hasSubChannel, Boolean online, List<String> channelIds);
List<DeviceChannel> queryChannels(String deviceId, String parentChannelId, String query, Boolean channelType, Boolean online, List<String> channelIds);
@Select(value = {" <script>" +
"SELECT " +

View File

@ -373,17 +373,17 @@ public class VideoManagerStorageImpl implements IVideoManagerStorage {
}
@Override
public PageInfo queryChannelsByDeviceId(String deviceId, String query, Boolean hasSubChannel, Boolean online, Boolean catalogUnderDevice, int page, int count) {
public PageInfo queryChannelsByDeviceId(String deviceId, String query, Boolean channelType, Boolean online, Boolean catalogUnderDevice, int page, int count) {
// 获取到所有正在播放的流
PageHelper.startPage(page, count);
List<DeviceChannel> all;
if (catalogUnderDevice != null && catalogUnderDevice) {
all = deviceChannelMapper.queryChannels(deviceId, deviceId, query, hasSubChannel, online,null);
all = deviceChannelMapper.queryChannels(deviceId, deviceId, query, channelType, online,null);
// 海康设备的parentId是SIP id
List<DeviceChannel> deviceChannels = deviceChannelMapper.queryChannels(deviceId, sipConfig.getId(), query, hasSubChannel, online,null);
List<DeviceChannel> deviceChannels = deviceChannelMapper.queryChannels(deviceId, sipConfig.getId(), query, channelType, online,null);
all.addAll(deviceChannels);
}else {
all = deviceChannelMapper.queryChannels(deviceId, null, query, hasSubChannel, online,null);
all = deviceChannelMapper.queryChannels(deviceId, null, query, channelType, online,null);
}
return new PageInfo<>(all);
}