Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
yangxiujun
/
paidan_demo
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit ad69e05e
authored
Jul 21, 2023
by
chamberone
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 二级菜单权限过滤
1 parent
9f28efa0
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
1 deletions
project-user/src/main/java/com/dituhui/pea/user/service/UserService.java
project-user/src/main/java/com/dituhui/pea/user/service/UserService.java
View file @
ad69e05
...
@@ -4,6 +4,7 @@ import java.util.Arrays;
...
@@ -4,6 +4,7 @@ import java.util.Arrays;
import
java.util.Comparator
;
import
java.util.Comparator
;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Set
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
import
javax.persistence.criteria.Path
;
import
javax.persistence.criteria.Path
;
...
@@ -145,13 +146,16 @@ public class UserService {
...
@@ -145,13 +146,16 @@ public class UserService {
if
(
CollectionUtils
.
isNotEmpty
(
resources
))
{
if
(
CollectionUtils
.
isNotEmpty
(
resources
))
{
// 菜单嵌套处理+菜单排序
// 菜单嵌套处理+菜单排序
final
Set
<
String
>
resourceIds
=
resources
.
stream
().
map
(
r
->
r
.
getId
()).
collect
(
Collectors
.
toSet
());
List
<
ResourceInfo
>
levelOne
=
resources
.
stream
()
List
<
ResourceInfo
>
levelOne
=
resources
.
stream
()
.
filter
(
r
->
StringUtils
.
isEmpty
(
r
.
getParentId
())
&&
r
.
getType
()
==
1
)
.
filter
(
r
->
StringUtils
.
isEmpty
(
r
.
getParentId
())
&&
r
.
getType
()
==
1
)
.
map
(
r
->
BeanUtil
.
copyProperties
(
r
,
ResourceInfo
.
class
)).
collect
(
Collectors
.
toList
());
.
map
(
r
->
BeanUtil
.
copyProperties
(
r
,
ResourceInfo
.
class
)).
collect
(
Collectors
.
toList
());
for
(
ResourceInfo
resourceInfo
:
levelOne
)
{
for
(
ResourceInfo
resourceInfo
:
levelOne
)
{
splitMenuExtra
(
resourceInfo
);
splitMenuExtra
(
resourceInfo
);
List
<
ResourceEntity
>
levelTow
=
resourceDao
.
findByParentId
(
resourceInfo
.
getId
());
List
<
ResourceEntity
>
levelTow
=
resourceDao
.
findByParentId
(
resourceInfo
.
getId
());
List
<
ResourceInfo
>
levelTowResourceInfo
=
levelTow
.
stream
().
map
(
r
->
{
List
<
ResourceInfo
>
levelTowResourceInfo
=
levelTow
.
stream
()
// 过滤未配置二级菜单
.
filter
(
r
->
resourceIds
.
contains
(
r
.
getId
())).
map
(
r
->
{
ResourceInfo
res
=
BeanUtil
.
copyProperties
(
r
,
ResourceInfo
.
class
);
ResourceInfo
res
=
BeanUtil
.
copyProperties
(
r
,
ResourceInfo
.
class
);
splitMenuExtra
(
res
);
splitMenuExtra
(
res
);
return
res
;
return
res
;
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment