|
@@ -1,5 +1,6 @@
|
|
package cn.iocoder.yudao.module.pms.controller.admin;
|
|
package cn.iocoder.yudao.module.pms.controller.admin;
|
|
|
|
|
|
|
|
+import cn.hutool.core.collection.CollUtil;
|
|
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
|
|
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
|
|
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
|
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
|
@@ -150,4 +151,14 @@ public class IotTreeController {
|
|
list.add(map);
|
|
list.add(map);
|
|
return success(list);
|
|
return success(list);
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ @GetMapping("/device/{id}")
|
|
|
|
+ @PreAuthorize("@ss.hasPermission('rq:iot-tree:query')")
|
|
|
|
+ public CommonResult<Long> getDeviceTree(@PathVariable("id") Long deviceId) {
|
|
|
|
+ List<IotTreeDO> iotDeviceTree = iotTreeService.getIotDeviceTree(deviceId);
|
|
|
|
+ if (CollUtil.isEmpty(iotDeviceTree)) {
|
|
|
|
+ return success(null);
|
|
|
|
+ }
|
|
|
|
+ return success(iotDeviceTree.get(0).getId());
|
|
|
|
+ }
|
|
}
|
|
}
|