Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
jinli gu
Eladmin
Commits
d8a458ca
Commit
d8a458ca
authored
Mar 02, 2021
by
Zheng Jie
Browse files
[代码优化](v2.6):update UserController
parent
162cff26
Changes
1
Hide whitespace changes
Inline
Side-by-side
eladmin-system/src/main/java/me/zhengjie/modules/system/rest/UserController.java
View file @
d8a458ca
...
...
@@ -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
()));
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment