diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/controller/HwMonitorPlatformController.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/controller/HwMonitorPlatformController.java index e170d66..e825b7f 100644 --- a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/controller/HwMonitorPlatformController.java +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/controller/HwMonitorPlatformController.java @@ -52,7 +52,9 @@ public class HwMonitorPlatformController extends BaseController { * @throws * */ @GetMapping("/treeList") - public TableDataInfo treeList(@RequestBody List hwMonitorUnits){ + public TableDataInfo treeList(){ + HwMonitorUnit hwMonitorUnit = new HwMonitorUnit(); + List hwMonitorUnits = hwMonitorUnitService.selectHwMonitorUnitList(hwMonitorUnit); List list = hwMonitorUnitService.selectTreeList(hwMonitorUnits); return getDataTable(list); diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/impl/HwMonitorUnitServiceImpl.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/impl/HwMonitorUnitServiceImpl.java index c7c5784..be57e45 100644 --- a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/impl/HwMonitorUnitServiceImpl.java +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/impl/HwMonitorUnitServiceImpl.java @@ -280,14 +280,18 @@ public class HwMonitorUnitServiceImpl implements IHwMonitorUnitService public List selectTreeList(List hwMonitorUnits) { List returnList = new ArrayList<>(); List tempList = hwMonitorUnits.stream().map(HwMonitorUnit::getMonitorUnitId).collect(Collectors.toList()); - + List treeList = new ArrayList<>(); for (HwMonitorUnit hwMonitorUnit:hwMonitorUnits){ if (!tempList.contains(hwMonitorUnit.getParentId())) recursionFn(hwMonitorUnits,hwMonitorUnit); returnList.add(hwMonitorUnit); } - - return returnList; + for (int i = 0; i < returnList.size(); i++){ + if (returnList.get(i).getParentId()==null){ + treeList.add(returnList.get(i)); + } + } + return treeList; } private void recursionFn(List list, HwMonitorUnit t) {