mirror of https://github.com/elunez/eladmin
refactor:delete param Long deptId of deptService.getDeptChildren (#525)
parent
11bf58688a
commit
aab6beffc0
|
@ -79,8 +79,7 @@ public class UserController {
|
||||||
public ResponseEntity<Object> query(UserQueryCriteria criteria, Pageable pageable){
|
public ResponseEntity<Object> query(UserQueryCriteria criteria, Pageable pageable){
|
||||||
if (!ObjectUtils.isEmpty(criteria.getDeptId())) {
|
if (!ObjectUtils.isEmpty(criteria.getDeptId())) {
|
||||||
criteria.getDeptIds().add(criteria.getDeptId());
|
criteria.getDeptIds().add(criteria.getDeptId());
|
||||||
criteria.getDeptIds().addAll(deptService.getDeptChildren(criteria.getDeptId(),
|
criteria.getDeptIds().addAll(deptService.getDeptChildren(deptService.findByPid(criteria.getDeptId())));
|
||||||
deptService.findByPid(criteria.getDeptId())));
|
|
||||||
}
|
}
|
||||||
// 数据权限
|
// 数据权限
|
||||||
List<Long> dataScopes = dataService.getDeptIds(userService.findByName(SecurityUtils.getCurrentUsername()));
|
List<Long> dataScopes = dataService.getDeptIds(userService.findByName(SecurityUtils.getCurrentUsername()));
|
||||||
|
|
|
@ -111,11 +111,10 @@ public interface DeptService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取
|
* 获取
|
||||||
* @param deptId
|
|
||||||
* @param deptList
|
* @param deptList
|
||||||
* @return
|
* @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());
|
deptIds.add(dept.getId());
|
||||||
List<Dept> deptChildren = deptService.findByPid(dept.getId());
|
List<Dept> deptChildren = deptService.findByPid(dept.getId());
|
||||||
if (deptChildren != null && deptChildren.size() != 0) {
|
if (deptChildren != null && deptChildren.size() != 0) {
|
||||||
deptIds.addAll(deptService.getDeptChildren(dept.getId(), deptChildren));
|
deptIds.addAll(deptService.getDeptChildren(deptChildren));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return deptIds;
|
return deptIds;
|
||||||
|
|
|
@ -172,13 +172,13 @@ public class DeptServiceImpl implements DeptService {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Long> getDeptChildren(Long deptId, List<Dept> deptList) {
|
public List<Long> getDeptChildren(List<Dept> deptList) {
|
||||||
List<Long> list = new ArrayList<>();
|
List<Long> list = new ArrayList<>();
|
||||||
deptList.forEach(dept -> {
|
deptList.forEach(dept -> {
|
||||||
if (dept!=null && dept.getEnabled()){
|
if (dept!=null && dept.getEnabled()) {
|
||||||
List<Dept> depts = deptRepository.findByPid(dept.getId());
|
List<Dept> depts = deptRepository.findByPid(dept.getId());
|
||||||
if(deptList.size() != 0){
|
if (deptList.size() != 0) {
|
||||||
list.addAll(getDeptChildren(dept.getId(), depts));
|
list.addAll(getDeptChildren(depts));
|
||||||
}
|
}
|
||||||
list.add(dept.getId());
|
list.add(dept.getId());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue