Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
孙克
/
smf-core
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 2f44da71
由
sunke
编写于
2022-06-28 17:09:03 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
菜单功能重构
1 个父辈
d89f1ab3
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
7 个修改的文件
包含
29 行增加
和
10 行删除
src/main/java/com/neotel/smfcore/common/init/DataInitManager.java
src/main/java/com/neotel/smfcore/common/utils/PermissionInitUtil.java
src/main/java/com/neotel/smfcore/core/language/util/LanguageMsgService.java
src/main/java/com/neotel/smfcore/security/service/manager/IMenuManager.java
src/main/java/com/neotel/smfcore/security/service/manager/impl/MenuManagerImpl.java
src/main/java/com/neotel/smfcore/security/service/po/Menu.java
src/main/resources/config/application.yml
src/main/java/com/neotel/smfcore/common/init/DataInitManager.java
查看文件 @
2f44da7
此文件的差异被折叠,
点击展开。
src/main/java/com/neotel/smfcore/common/utils/PermissionInitUtil.java
查看文件 @
2f44da7
...
@@ -169,6 +169,10 @@ public class PermissionInitUtil {
...
@@ -169,6 +169,10 @@ public class PermissionInitUtil {
if
(
targetStr
.
contains
(
"@el.check"
))
{
if
(
targetStr
.
contains
(
"@el.check"
))
{
int
endIndex
=
targetStr
.
length
()
-
2
;
int
endIndex
=
targetStr
.
length
()
-
2
;
if
(
endIndex
<=
11
){
log
.
error
(
"path="
+
path
+
"的权限定义"
+
targetStr
+
"异常,忽略"
);
continue
;
}
targetStr
=
targetStr
.
substring
(
11
,
endIndex
);
targetStr
=
targetStr
.
substring
(
11
,
endIndex
);
String
[]
targetArray
=
targetStr
.
split
(
"','"
);
String
[]
targetArray
=
targetStr
.
split
(
"','"
);
tList
=
Lists
.
newArrayList
(
targetArray
);
tList
=
Lists
.
newArrayList
(
targetArray
);
...
@@ -188,7 +192,7 @@ public class PermissionInitUtil {
...
@@ -188,7 +192,7 @@ public class PermissionInitUtil {
resMap
.
put
(
path
,
tbPer
);
resMap
.
put
(
path
,
tbPer
);
}
catch
(
Exception
ex
)
{
}
catch
(
Exception
ex
)
{
log
.
error
(
"解析 path="
+
path
+
" 出错: "
+
ex
.
toString
()
);
log
.
error
(
"解析 path="
+
path
+
" 出错: "
,
ex
);
}
}
}
}
...
...
src/main/java/com/neotel/smfcore/core/language/util/LanguageMsgService.java
查看文件 @
2f44da7
...
@@ -117,8 +117,7 @@ public class LanguageMsgService {
...
@@ -117,8 +117,7 @@ public class LanguageMsgService {
List
<
String
>
list
=
getAllLanList
();
List
<
String
>
list
=
getAllLanList
();
list
.
add
(
""
);
list
.
add
(
""
);
for
(
String
lan
:
for
(
String
lan
:
list
)
{
list
)
{
String
[]
array
=
lan
.
split
(
"-"
);
String
[]
array
=
lan
.
split
(
"-"
);
Locale
locale
=
null
;
Locale
locale
=
null
;
if
(
array
.
length
==
2
)
{
if
(
array
.
length
==
2
)
{
...
...
src/main/java/com/neotel/smfcore/security/service/manager/IMenuManager.java
查看文件 @
2f44da7
...
@@ -84,4 +84,6 @@ public interface IMenuManager extends IBaseManager<Menu> {
...
@@ -84,4 +84,6 @@ public interface IMenuManager extends IBaseManager<Menu> {
void
delete
(
Set
<
Menu
>
menuSet
)
throws
ValidateException
;
void
delete
(
Set
<
Menu
>
menuSet
)
throws
ValidateException
;
Menu
saveMenu
(
Menu
menu
)
throws
ValidateException
;
Menu
saveMenu
(
Menu
menu
)
throws
ValidateException
;
Menu
findByPath
(
String
path
);
}
}
src/main/java/com/neotel/smfcore/security/service/manager/impl/MenuManagerImpl.java
查看文件 @
2f44da7
...
@@ -7,7 +7,6 @@ import com.neotel.smfcore.common.exception.ValidateException;
...
@@ -7,7 +7,6 @@ import com.neotel.smfcore.common.exception.ValidateException;
import
com.neotel.smfcore.common.utils.FileUtil
;
import
com.neotel.smfcore.common.utils.FileUtil
;
import
com.neotel.smfcore.common.utils.StringUtils
;
import
com.neotel.smfcore.common.utils.StringUtils
;
import
com.neotel.smfcore.core.language.util.MessageUtils
;
import
com.neotel.smfcore.core.language.util.MessageUtils
;
import
com.neotel.smfcore.security.rest.bean.dto.MenuDto
;
import
com.neotel.smfcore.security.rest.bean.vo.MenuMetaVo
;
import
com.neotel.smfcore.security.rest.bean.vo.MenuMetaVo
;
import
com.neotel.smfcore.security.rest.bean.vo.MenuVo
;
import
com.neotel.smfcore.security.rest.bean.vo.MenuVo
;
import
com.neotel.smfcore.security.service.dao.IMenuDao
;
import
com.neotel.smfcore.security.service.dao.IMenuDao
;
...
@@ -18,7 +17,6 @@ import com.neotel.smfcore.security.service.po.Menu;
...
@@ -18,7 +17,6 @@ import com.neotel.smfcore.security.service.po.Menu;
import
com.neotel.smfcore.security.service.po.Role
;
import
com.neotel.smfcore.security.service.po.Role
;
import
com.neotel.smfcore.security.service.po.User
;
import
com.neotel.smfcore.security.service.po.User
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.poi.util.StringUtil
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.domain.Pageable
;
import
org.springframework.data.domain.Pageable
;
import
org.springframework.data.domain.Sort
;
import
org.springframework.data.domain.Sort
;
...
@@ -326,6 +324,11 @@ public class MenuManagerImpl implements IMenuManager {
...
@@ -326,6 +324,11 @@ public class MenuManagerImpl implements IMenuManager {
return
menuDao
.
save
(
menu
);
return
menuDao
.
save
(
menu
);
}
}
@Override
public
Menu
findByPath
(
String
path
){
return
menuDao
.
findOneByCondition
(
new
String
[]{
"path"
},
new
String
[]{
path
});
}
// /**
// /**
// * 清理缓存
// * 清理缓存
// * @param id 菜单ID
// * @param id 菜单ID
...
...
src/main/java/com/neotel/smfcore/security/service/po/Menu.java
查看文件 @
2f44da7
...
@@ -19,6 +19,7 @@ import cn.hutool.core.util.ObjectUtil;
...
@@ -19,6 +19,7 @@ import cn.hutool.core.util.ObjectUtil;
import
com.neotel.smfcore.common.base.BasePo
;
import
com.neotel.smfcore.common.base.BasePo
;
import
com.neotel.smfcore.core.language.util.MessageUtils
;
import
com.neotel.smfcore.core.language.util.MessageUtils
;
import
lombok.*
;
import
lombok.*
;
import
org.springframework.data.annotation.Transient
;
import
org.springframework.data.mongodb.core.mapping.Document
;
import
org.springframework.data.mongodb.core.mapping.Document
;
import
java.io.Serializable
;
import
java.io.Serializable
;
...
@@ -98,6 +99,12 @@ public class Menu extends BasePo implements Serializable {
...
@@ -98,6 +99,12 @@ public class Menu extends BasePo implements Serializable {
*/
*/
private
String
titleKey
;
private
String
titleKey
;
/**
* 父级菜单,主要用于初始化菜单,不存数据库
*/
@Transient
private
Menu
parentMenu
;
public
Boolean
getHasChildren
()
{
public
Boolean
getHasChildren
()
{
if
(
subCount
==
0
){
if
(
subCount
==
0
){
return
false
;
return
false
;
...
@@ -159,16 +166,16 @@ public class Menu extends BasePo implements Serializable {
...
@@ -159,16 +166,16 @@ public class Menu extends BasePo implements Serializable {
* 此方法用于构建权限菜单,type=2
* 此方法用于构建权限菜单,type=2
*/
*/
public
static
Menu
CreatePerMenu
(
final
String
permission
,
final
String
title
,
final
String
pid
)
{
public
static
Menu
CreatePerMenu
(
final
String
permission
,
final
String
title
,
final
String
pid
)
{
Menu
menu
=
new
Menu
(
new
ArrayList
<
Menu
>(),
2
,
permission
,
title
,
999
,
""
,
""
,
pid
,
0
,
false
,
false
,
false
,
""
,
""
,
""
);
Menu
menu
=
new
Menu
(
new
ArrayList
<
Menu
>(),
2
,
permission
,
title
,
999
,
""
,
""
,
pid
,
0
,
false
,
false
,
false
,
""
,
""
,
""
,
null
);
return
menu
;
return
menu
;
}
}
/**
/**
* 此方法用户创建只用于显示的一级菜单,type=0
* 此方法用户创建只用于显示的一级菜单,type=0
*/
*/
public
static
Menu
CreatePMenu
(
final
String
title
,
final
Integer
menuSort
,
final
String
path
,
final
Integer
subCount
,
final
String
icon
)
{
public
static
Menu
CreatePMenu
(
final
String
title
,
final
Integer
menuSort
,
final
String
path
,
final
Integer
subCount
,
final
String
icon
,
Menu
parentMenu
)
{
String
titleKey
=
path
;
String
titleKey
=
path
;
Menu
menu
=
new
Menu
(
new
ArrayList
<
Menu
>(),
0
,
""
,
title
,
menuSort
,
path
,
""
,
""
,
subCount
,
false
,
false
,
false
,
title
,
icon
,
titleKey
);
Menu
menu
=
new
Menu
(
new
ArrayList
<
Menu
>(),
0
,
""
,
title
,
menuSort
,
path
,
""
,
""
,
subCount
,
false
,
false
,
false
,
title
,
icon
,
titleKey
,
parentMenu
);
return
menu
;
return
menu
;
}
}
...
...
src/main/resources/config/application.yml
查看文件 @
2f44da7
...
@@ -34,7 +34,7 @@ spring:
...
@@ -34,7 +34,7 @@ spring:
mongodb
:
mongodb
:
host
:
localhost
# 主机地址
host
:
localhost
# 主机地址
port
:
27017
# 端口
port
:
27017
# 端口
database
:
smf
# 数据库
database
:
smf
-test
# 数据库
messages
:
messages
:
encoding
:
utf-8
encoding
:
utf-8
main
:
main
:
...
@@ -47,4 +47,8 @@ rsa:
...
@@ -47,4 +47,8 @@ rsa:
app
:
app
:
version
:
'
1.25.0517'
version
:
'
1.25.0517'
type
:
"
"
\ No newline at end of file
\ No newline at end of file
type
:
"
"
menu
:
show
:
hide
:
\ No newline at end of file
\ No newline at end of file
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论