fix(ops): 修复 AreaDeviceController RPC 接口不支持 relationType 为空的查询

This commit is contained in:
lzh
2026-02-24 15:44:39 +08:00
parent f17d5ef6b8
commit 4babe493ab

View File

@@ -45,14 +45,21 @@ public class AreaDeviceController {
return success(BeanUtils.toBean(relations, AreaDeviceDTO.class));
}
@GetMapping("/{areaId}/devices")
@Operation(summary = "查询区域设备列表(按类型)")
public CommonResult<List<AreaDeviceDTO>> getDevicesByAreaAndType(
@PathVariable("areaId") Long areaId,
@RequestParam("relationType") String relationType) {
List<OpsAreaDeviceRelationDO> relations = areaDeviceService.listByAreaIdAndType(areaId, relationType);
return success(BeanUtils.toBean(relations, AreaDeviceDTO.class));
}
@GetMapping("/{areaId}/devices")
@Operation(summary = "查询区域设备列表(按类型)")
public CommonResult<List<AreaDeviceDTO>> getDevicesByAreaAndType(
@PathVariable("areaId") Long areaId,
@RequestParam(value = "relationType", required = false) String relationType) {
List<OpsAreaDeviceRelationDO> relations;
if (relationType != null) {
relations = areaDeviceService.listByAreaIdAndType(areaId, relationType);
} else {
relations = areaDeviceService.listByAreaId(areaId);
}
return success(BeanUtils.toBean(relations, AreaDeviceDTO.class));
}
@GetMapping("/device/{deviceId}/relation")
@Operation(summary = "查询设备的关联关系")