Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
孙克
/
smf-core
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 258d0897
由
LN
编写于
2021-09-01 13:52:26 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
菜单增加titlekey
1 个父辈
e9de6c4c
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
25 行增加
和
3 行删除
src/main/java/com/neotel/smfcore/security/rest/RoleController.java
src/main/java/com/neotel/smfcore/security/rest/bean/vo/MenuMetaVo.java
src/main/java/com/neotel/smfcore/security/service/manager/impl/MenuManagerImpl.java
src/main/java/com/neotel/smfcore/security/rest/RoleController.java
查看文件 @
258d089
...
@@ -6,10 +6,13 @@ import com.neotel.smfcore.common.exception.ValidateException;
...
@@ -6,10 +6,13 @@ import com.neotel.smfcore.common.exception.ValidateException;
import
com.neotel.smfcore.common.utils.QueryHelp
;
import
com.neotel.smfcore.common.utils.QueryHelp
;
import
com.neotel.smfcore.common.utils.SecurityUtils
;
import
com.neotel.smfcore.common.utils.SecurityUtils
;
import
com.neotel.smfcore.security.rest.bean.dto.RoleDto
;
import
com.neotel.smfcore.security.rest.bean.dto.RoleDto
;
import
com.neotel.smfcore.security.rest.bean.mapstruct.MenuMapper
;
import
com.neotel.smfcore.security.rest.bean.mapstruct.RoleMapper
;
import
com.neotel.smfcore.security.rest.bean.mapstruct.RoleMapper
;
import
com.neotel.smfcore.security.rest.bean.query.RoleQueryCriteria
;
import
com.neotel.smfcore.security.rest.bean.query.RoleQueryCriteria
;
import
com.neotel.smfcore.security.service.manager.IMenuManager
;
import
com.neotel.smfcore.security.service.manager.IRoleManager
;
import
com.neotel.smfcore.security.service.manager.IRoleManager
;
import
com.neotel.smfcore.security.service.manager.IUserManager
;
import
com.neotel.smfcore.security.service.manager.IUserManager
;
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
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
...
@@ -47,6 +50,9 @@ public class RoleController {
...
@@ -47,6 +50,9 @@ public class RoleController {
@Autowired
@Autowired
private
RoleMapper
roleMapper
;
private
RoleMapper
roleMapper
;
@Autowired
private
IMenuManager
menuManager
;
@ApiOperation
(
value
=
"获取单个role "
,
notes
=
"权限:roles:list"
)
@ApiOperation
(
value
=
"获取单个role "
,
notes
=
"权限:roles:list"
)
@ApiImplicitParams
({
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"id"
,
value
=
"角色的ID"
,
required
=
true
)
@ApiImplicitParam
(
name
=
"id"
,
value
=
"角色的ID"
,
required
=
true
)
...
@@ -118,6 +124,15 @@ public class RoleController {
...
@@ -118,6 +124,15 @@ public class RoleController {
throw
new
ValidateException
(
"smfcode.valueCanotNull"
,
"{0}不能为空"
,
new
String
[]{
"ID"
}
);
throw
new
ValidateException
(
"smfcode.valueCanotNull"
,
"{0}不能为空"
,
new
String
[]{
"ID"
}
);
}
}
Role
role
=
roleManager
.
get
(
resources
.
getId
());
Role
role
=
roleManager
.
get
(
resources
.
getId
());
//判断ID是否存在
Set
<
String
>
menuIds
=
resources
.
getMenus
();
Query
query
=
new
Query
(
Criteria
.
where
(
"id"
).
in
(
menuIds
));
List
<
Menu
>
menus
=
menuManager
.
findByQuery
(
query
);
if
(
menus
==
null
&&(
menus
.
size
()!=
menuIds
.
size
())){
throw
new
ValidateException
(
"smfcode.menuNotExist"
,
"菜单{0}不存在"
,
new
String
[]{
"ID"
}
);
}
roleManager
.
updateMenu
(
resources
);
roleManager
.
updateMenu
(
resources
);
return
new
ResponseEntity
<>(
HttpStatus
.
OK
);
return
new
ResponseEntity
<>(
HttpStatus
.
OK
);
}
}
...
...
src/main/java/com/neotel/smfcore/security/rest/bean/vo/MenuMetaVo.java
查看文件 @
258d089
package
com
.
neotel
.
smfcore
.
security
.
rest
.
bean
.
vo
;
package
com
.
neotel
.
smfcore
.
security
.
rest
.
bean
.
vo
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.AllArgsConstructor
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
import
lombok.Data
;
...
@@ -10,4 +11,7 @@ public class MenuMetaVo implements Serializable {
...
@@ -10,4 +11,7 @@ public class MenuMetaVo implements Serializable {
private
String
title
;
private
String
title
;
private
String
icon
;
private
String
icon
;
private
Boolean
noCache
;
private
Boolean
noCache
;
@ApiModelProperty
(
"国际化key"
)
private
String
titleKey
;
}
}
src/main/java/com/neotel/smfcore/security/service/manager/impl/MenuManagerImpl.java
查看文件 @
258d089
...
@@ -126,8 +126,8 @@ public class MenuManagerImpl implements IMenuManager {
...
@@ -126,8 +126,8 @@ public class MenuManagerImpl implements IMenuManager {
List
<
Menu
>
menuDtoList
=
menu
.
getChildren
();
List
<
Menu
>
menuDtoList
=
menu
.
getChildren
();
MenuVo
menuVo
=
new
MenuVo
();
MenuVo
menuVo
=
new
MenuVo
();
String
oldName
=
ObjectUtil
.
isNotEmpty
(
menu
.
getComponentName
())?
menu
.
getComponentName
():
menu
.
getTitle
();
String
oldName
=
ObjectUtil
.
isNotEmpty
(
menu
.
getComponentName
())?
menu
.
getComponentName
():
menu
.
getTitle
();
String
titleKey
=
menu
.
GetMsg
Key
();
String
titleKey
=
menu
.
getTitle
Key
();
String
title
=
MessageUtils
.
getText
(
titleKey
,
locale
,
oldName
);
String
title
=
MessageUtils
.
getText
(
menu
.
GetMsgKey
()
,
locale
,
oldName
);
// log.info(titleKey+"="+title);
// log.info(titleKey+"="+title);
menuVo
.
setName
(
title
);
menuVo
.
setName
(
title
);
boolean
pidIsNull
=(
menu
.
getPid
()==
null
)||(
StringUtils
.
isBlank
(
menu
.
getPid
())||
menu
.
getPid
().
equals
(
"0"
));
boolean
pidIsNull
=(
menu
.
getPid
()==
null
)||(
StringUtils
.
isBlank
(
menu
.
getPid
())||
menu
.
getPid
().
equals
(
"0"
));
...
@@ -144,7 +144,10 @@ public class MenuManagerImpl implements IMenuManager {
...
@@ -144,7 +144,10 @@ public class MenuManagerImpl implements IMenuManager {
menuVo
.
setComponent
(
menu
.
getComponent
());
menuVo
.
setComponent
(
menu
.
getComponent
());
}
}
}
}
menuVo
.
setMeta
(
new
MenuMetaVo
(
title
,
menu
.
getIcon
(),!
menu
.
getCache
()));
if
(
titleKey
==
null
||
titleKey
==
""
){
log
.
error
(
"菜单【"
+
title
+
"】titleKey为空"
);
}
menuVo
.
setMeta
(
new
MenuMetaVo
(
title
,
menu
.
getIcon
(),!
menu
.
getCache
(),
titleKey
));
if
(
CollectionUtil
.
isNotEmpty
(
menuDtoList
)){
if
(
CollectionUtil
.
isNotEmpty
(
menuDtoList
)){
menuVo
.
setAlwaysShow
(
true
);
menuVo
.
setAlwaysShow
(
true
);
menuVo
.
setRedirect
(
"noredirect"
);
menuVo
.
setRedirect
(
"noredirect"
);
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论