From 8ef2bb5e46d84594e6ed632c07ea0b47a1bf6c4d Mon Sep 17 00:00:00 2001 From: Junjie <540245094@qq.com> Date: 星期三, 11 十二月 2024 16:15:17 +0800 Subject: [PATCH] #path similarity --- zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/system/controller/DeptController.java | 14 ++++++++++---- 1 files changed, 10 insertions(+), 4 deletions(-) diff --git a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/system/controller/DeptController.java b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/system/controller/DeptController.java index f138f48..ce5718c 100644 --- a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/system/controller/DeptController.java +++ b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/system/controller/DeptController.java @@ -12,7 +12,7 @@ import com.zy.asrs.wcs.system.service.DeptService; import com.zy.asrs.wcs.utils.ExcelUtil; import com.zy.asrs.wcs.utils.NodeUtils; -import com.zy.asrs.wcs.utils.Utils; +import com.zy.asrs.wcs.utils.CommonUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.web.bind.annotation.*; @@ -44,9 +44,15 @@ @PreAuthorize("hasAuthority('system:dept:list')") @PostMapping("/dept/tree") public R tree(@RequestBody Map<String, Object> map) { - PageParam<Dept, BaseParam> param = new PageParam<>(buildParam(map, BaseParam.class), Dept.class); - List<Dept> deptList = deptService.list(param.buildWrapper(true)); - return R.ok().add(Utils.toTreeData(deptList, 0L, Dept::getParentId, Dept::getId, Dept::setChildren)); +// PageParam<Dept, BaseParam> param = new PageParam<>(buildParam(map, BaseParam.class), Dept.class); +// QueryWrapper<Dept> wrapper = param.buildWrapper(true, queryWrapper -> queryWrapper.orderByAsc("sort")); + List<Dept> deptList = deptService.list(new LambdaQueryWrapper<Dept>().orderByAsc(Dept::getSort)); + List<Dept> treeData = CommonUtils.toTreeData(deptList, 0L, Dept::getParentId, Dept::getId, Dept::setChildren); + if (!Cools.isEmpty(map.get("condition"))) { + CommonUtils.treeRemove(treeData, String.valueOf(map.get("condition")), Dept::getName, Dept::getChildren); + CommonUtils.treeRemove(treeData, String.valueOf(map.get("condition")), Dept::getName, Dept::getChildren); + } + return R.ok().add(treeData); } @PreAuthorize("hasAuthority('system:dept:list')") -- Gitblit v1.9.1