Merge remote-tracking branch 'gitee.com/wvp-28181-2.0' into wvp-28181-2.0

This commit is contained in:
648540858
2023-01-04 10:41:17 +08:00
8 changed files with 48 additions and 30 deletions

View File

@@ -59,7 +59,7 @@ public interface IVideoManagerStorage {
*/
public PageInfo queryChannelsByDeviceId(String deviceId, String query, Boolean hasSubChannel, Boolean online, Boolean catalogUnderDevice, int page, int count);
public List<DeviceChannel> queryChannelsByDeviceIdWithStartAndLimit(String deviceId, String query, Boolean hasSubChannel, Boolean online, int start, int limit);
public List<DeviceChannel> queryChannelsByDeviceIdWithStartAndLimit(String deviceId, String query, Boolean hasSubChannel, Boolean online, int start, int limit,List<String> channelIds);
/**
@@ -68,7 +68,7 @@ public interface IVideoManagerStorage {
* @param deviceId 设备ID
* @return
*/
public List<DeviceChannel> queryChannelsByDeviceId(String deviceId);
public List<DeviceChannel> queryChannelsByDeviceId(String deviceId,Boolean online,List<String> channelIds);
public List<DeviceChannel> queryOnlineChannelsByDeviceId(String deviceId);
/**
@@ -91,14 +91,14 @@ public interface IVideoManagerStorage {
* @param count 每页数量
* @return List<Device> 设备对象数组
*/
public PageInfo<Device> queryVideoDeviceList(int page, int count);
public PageInfo<Device> queryVideoDeviceList(int page, int count,Boolean online);
/**
* 获取多个设备
*
* @return List<Device> 设备对象数组
*/
public List<Device> queryVideoDeviceList();
public List<Device> queryVideoDeviceList(Boolean online);

View File

@@ -76,9 +76,12 @@ public interface DeviceChannelMapper {
" <if test='online == false' > AND dc.status=0</if>" +
" <if test='hasSubChannel == true' > AND dc.subCount > 0 </if>" +
" <if test='hasSubChannel == false' > AND dc.subCount = 0 </if>" +
"<if test='channelIds != null'> AND dc.channelId in <foreach item='item' index='index' collection='channelIds' open='(' separator=',' close=')'>" +
"#{item} " +
"</foreach> </if>" +
"ORDER BY dc.channelId " +
" </script>"})
List<DeviceChannel> queryChannels(String deviceId, String parentChannelId, String query, Boolean hasSubChannel, Boolean online);
List<DeviceChannel> queryChannels(String deviceId, String parentChannelId, String query, Boolean hasSubChannel, Boolean online,List<String> channelIds);
@Select("SELECT * FROM device_channel WHERE deviceId=#{deviceId} AND channelId=#{channelId}")
DeviceChannel queryChannel(String deviceId, String channelId);
@@ -254,11 +257,14 @@ public interface DeviceChannelMapper {
" <if test='online == false' > AND dc1.status=0</if>" +
" <if test='hasSubChannel == true' > AND dc1.subCount >0</if>" +
" <if test='hasSubChannel == false' > AND dc1.subCount=0</if>" +
"<if test='channelIds != null'> AND dc1.channelId in <foreach item='item' index='index' collection='channelIds' open='(' separator=',' close=')'>" +
"#{item} " +
"</foreach> </if>" +
"ORDER BY dc1.channelId ASC " +
"Limit #{limit} OFFSET #{start}" +
" </script>"})
List<DeviceChannel> queryChannelsByDeviceIdWithStartAndLimit(String deviceId, String parentChannelId, String query,
Boolean hasSubChannel, Boolean online, int start, int limit);
Boolean hasSubChannel, Boolean online, int start, int limit,List<String> channelIds);
@Select("SELECT * FROM device_channel WHERE deviceId=#{deviceId} AND status=1")
List<DeviceChannel> queryOnlineChannelsByDeviceId(String deviceId);

View File

