优化区域树

结构优化
648540858 2023-11-17 17:59:14 +08:00
parent b96c9317e8
commit cbc0ca91b1
5 changed files with 29 additions and 5 deletions

View File

@ -20,7 +20,7 @@ public interface IRegionService {
/** /**
* *
*/ */
PageInfo<Region> queryChildGroupList(String regionParentId, int page, int count); PageInfo<Region> queryChildRegionList(String regionParentId, int page, int count);
/** /**
* *
@ -28,4 +28,6 @@ public interface IRegionService {
void update(Region region); void update(Region region);
List<Region> getAllChild(String parent); List<Region> getAllChild(String parent);
Region queryRegionByDeviceId(String regionDeviceId);
} }

View File

@ -445,7 +445,8 @@ public class PlayServiceImpl implements IPlayService {
String endTime, ErrorCallback<Object> callback) { String endTime, ErrorCallback<Object> callback) {
Device device = storager.queryVideoDevice(deviceId); Device device = storager.queryVideoDevice(deviceId);
if (device == null) { if (device == null) {
logger.warn("[录像回放] 未找到设备 deviceId: {},channelId:{}", deviceId, channelId); logger.warn("[录像回放] 未找到设备 deviceId: {}, channelId:{},startTime:{}, endTime:{}",
deviceId, channelId, startTime, endTime);
throw new ControllerException(ErrorCode.ERROR100.getCode(), "未找到设备:" + deviceId); throw new ControllerException(ErrorCode.ERROR100.getCode(), "未找到设备:" + deviceId);
} }

View File

@ -87,7 +87,7 @@ public class RegionServiceImpl implements IRegionService {
} }
@Override @Override
public PageInfo<Region> queryChildGroupList(String regionParentId, int page, int count) { public PageInfo<Region> queryChildRegionList(String regionParentId, int page, int count) {
assert regionParentId != null; assert regionParentId != null;
PageHelper.startPage(page, count); PageHelper.startPage(page, count);
List<Region> all = regionMapper.getChildren(regionParentId); List<Region> all = regionMapper.getChildren(regionParentId);
@ -130,4 +130,9 @@ public class RegionServiceImpl implements IRegionService {
Collections.sort(allChild); Collections.sort(allChild);
return allChild; return allChild;
} }
@Override
public Region queryRegionByDeviceId(String regionDeviceId) {
return regionMapper.queryRegionByDeviceId(regionDeviceId);
}
} }

View File

@ -116,4 +116,7 @@ public interface RegionMapper {
"<foreach collection='regionList' item='item' open='(' separator=',' close=')' > #{item.commonRegionId}</foreach>" + "<foreach collection='regionList' item='item' open='(' separator=',' close=')' > #{item.commonRegionId}</foreach>" +
"</script>") "</script>")
void removeRegionByList(@Param("regionList") List<Region> regionList); void removeRegionByList(@Param("regionList") List<Region> regionList);
@Select("select * from wvp_common_region where common_region_device_id = #{regionDeviceId}")
Region queryRegionByDeviceId(@Param("regionDeviceId") String regionDeviceId);
} }

View File

@ -75,7 +75,7 @@ public class RegionController {
@Parameter(name = "count", description = "每页查询数量", required = true) @Parameter(name = "count", description = "每页查询数量", required = true)
@ResponseBody @ResponseBody
@GetMapping("/child/list") @GetMapping("/child/list")
public PageInfo<Region> queryChildGroupList( public PageInfo<Region> queryChildRegionList(
@RequestParam(required = true) String regionParentId, @RequestParam(required = true) String regionParentId,
@RequestParam(required = true) int page, @RequestParam(required = true) int page,
@RequestParam(required = true) int count @RequestParam(required = true) int count
@ -83,7 +83,20 @@ public class RegionController {
if (ObjectUtils.isEmpty(regionParentId.trim())) { if (ObjectUtils.isEmpty(regionParentId.trim())) {
regionParentId = null; regionParentId = null;
} }
return regionService.queryChildGroupList(regionParentId, page, count); return regionService.queryChildRegionList(regionParentId, page, count);
}
@Operation(summary = "根据区域Id查询区域")
@Parameter(name = "regionDeviceId", description = "行政区划节点编号", required = true)
@ResponseBody
@GetMapping("/one")
public Region queryRegionByDeviceId(
@RequestParam(required = true) String regionDeviceId
){
if (ObjectUtils.isEmpty(regionDeviceId.trim())) {
throw new ControllerException(ErrorCode.ERROR400);
}
return regionService.queryRegionByDeviceId(regionDeviceId);
} }
@Operation(summary = "获取所属的行政区划下的行政区划") @Operation(summary = "获取所属的行政区划下的行政区划")