修复国标设备/设备列表中行政区划的子节点查看

This commit is contained in:
648540858
2024-10-22 16:27:53 +08:00
parent 1671716480
commit 4c497ef411
4 changed files with 28 additions and 12 deletions

View File

@@ -85,7 +85,10 @@ public interface DeviceChannelMapper {
int update(DeviceChannel channel);
@SelectProvider(type = DeviceChannelProvider.class, method = "queryChannels")
List<DeviceChannel> queryChannels(@Param("deviceDbId") int deviceDbId, @Param("parentChannelId") String parentChannelId, @Param("query") String query, @Param("hasSubChannel") Boolean hasSubChannel, @Param("online") Boolean online, @Param("channelIds") List<String> channelIds);
List<DeviceChannel> queryChannels(@Param("deviceDbId") int deviceDbId, @Param("civilCode") String civilCode,
@Param("parentChannelId") String parentChannelId, @Param("query") String query,
@Param("hasSubChannel") Boolean hasSubChannel, @Param("online") Boolean online,
@Param("channelIds") List<String> channelIds);
@SelectProvider(type = DeviceChannelProvider.class, method = "queryChannelsByDeviceDbId")
List<DeviceChannel> queryChannelsByDeviceDbId(@Param("deviceDbId") int deviceDbId);

View File

@@ -1,5 +1,7 @@
package com.genersoft.iot.vmp.gb28181.dao.provider;
import org.springframework.util.ObjectUtils;
import java.util.List;
import java.util.Map;
@@ -58,14 +60,18 @@ public class DeviceChannelProvider {
public String queryChannels(Map<String, Object> params ){
StringBuilder sqlBuild = new StringBuilder();
sqlBuild.append(getBaseSelectSql());
sqlBuild.append(" where dc.device_db_id = #{deviceDbId}");
if (params.get("query") != null) {
sqlBuild.append(" AND coalesce(dc.gb_device_id, dc.device_id) LIKE concat('%',#{query},'%')" +
" OR coalesce(dc.gb_name, dc.name) LIKE concat('%',#{query},'%')")
;
}
sqlBuild.append(" where dc.device_db_id = #{deviceDbId} ");
if (params.get("parentChannelId") != null ) {
sqlBuild.append(" AND (dc.parent_id=#{parentChannelId} OR coalesce(dc.gb_civil_code, dc.civil_code) = #{parentChannelId})");
sqlBuild.append(" AND coalesce(dc.gb_parent_id, dc.parent_id)=#{parentChannelId}");
}
if (params.get("civilCode") != null ) {
sqlBuild.append(" AND (coalesce(dc.gb_civil_code, dc.civil_code) = #{civilCode} " +
"OR (LENGTH(coalesce(dc.gb_device_id, dc.device_id))=LENGTH(#{civilCode}) + 2) AND coalesce(dc.gb_device_id, dc.device_id) LIKE concat(#{civilCode},'%'))");
}
if (params.get("query") != null && !ObjectUtils.isEmpty(params.get("query"))) {
sqlBuild.append(" AND (coalesce(dc.gb_device_id, dc.device_id) LIKE concat('%',#{query},'%')" +
" OR coalesce(dc.gb_name, dc.name) LIKE concat('%',#{query},'%'))")
;
}
if (params.get("online") != null && (Boolean)params.get("online")) {
sqlBuild.append(" AND coalesce(gb_status, status) = 'ON'");

View File

@@ -599,7 +599,14 @@ public class DeviceChannelServiceImpl implements IDeviceChannelService {
@Override
public PageInfo<DeviceChannel> getSubChannels(int deviceDbId, String channelId, String query, Boolean channelType, Boolean online, int page, int count) {
PageHelper.startPage(page, count);
List<DeviceChannel> all = channelMapper.queryChannels(deviceDbId, channelId, query, channelType, online,null);
String civilCode = null;
String parentId = null;
if (channelId.length() <= 8) {
civilCode = channelId;
}else {
parentId = channelId;
}
List<DeviceChannel> all = channelMapper.queryChannels(deviceDbId, civilCode, parentId, query, channelType, online,null);
return new PageInfo<>(all);
}
@@ -616,7 +623,7 @@ public class DeviceChannelServiceImpl implements IDeviceChannelService {
}
// 获取到所有正在播放的流
PageHelper.startPage(page, count);
List<DeviceChannel> all = channelMapper.queryChannels(device.getId(), null, query, hasSubChannel, online,null);
List<DeviceChannel> all = channelMapper.queryChannels(device.getId(), null,null, query, hasSubChannel, online,null);
return new PageInfo<>(all);
}