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
wwwanlingxiao
mall
Commits
a58bcde7
Commit
a58bcde7
authored
Jul 19, 2020
by
macro
Browse files
获取登录用户信息添加角色信息
parent
6fd7bd29
Changes
1
Hide whitespace changes
Inline
Side-by-side
mall-admin/src/main/java/com/macro/mall/controller/UmsAdminController.java
View file @
a58bcde7
package
com.macro.mall.controller
;
package
com.macro.mall.controller
;
import
cn.hutool.core.collection.CollUtil
;
import
com.macro.mall.common.api.CommonPage
;
import
com.macro.mall.common.api.CommonPage
;
import
com.macro.mall.common.api.CommonResult
;
import
com.macro.mall.common.api.CommonResult
;
import
com.macro.mall.dto.UmsAdminLoginParam
;
import
com.macro.mall.dto.UmsAdminLoginParam
;
...
@@ -23,6 +24,7 @@ import java.security.Principal;
...
@@ -23,6 +24,7 @@ import java.security.Principal;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
/**
/**
* 后台用户管理
* 后台用户管理
...
@@ -92,9 +94,13 @@ public class UmsAdminController {
...
@@ -92,9 +94,13 @@ public class UmsAdminController {
UmsAdmin
umsAdmin
=
adminService
.
getAdminByUsername
(
username
);
UmsAdmin
umsAdmin
=
adminService
.
getAdminByUsername
(
username
);
Map
<
String
,
Object
>
data
=
new
HashMap
<>();
Map
<
String
,
Object
>
data
=
new
HashMap
<>();
data
.
put
(
"username"
,
umsAdmin
.
getUsername
());
data
.
put
(
"username"
,
umsAdmin
.
getUsername
());
data
.
put
(
"roles"
,
new
String
[]{
"TEST"
});
data
.
put
(
"menus"
,
roleService
.
getMenuList
(
umsAdmin
.
getId
()));
data
.
put
(
"menus"
,
roleService
.
getMenuList
(
umsAdmin
.
getId
()));
data
.
put
(
"icon"
,
umsAdmin
.
getIcon
());
data
.
put
(
"icon"
,
umsAdmin
.
getIcon
());
List
<
UmsRole
>
roleList
=
adminService
.
getRoleList
(
umsAdmin
.
getId
());
if
(
CollUtil
.
isNotEmpty
(
roleList
)){
List
<
String
>
roles
=
roleList
.
stream
().
map
(
UmsRole:
:
getName
).
collect
(
Collectors
.
toList
());
data
.
put
(
"roles"
,
roles
);
}
return
CommonResult
.
success
(
data
);
return
CommonResult
.
success
(
data
);
}
}
...
...
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