|
@@ -31,7 +31,9 @@ import org.springframework.web.multipart.MultipartFile;
|
|
|
import javax.annotation.Resource;
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
import java.util.ArrayList;
|
|
|
+import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
@@ -97,8 +99,13 @@ public class SysUserController extends BaseController {
|
|
|
@GetMapping("/tree4dept")
|
|
|
public UserTreeVO tree4dept() {
|
|
|
SysDept dept = new SysDept();
|
|
|
- dept.setDeptId(SecurityUtils.getDeptId());
|
|
|
- List<SysDept> deptList = deptService.selectDeptList(dept);
|
|
|
+ Map<String, Object> params = new HashMap<>(3);
|
|
|
+ String dataScope = StringUtils.format(
|
|
|
+ " AND {}.dept_id IN ( SELECT dept_id FROM sys_dept WHERE dept_id = {} or find_in_set( {} , ancestors ) )",
|
|
|
+ "d", SecurityUtils.getDeptId(), SecurityUtils.getDeptId());
|
|
|
+ params.put("dataScope", dataScope);
|
|
|
+ dept.setParams(params);
|
|
|
+ List<SysDept> deptList = deptService.selectDeptChildrenList(dept);
|
|
|
List<SysDept> list = deptService.buildDeptTree(deptList);
|
|
|
SysDept tree = list.get(0);
|
|
|
return getChildren(tree);
|