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
JeeSpringCloud
Commits
8c87411b
Commit
8c87411b
authored
Jan 11, 2019
by
Sun
Browse files
no commit message
parent
8ad33f02
Changes
4
Hide whitespace changes
Inline
Side-by-side
JeeSpringCloud/jeespring-framework/src/main/java/com/jeespring/modules/sys/entity/Menu.java
View file @
8c87411b
...
...
@@ -3,6 +3,7 @@
*/
package
com.jeespring.modules.sys.entity
;
import
java.util.ArrayList
;
import
java.util.List
;
import
javax.validation.constraints.NotNull
;
...
...
@@ -32,9 +33,8 @@ public class Menu extends AbstractBaseEntity<Menu> {
private
Integer
sort
;
// 排序
private
String
isShow
;
// 是否在菜单中显示(1:显示;0:不显示)
private
String
permission
;
// 权限标识
private
String
userId
;
public
Menu
(){
super
();
this
.
sort
=
30
;
...
...
@@ -44,10 +44,29 @@ public class Menu extends AbstractBaseEntity<Menu> {
public
Menu
(
String
id
){
super
(
id
);
}
private
static
List
<
Menu
>
allMenuCache
;
@JsonBackReference
public
static
List
<
Menu
>
getAllMenu
()
{
return
allMenuCache
;
}
public
static
void
setAllMenu
(
List
<
Menu
>
allMenu
)
{
Menu
.
allMenuCache
=
allMenu
;
}
@JsonBackReference
@NotNull
public
Menu
getParent
()
{
List
<
Menu
>
menuList
=
getAllMenu
();
if
(
menuList
!=
null
){
for
(
Menu
item:
menuList
)
{
if
(
item
.
parent
.
getId
()==
this
.
getId
())
{
parent
=
item
;
break
;
}
}
}
return
parent
;
}
...
...
@@ -136,6 +155,7 @@ public class Menu extends AbstractBaseEntity<Menu> {
@JsonIgnore
public
boolean
hasChildren
(){
children
=
this
.
getChildren
();
if
(
children
==
null
||
children
.
size
()
==
0
){
return
false
;
}
...
...
@@ -205,6 +225,16 @@ public class Menu extends AbstractBaseEntity<Menu> {
}
public
List
<
Menu
>
getChildren
()
{
this
.
children
=
new
ArrayList
<
Menu
>();
List
<
Menu
>
menuList
=
getAllMenu
();
if
(
menuList
!=
null
)
{
for
(
Menu
item
:
menuList
)
{
if
(
item
.
parent
==
null
){
continue
;}
if
(
this
.
getId
().
equals
(
item
.
parent
.
getId
()))
{
this
.
children
.
add
(
item
);
}
}
}
return
children
;
}
}
\ No newline at end of file
JeeSpringCloud/jeespring-framework/src/main/java/com/jeespring/modules/sys/security/SystemAuthorizingRealm.java
View file @
8c87411b
...
...
@@ -54,6 +54,7 @@ public class SystemAuthorizingRealm extends AuthorizingRealm {
/**
* 认证回调函数, 登录时调用
* /admin/login
*/
@Override
protected
AuthenticationInfo
doGetAuthenticationInfo
(
AuthenticationToken
authcToken
)
{
...
...
JeeSpringCloud/jeespring-framework/src/main/java/com/jeespring/modules/sys/utils/UserUtils.java
View file @
8c87411b
...
...
@@ -180,6 +180,7 @@ public class UserUtils {
* @return
*/
public
static
Menu
getTopMenu
(){
Menu
.
setAllMenu
(
UserUtils
.
getMenuList
());
@SuppressWarnings
(
"unchecked"
)
Menu
topMenu
=
menuDao
.
findUniqueByProperty
(
"parent_id"
,
"'0'"
);
return
topMenu
;
...
...
JeeSpringCloud/jeespring-framework/src/main/resources/mappings/sys/MenuDao.xml
View file @
8c87411b
...
...
@@ -13,10 +13,10 @@
<result
property=
"isShow"
column=
"isShow"
/>
<result
property=
"permission"
column=
"permission"
/>
<!-- 查询父模块-->
<association
property=
"parent"
column=
"parent_id"
select=
"getParent"
/
>
<
!--
association property="parent" column="parent_id" select="getParent" /
-->
<!-- 查询子模块 -->
<collection
property=
"children"
column=
"id"
select=
"getChildren"
/
>
<
!--
collection property="children" column="id" select="getChildren" /
-->
</resultMap>
<sql
id=
"menuColumns"
>
...
...
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