| | |
| | | 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(); |
| | |
| | | @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); |