#
luxiaotao1123
2024-02-28 b016d1eb02dd09fd1ffcd24e4e6ddee72fd1b3d6
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/system/controller/DeptController.java
@@ -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 = Utils.toTreeData(deptList, 0L, Dept::getParentId, Dept::getId, Dept::setChildren);
        if (!Cools.isEmpty(map.get("condition"))) {
            Utils.treeRemove(treeData, String.valueOf(map.get("condition")), Dept::getName, Dept::getChildren);
            Utils.treeRemove(treeData, String.valueOf(map.get("condition")), Dept::getName, Dept::getChildren);
        }
        return R.ok().add(treeData);
    }
    @PreAuthorize("hasAuthority('system:dept:list')")