@@ -125,7 +125,9 @@ public interface DeviceMapper {
" </script>"})
int update(Device device);
@Select("SELECT " +
@Select(
" <script>" +
"SELECT " +
"deviceId, " +
"coalesce(custom_name, name) as name, " +
"password, " +
@@ -153,8 +155,11 @@ public interface DeviceMapper {
"geoCoordSys," +
"treeType," +
"online," +
"(SELECT count(0) FROM device_channel WHERE deviceId=de.deviceId) as channelCount FROM device de")
List<Device> getDevices();
"(SELECT count(0) FROM device_channel WHERE deviceId=de.deviceId) as channelCount FROM device de" +
"<if test=\"online != null\"> where online=${online}</if>"+
" </script>"
)
List<Device> getDevices(Boolean online);
@Delete("DELETE FROM device WHERE deviceId=#{deviceId}")
int del(String deviceId);

View File

@@ -231,31 +231,31 @@ public class VideoManagerStorageImpl implements IVideoManagerStorage {
PageHelper.startPage(page, count);
List<DeviceChannel> all;
if (catalogUnderDevice != null && catalogUnderDevice) {
all = deviceChannelMapper.queryChannels(deviceId, deviceId, query, hasSubChannel, online);
all = deviceChannelMapper.queryChannels(deviceId, deviceId, query, hasSubChannel, online,null);
// 海康设备的parentId是SIP id
List<DeviceChannel> deviceChannels = deviceChannelMapper.queryChannels(deviceId, sipConfig.getId(), query, hasSubChannel, online);
List<DeviceChannel> deviceChannels = deviceChannelMapper.queryChannels(deviceId, sipConfig.getId(), query, hasSubChannel, online,null);
all.addAll(deviceChannels);
}else {
all = deviceChannelMapper.queryChannels(deviceId, null, query, hasSubChannel, online);
all = deviceChannelMapper.queryChannels(deviceId, null, query, hasSubChannel, online,null);
}
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);
public List<DeviceChannel> queryChannelsByDeviceIdWithStartAndLimit(String deviceId, String query, Boolean hasSubChannel, Boolean online, int start, int limit,List<String> channelIds) {
return deviceChannelMapper.queryChannelsByDeviceIdWithStartAndLimit(deviceId, null, query, hasSubChannel, online, start, limit,channelIds);
}
@Override
public List<DeviceChannel> queryChannelsByDeviceId(String deviceId) {
return deviceChannelMapper.queryChannels(deviceId, null,null, null, null);
public List<DeviceChannel> queryChannelsByDeviceId(String deviceId,Boolean online,List<String> channelIds) {
return deviceChannelMapper.queryChannels(deviceId, null,null, null, online,channelIds);
}
@Override
public PageInfo<DeviceChannel> querySubChannels(String deviceId, String parentChannelId, String query, Boolean hasSubChannel, Boolean online, int page, int count) {
PageHelper.startPage(page, count);
List<DeviceChannel> all = deviceChannelMapper.queryChannels(deviceId, parentChannelId, query, hasSubChannel, online);
List<DeviceChannel> all = deviceChannelMapper.queryChannels(deviceId, parentChannelId, query, hasSubChannel, online,null);
return new PageInfo<>(all);
}
@@ -278,9 +278,9 @@ public class VideoManagerStorageImpl implements IVideoManagerStorage {
* @return PageInfo<Device> 分页设备对象数组
*/
@Override
public PageInfo<Device> queryVideoDeviceList(int page, int count) {
public PageInfo<Device> queryVideoDeviceList(int page, int count,Boolean online) {
PageHelper.startPage(page, count);
List<Device> all = deviceMapper.getDevices();
List<Device> all = deviceMapper.getDevices(online);
return new PageInfo<>(all);
}
@@ -290,9 +290,9 @@ public class VideoManagerStorageImpl implements IVideoManagerStorage {
* @return List<Device> 设备对象数组
*/
@Override
public List<Device> queryVideoDeviceList() {
public List<Device> queryVideoDeviceList(Boolean online) {
List<Device> deviceList = deviceMapper.getDevices();
List<Device> deviceList = deviceMapper.getDevices(online);
return deviceList;
}