修复兼容接口查询通道列表查询
parent
a4c93cf613
commit
7241e0d2d2
|
@ -90,6 +90,8 @@ public interface IVideoManagerStorager {
|
|||
*/
|
||||
public PageInfo queryChannelsByDeviceId(String deviceId, String query, Boolean hasSubChannel, Boolean online, int page, int count);
|
||||
|
||||
public List<DeviceChannel> queryChannelsByDeviceIdWithStartAndLimit(String deviceId, String query, Boolean hasSubChannel, Boolean online, int start, int limit);
|
||||
|
||||
/**
|
||||
* 获取某个设备的通道列表
|
||||
*
|
||||
|
|
|
@ -168,4 +168,20 @@ public interface DeviceChannelMapper {
|
|||
"</foreach>" +
|
||||
"</script>"})
|
||||
void batchUpdate(List<DeviceChannel> updateChannels);
|
||||
|
||||
@Select(value = {" <script>" +
|
||||
"SELECT * FROM ( "+
|
||||
" SELECT * , (SELECT count(0) FROM device_channel WHERE parentId=dc.channelId) as subCount FROM device_channel dc " +
|
||||
" WHERE dc.deviceId=#{deviceId} " +
|
||||
" <if test='query != null'> AND (dc.channelId LIKE '%${query}%' OR dc.name LIKE '%${query}%' OR dc.name LIKE '%${query}%')</if> " +
|
||||
" <if test='parentChannelId != null'> AND dc.parentId=#{parentChannelId} </if> " +
|
||||
" <if test='online == true' > AND dc.status=1</if>" +
|
||||
" <if test='online == false' > AND dc.status=0</if>) dcr" +
|
||||
" WHERE 1=1 " +
|
||||
" <if test='hasSubChannel == true' > AND subCount >0</if>" +
|
||||
" <if test='hasSubChannel == false' > AND subCount=0</if>" +
|
||||
" ORDER BY channelId ASC" +
|
||||
" LIMIT #{limit} OFFSET #{start}" +
|
||||
" </script>"})
|
||||
List<DeviceChannel> queryChannelsByDeviceIdWithStartAndLimit(String deviceId, String parentChannelId, String query, Boolean hasSubChannel, Boolean online, int start, int limit);
|
||||
}
|
||||
|
|
|
@ -258,6 +258,11 @@ public class VideoManagerStoragerImpl implements IVideoManagerStorager {
|
|||
return new PageInfo<>(all);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DeviceChannel> queryChannelsByDeviceIdWithStartAndLimit(String deviceId, String query, Boolean hasSubChannel, Boolean online, int start, int limit) {
|
||||
return deviceChannelMapper.queryChannelsByDeviceIdWithStartAndLimit(deviceId, null, query, hasSubChannel, online, start, limit);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DeviceChannel> queryChannelsByDeviceId(String deviceId) {
|
||||
return deviceChannelMapper.queryChannels(deviceId, null,null, null, null);
|
||||
|
|
|
@ -110,14 +110,14 @@ public class ApiDeviceController {
|
|||
return result;
|
||||
}
|
||||
List<DeviceChannel> deviceChannels;
|
||||
List<DeviceChannel> allDeviceChannelList = storager.queryChannelsByDeviceId(serial);
|
||||
if (start == null || limit ==null) {
|
||||
deviceChannels = storager.queryChannelsByDeviceId(serial);
|
||||
deviceChannels = allDeviceChannelList;
|
||||
result.put("ChannelCount", deviceChannels.size());
|
||||
}else {
|
||||
start ++;
|
||||
PageInfo pageResult = storager.queryChannelsByDeviceId(serial, null, null, null,start, limit);
|
||||
result.put("ChannelCount", pageResult.getList().size());
|
||||
deviceChannels = pageResult.getList();
|
||||
deviceChannels = storager.queryChannelsByDeviceIdWithStartAndLimit(serial, null, null, null,start, limit);
|
||||
int total = allDeviceChannelList.size();
|
||||
result.put("ChannelCount", total);
|
||||
}
|
||||
|
||||
JSONArray channleJSONList = new JSONArray();
|
||||
|
|
Loading…
Reference in New Issue