中扬CRM客户关系管理系统
#
luxiaotao1123
2022-11-15 65a809eede3d90cf8cd5cadcdd1b4a5c1faba46d
src/main/java/com/zy/crm/system/controller/DeptController.java
@@ -109,6 +109,17 @@
                dept.setParentName(parent.getName());
                dept.setLevel(parent.getLevel() + 1);
            }
        } else {
            dept.setUuid(dept.getName());
            List<Dept> depts = deptService.selectList(new EntityWrapper<Dept>().eq("parent_id",dept.getId()));
            for(Dept one : depts){
                one.setParentName(dept.getName());
                one.setNamePath(dept.getName());
                one.setUpdateBy(getUserId());
                one.setUpdateTime(new Date());
//                deptService.update(one,new EntityWrapper<Dept>().eq("parent_id",dept.getId()));
                deptService.updateById(one);
            }
        }
        // path
        NodeUtils nodeUtils = new NodeUtils();
@@ -172,9 +183,22 @@
    @PostMapping(value = "/dept/tree/auth")
    @ManagerAuth
    public R tree(@RequestParam(required = false, defaultValue = "") String condition) throws IOException, ClassNotFoundException {
        ArrayList<Map> tree = treeUtils.getDeptTree(String.valueOf(getDeptId()), getHostId());
        ArrayList<Map<String, Object>> tree = treeUtils.getDeptTree(String.valueOf(getDeptId()), getHostId());
        // 深拷贝
        List<Map> result = ListUtils.deepCopy(tree);
        List<Map<String, Object>> result = ListUtils.deepCopy(tree);
        if (!Cools.isEmpty(condition)) {
            treeUtils.remove(condition, result);
            treeUtils.remove(condition, result);
        }
        return R.ok(result);
    }
    @PostMapping(value = "/dept/user/tree/auth")
    @ManagerAuth
    public R deptUserTree(@RequestParam(required = false, defaultValue = "") String condition) throws IOException, ClassNotFoundException {
        ArrayList<Map<String, Object>> tree = treeUtils.getDeptUserTree(String.valueOf(getDeptId()), getHostId(), getUserId());
        // 深拷贝
        List<Map<String, Object>> result = ListUtils.deepCopy(tree);
        if (!Cools.isEmpty(condition)) {
            treeUtils.remove(condition, result);
            treeUtils.remove(condition, result);