fix(channel): 解决设备通道按通道类型筛选不准确的问题
区分通道是否是设备应该按 parental 字段而不是 sub_count, 因为部分子目录没有设备pull/911/head
parent
524b0f1b43
commit
a9e58a6af5
|
@ -57,7 +57,7 @@ public interface IVideoManagerStorage {
|
||||||
* @param count 每页数量
|
* @param count 每页数量
|
||||||
* @return
|
* @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);
|
public List<DeviceChannelExtend> queryChannelsByDeviceIdWithStartAndLimit(String deviceId, List<String> channelIds, String query, Boolean hasSubChannel, Boolean online, int start, int limit);
|
||||||
|
|
||||||
|
|
|
@ -67,22 +67,21 @@ public interface DeviceChannelMapper {
|
||||||
@Select(value = {" <script>" +
|
@Select(value = {" <script>" +
|
||||||
"SELECT " +
|
"SELECT " +
|
||||||
"dc.* " +
|
"dc.* " +
|
||||||
"from " +
|
"FROM " +
|
||||||
"wvp_device_channel dc " +
|
"wvp_device_channel dc " +
|
||||||
"WHERE " +
|
"WHERE " +
|
||||||
"dc.device_id = #{deviceId} " +
|
"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='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 != null' > AND dc.status = #{online}</if>" +
|
||||||
" <if test='online == false' > AND dc.status= false</if>" +
|
"<if test='channelType == true' > AND dc.parental = 1 </if>" +
|
||||||
" <if test='hasSubChannel == true' > AND dc.sub_count > 0 </if>" +
|
"<if test='channelType == false' > AND dc.parental = 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='channelIds != null'> AND dc.channel_id in <foreach item='item' index='index' collection='channelIds' open='(' separator=',' close=')'>" +
|
"#{item}" +
|
||||||
"#{item} " +
|
|
||||||
"</foreach> </if>" +
|
"</foreach> </if>" +
|
||||||
"ORDER BY dc.channel_id " +
|
"ORDER BY dc.channel_id " +
|
||||||
" </script>"})
|
"</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(value = {" <script>" +
|
||||||
"SELECT " +
|
"SELECT " +
|
||||||
|
|
|
@ -378,17 +378,17 @@ public class VideoManagerStorageImpl implements IVideoManagerStorage {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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);
|
PageHelper.startPage(page, count);
|
||||||
List<DeviceChannel> all;
|
List<DeviceChannel> all;
|
||||||
if (catalogUnderDevice != null && catalogUnderDevice) {
|
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
|
// 海康设备的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);
|
all.addAll(deviceChannels);
|
||||||
}else {
|
}else {
|
||||||
all = deviceChannelMapper.queryChannels(deviceId, null, query, hasSubChannel, online,null);
|
all = deviceChannelMapper.queryChannels(deviceId, null, query, channelType, online,null);
|
||||||
}
|
}
|
||||||
return new PageInfo<>(all);
|
return new PageInfo<>(all);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue