|
|
@@ -1,5 +1,6 @@
|
|
|
package com.ydtech.modules.admin.controller;
|
|
|
|
|
|
+import cn.hutool.core.collection.CollUtil;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.ydtech.config.MasterPasswordConfig;
|
|
|
import com.ydtech.constants.sys.SysPasswordEnum;
|
|
|
@@ -101,9 +102,25 @@ public class SysDeptController extends BaseController {
|
|
|
List<SysDept> list = sysDeptService.findTree(null,null);
|
|
|
deptAll.addAll(list);
|
|
|
}
|
|
|
+ // 递归组装前端需要的数据
|
|
|
+ for (SysDept sysDept : deptAll) {
|
|
|
+ sysDept.setName(sysDept.getName() + "--" + sysDept.getId());
|
|
|
+ showEdit(sysDept);
|
|
|
+ }
|
|
|
return HttpResult.ok(deptAll);
|
|
|
}
|
|
|
|
|
|
+ public void showEdit(SysDept sysDept) {
|
|
|
+ if (ObjectUtils.isNotEmpty(sysDept.getChildren())) {
|
|
|
+ List<SysDept> childrenList = sysDept.getChildren();
|
|
|
+ if (CollUtil.isNotEmpty(childrenList)){
|
|
|
+ for (SysDept dept : childrenList) {
|
|
|
+ dept.setName(dept.getName() + "--" + dept.getId());
|
|
|
+ showEdit(dept);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
// @PreAuthorize("hasAuthority('sys:dept:edit')")
|
|
|
@PostMapping(value = "/edit")
|
|
|
public HttpResult edit(@RequestBody SysDept record) {
|