Skip to content

Commit aab6bef

Browse files
authored
refactor:delete param Long deptId of deptService.getDeptChildren (elunez#525)
1 parent 11bf586 commit aab6bef

4 files changed

Lines changed: 7 additions & 9 deletions

File tree

eladmin-system/src/main/java/me/zhengjie/modules/system/rest/UserController.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,7 @@ public void download(HttpServletResponse response, UserQueryCriteria criteria) t
7979
public ResponseEntity<Object> query(UserQueryCriteria criteria, Pageable pageable){
8080
if (!ObjectUtils.isEmpty(criteria.getDeptId())) {
8181
criteria.getDeptIds().add(criteria.getDeptId());
82-
criteria.getDeptIds().addAll(deptService.getDeptChildren(criteria.getDeptId(),
83-
deptService.findByPid(criteria.getDeptId())));
82+
criteria.getDeptIds().addAll(deptService.getDeptChildren(deptService.findByPid(criteria.getDeptId())));
8483
}
8584
// 数据权限
8685
List<Long> dataScopes = dataService.getDeptIds(userService.findByName(SecurityUtils.getCurrentUsername()));

eladmin-system/src/main/java/me/zhengjie/modules/system/service/DeptService.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,11 +111,10 @@ public interface DeptService {
111111

112112
/**
113113
* 获取
114-
* @param deptId
115114
* @param deptList
116115
* @return
117116
*/
118-
List<Long> getDeptChildren(Long deptId, List<Dept> deptList);
117+
List<Long> getDeptChildren(List<Dept> deptList);
119118

120119
/**
121120
* 验证是否被角色或用户关联

eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/DataServiceImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ public Set<Long> getCustomize(Set<Long> deptIds, RoleSmallDto role){
8383
deptIds.add(dept.getId());
8484
List<Dept> deptChildren = deptService.findByPid(dept.getId());
8585
if (deptChildren != null && deptChildren.size() != 0) {
86-
deptIds.addAll(deptService.getDeptChildren(dept.getId(), deptChildren));
86+
deptIds.addAll(deptService.getDeptChildren(deptChildren));
8787
}
8888
}
8989
return deptIds;

eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/DeptServiceImpl.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -172,13 +172,13 @@ public Set<DeptDto> getDeleteDepts(List<Dept> menuList, Set<DeptDto> deptDtos) {
172172
}
173173

174174
@Override
175-
public List<Long> getDeptChildren(Long deptId, List<Dept> deptList) {
175+
public List<Long> getDeptChildren(List<Dept> deptList) {
176176
List<Long> list = new ArrayList<>();
177177
deptList.forEach(dept -> {
178-
if (dept!=null && dept.getEnabled()){
178+
if (dept!=null && dept.getEnabled()) {
179179
List<Dept> depts = deptRepository.findByPid(dept.getId());
180-
if(deptList.size() != 0){
181-
list.addAll(getDeptChildren(dept.getId(), depts));
180+
if (deptList.size() != 0) {
181+
list.addAll(getDeptChildren(depts));
182182
}
183183
list.add(dept.getId());
184184
}

0 commit comments

Comments
 (0)