From cef22f82877bdfedcfbdfdb7b899e612a23bc140 Mon Sep 17 00:00:00 2001 From: zhouhy Date: Thu, 14 Sep 2023 16:13:28 +0800 Subject: [PATCH] =?UTF-8?q?1.1.3=20=E7=9B=91=E6=8E=A7=E5=8D=95=E5=85=83Con?= =?UTF-8?q?troller=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/HwMonitorPlatformController.java | 4 +++- .../service/impl/HwMonitorUnitServiceImpl.java | 10 +++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) 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) {