From 50435a81915932eda06b7f1afd48f9ff1ae84f19 Mon Sep 17 00:00:00 2001
From: zhangc <zc@123>
Date: 星期四, 10 四月 2025 17:50:28 +0800
Subject: [PATCH] 1
---
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