Unverified Commit aab6beff authored by 皆非's avatar 皆非 Committed by GitHub
Browse files

refactor:delete param Long deptId of deptService.getDeptChildren (#525)

parent 11bf5868
......@@ -79,8 +79,7 @@ public class UserController {
public ResponseEntity<Object> query(UserQueryCriteria criteria, Pageable pageable){
if (!ObjectUtils.isEmpty(criteria.getDeptId())) {
criteria.getDeptIds().add(criteria.getDeptId());
criteria.getDeptIds().addAll(deptService.getDeptChildren(criteria.getDeptId(),
deptService.findByPid(criteria.getDeptId())));
criteria.getDeptIds().addAll(deptService.getDeptChildren(deptService.findByPid(criteria.getDeptId())));
}
// 数据权限
List<Long> dataScopes = dataService.getDeptIds(userService.findByName(SecurityUtils.getCurrentUsername()));
......
......@@ -111,11 +111,10 @@ public interface DeptService {
/**
* 获取
* @param deptId
* @param deptList
* @return
*/
List<Long> getDeptChildren(Long deptId, List<Dept> deptList);
List<Long> getDeptChildren(List<Dept> deptList);
/**
* 验证是否被角色或用户关联
......
......@@ -83,7 +83,7 @@ public class DataServiceImpl implements DataService {
deptIds.add(dept.getId());
List<Dept> deptChildren = deptService.findByPid(dept.getId());
if (deptChildren != null && deptChildren.size() != 0) {
deptIds.addAll(deptService.getDeptChildren(dept.getId(), deptChildren));
deptIds.addAll(deptService.getDeptChildren(deptChildren));
}
}
return deptIds;
......
......@@ -172,13 +172,13 @@ public class DeptServiceImpl implements DeptService {
}
@Override
public List<Long> getDeptChildren(Long deptId, List<Dept> deptList) {
public List<Long> getDeptChildren(List<Dept> deptList) {
List<Long> list = new ArrayList<>();
deptList.forEach(dept -> {
if (dept!=null && dept.getEnabled()){
if (dept!=null && dept.getEnabled()) {
List<Dept> depts = deptRepository.findByPid(dept.getId());
if(deptList.size() != 0){
list.addAll(getDeptChildren(dept.getId(), depts));
if (deptList.size() != 0) {
list.addAll(getDeptChildren(depts));
}
list.add(dept.getId());
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment