Переглянути джерело

修改只能获取本部门下的用户,不包含子部门

wukai 2 роки тому
батько
коміт
19f43ebd8c

+ 8 - 8
doc-admin/src/main/java/com/doc/web/controller/system/SysUserController.java

@@ -31,9 +31,7 @@ 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;
 
 /**
@@ -99,12 +97,14 @@ public class SysUserController extends BaseController {
     @GetMapping("/tree4dept")
     public UserTreeVO tree4dept() {
         SysDept dept = new SysDept();
-        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);
+//        注释掉这一段 是查询本部门及下级子部门用的
+//        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);
+        dept.setDeptId(SecurityUtils.getDeptId());
         List<SysDept> deptList = deptService.selectDeptChildrenList(dept);
         List<SysDept> list = deptService.buildDeptTree(deptList);
         SysDept tree = list.get(0);