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
9f0eb9fd
Commit
9f0eb9fd
authored
Jun 12, 2022
by
Zheng Jie
Browse files
Merge branch 'master' into deploy
parents
cfefc49d
b7b721b1
Changes
2
Hide whitespace changes
Inline
Side-by-side
eladmin-system/src/main/java/me/zhengjie/modules/system/repository/MenuRepository.java
View file @
9f0eb9fd
...
...
@@ -49,13 +49,13 @@ public interface MenuRepository extends JpaRepository<Menu, Long>, JpaSpecificat
* @param pid /
* @return /
*/
List
<
Menu
>
findByPid
(
long
pid
);
List
<
Menu
>
findByPid
OrderByMenuSort
(
long
pid
);
/**
* 查询顶级菜单
* @return /
*/
List
<
Menu
>
findByPidIsNull
();
List
<
Menu
>
findByPidIsNull
OrderByMenuSort
();
/**
* 根据角色ID与菜单类型查询菜单
...
...
eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/MenuServiceImpl.java
View file @
9f0eb9fd
...
...
@@ -189,7 +189,7 @@ public class MenuServiceImpl implements MenuService {
public
Set
<
Menu
>
getChildMenus
(
List
<
Menu
>
menuList
,
Set
<
Menu
>
menuSet
)
{
for
(
Menu
menu
:
menuList
)
{
menuSet
.
add
(
menu
);
List
<
Menu
>
menus
=
menuRepository
.
findByPid
(
menu
.
getId
());
List
<
Menu
>
menus
=
menuRepository
.
findByPid
OrderByMenuSort
(
menu
.
getId
());
if
(
menus
!=
null
&&
menus
.
size
()!=
0
){
getChildMenus
(
menus
,
menuSet
);
}
...
...
@@ -213,9 +213,9 @@ public class MenuServiceImpl implements MenuService {
public
List
<
MenuDto
>
getMenus
(
Long
pid
)
{
List
<
Menu
>
menus
;
if
(
pid
!=
null
&&
!
pid
.
equals
(
0L
)){
menus
=
menuRepository
.
findByPid
(
pid
);
menus
=
menuRepository
.
findByPid
OrderByMenuSort
(
pid
);
}
else
{
menus
=
menuRepository
.
findByPidIsNull
();
menus
=
menuRepository
.
findByPidIsNull
OrderByMenuSort
();
}
return
menuMapper
.
toDto
(
menus
);
}
...
...
@@ -223,10 +223,10 @@ public class MenuServiceImpl implements MenuService {
@Override
public
List
<
MenuDto
>
getSuperior
(
MenuDto
menuDto
,
List
<
Menu
>
menus
)
{
if
(
menuDto
.
getPid
()
==
null
){
menus
.
addAll
(
menuRepository
.
findByPidIsNull
());
menus
.
addAll
(
menuRepository
.
findByPidIsNull
OrderByMenuSort
());
return
menuMapper
.
toDto
(
menus
);
}
menus
.
addAll
(
menuRepository
.
findByPid
(
menuDto
.
getPid
()));
menus
.
addAll
(
menuRepository
.
findByPid
OrderByMenuSort
(
menuDto
.
getPid
()));
return
getSuperior
(
findById
(
menuDto
.
getPid
()),
menus
);
}
...
...
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