mirror of https://github.com/elunez/eladmin
[代码优化](v2.6):update UserController
parent
162cff269b
commit
d8a458cafa
|
@ -21,6 +21,7 @@ import io.swagger.annotations.ApiOperation;
|
|||
import lombok.RequiredArgsConstructor;
|
||||
import me.zhengjie.annotation.Log;
|
||||
import me.zhengjie.config.RsaProperties;
|
||||
import me.zhengjie.modules.system.domain.Dept;
|
||||
import me.zhengjie.modules.system.service.DataService;
|
||||
import me.zhengjie.modules.system.domain.User;
|
||||
import me.zhengjie.exception.BadRequestException;
|
||||
|
@ -79,7 +80,10 @@ 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(deptService.findByPid(criteria.getDeptId())));
|
||||
// 先查找是否存在子节点
|
||||
List<Dept> data = deptService.findByPid(criteria.getDeptId());
|
||||
// 然后把子节点的ID都加入到集合中
|
||||
criteria.getDeptIds().addAll(deptService.getDeptChildren(data));
|
||||
}
|
||||
// 数据权限
|
||||
List<Long> dataScopes = dataService.getDeptIds(userService.findByName(SecurityUtils.getCurrentUsername()));
|
||||
|
|
Loading…
Reference in New Issue