Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
Y
yifu-mvp
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
fangxinjiang
yifu-mvp
Commits
6e0e1234
Commit
6e0e1234
authored
Sep 01, 2023
by
huyuchen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
菜单权限修改
parent
e4785ef0
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
62 additions
and
13 deletions
+62
-13
SysMenu.java
...om/yifu/cloud/plus/v1/yifu/permission/entity/SysMenu.java
+6
-0
SysMenuController.java
...loud/plus/v1/permission/controller/SysMenuController.java
+13
-2
SysMenuService.java
...yifu/cloud/plus/v1/permission/service/SysMenuService.java
+7
-0
SysMenuServiceImpl.java
...d/plus/v1/permission/service/impl/SysMenuServiceImpl.java
+34
-11
SysMenuMapper.xml
...ermission-biz/src/main/resources/mapper/SysMenuMapper.xml
+2
-0
No files found.
yifu-permission/yifu-permission-api/src/main/java/com/yifu/cloud/plus/v1/yifu/permission/entity/SysMenu.java
View file @
6e0e1234
...
...
@@ -60,6 +60,12 @@ public class SysMenu extends BaseEntity {
@Schema
(
description
=
"视图ID"
)
private
String
viewId
;
/**
* 权限维度
*/
@Schema
(
description
=
"权限维度"
)
private
String
permissionType
;
/**
* 授权状态(0启用、1禁用)
*/
...
...
yifu-permission/yifu-permission-biz/src/main/java/com/yifu/cloud/plus/v1/permission/controller/SysMenuController.java
View file @
6e0e1234
...
...
@@ -49,7 +49,7 @@ public class SysMenuController {
*/
@Operation
(
description
=
"新增新权限-菜单表:hasPermission('permission_sysmenu_add')"
)
@SysLog
(
"新增新权限-菜单表"
)
@PostMapping
@PostMapping
(
"/addMenu"
)
@PreAuthorize
(
"@pms.hasPermission('permission_sysmenu_add')"
)
public
R
<
Boolean
>
save
(
@RequestBody
SysMenu
sysMenu
)
{
return
sysMenuService
.
saveMenu
(
sysMenu
);
...
...
@@ -66,7 +66,18 @@ public class SysMenuController {
@PostMapping
(
"/updateMenu"
)
@PreAuthorize
(
"@pms.hasPermission('permission_sysmenu_edit')"
)
public
R
<
Boolean
>
updateById
(
@RequestBody
SysMenu
sysMenu
)
{
return
R
.
ok
(
sysMenuService
.
updateById
(
sysMenu
)
);
return
sysMenuService
.
updateMenu
(
sysMenu
);
}
/**
* 通过id查询新权限-菜单表
*
* @param id id
* @return R
*/
@Operation
(
summary
=
"通过id查询"
,
description
=
"通过id查询"
)
@GetMapping
(
"/{id}"
)
public
R
<
SysMenu
>
getById
(
@PathVariable
(
"id"
)
String
id
)
{
return
R
.
ok
(
sysMenuService
.
getById
(
id
));
}
}
yifu-permission/yifu-permission-biz/src/main/java/com/yifu/cloud/plus/v1/permission/service/SysMenuService.java
View file @
6e0e1234
...
...
@@ -28,4 +28,11 @@ public interface SysMenuService extends IService<SysMenu> {
* @return
*/
R
<
Boolean
>
saveMenu
(
SysMenu
menu
);
/**
* 更新菜单表
* @param menu 新权限-菜单表
* @return
*/
R
<
Boolean
>
updateMenu
(
SysMenu
menu
);
}
yifu-permission/yifu-permission-biz/src/main/java/com/yifu/cloud/plus/v1/permission/service/impl/SysMenuServiceImpl.java
View file @
6e0e1234
...
...
@@ -67,6 +67,38 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
}
//错误信息
StringBuilder
errorStr
=
new
StringBuilder
();
//权限维度
StringBuilder
permissionType
=
new
StringBuilder
();
this
.
check
(
menu
,
errorStr
,
permissionType
);
//权限维度的控件id填写错误的话统一返回
if
(
errorStr
.
length
()
>
0
)
{
return
R
.
failed
(
errorStr
.
substring
(
0
,
errorStr
.
lastIndexOf
(
";"
)));
}
menu
.
setPermissionType
(
permissionType
.
substring
(
0
,
errorStr
.
lastIndexOf
(
"、"
)));
int
res
=
baseMapper
.
insert
(
menu
);
if
(
res
<=
CommonConstants
.
ZERO_INT
)
{
return
R
.
failed
();
}
return
R
.
ok
();
}
@Override
public
R
<
Boolean
>
updateMenu
(
SysMenu
menu
)
{
//错误信息
StringBuilder
errorStr
=
new
StringBuilder
();
//权限维度
StringBuilder
permissionType
=
new
StringBuilder
();
this
.
check
(
menu
,
errorStr
,
permissionType
);
//权限维度的控件id填写错误的话统一返回
if
(
errorStr
.
length
()
>
0
)
{
return
R
.
failed
(
errorStr
.
substring
(
0
,
errorStr
.
lastIndexOf
(
";"
)));
}
menu
.
setPermissionType
(
permissionType
.
substring
(
0
,
errorStr
.
lastIndexOf
(
"、"
)));
baseMapper
.
updateById
(
menu
);
return
R
.
ok
();
}
public
void
check
(
SysMenu
menu
,
StringBuilder
errorStr
,
StringBuilder
permissionType
)
{
//权限类型
String
name
;
//判断填写的控件id 是否属于表单的字段
...
...
@@ -74,23 +106,14 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
if
(!
menu
.
getColumnIdList
().
isEmpty
())
{
for
(
String
columnId
:
menu
.
getColumnIdList
())
{
name
=
columnId
.
substring
(
0
,
columnId
.
indexOf
(
";"
));
//label为控件id;columnId格式为【客户权限_fd_3ae495ff53c560】
permissionType
.
append
(
name
).
append
(
"、"
);
//label为控件id;columnId格式为【客户权限;fd_3ae495ff53c560】
String
label
=
columnId
.
substring
(
columnId
.
indexOf
(
";"
)
+
1
);
if
(
list
.
stream
().
noneMatch
(
e
->
e
.
equals
(
label
)))
{
errorStr
.
append
(
name
).
append
(
"的控件id填写有误;"
);
}
}
}
//权限维度的控件id填写错误的话统一返回
if
(
errorStr
.
length
()
>
0
)
{
return
R
.
failed
(
errorStr
.
substring
(
0
,
errorStr
.
lastIndexOf
(
";"
)));
}
int
res
=
baseMapper
.
insert
(
menu
);
if
(
res
<=
CommonConstants
.
ZERO_INT
)
{
return
R
.
failed
();
}
return
R
.
ok
();
}
}
yifu-permission/yifu-permission-biz/src/main/resources/mapper/SysMenuMapper.xml
View file @
6e0e1234
...
...
@@ -10,6 +10,7 @@
<result
property=
"menuParentId"
column=
"MENU_PARENT_ID"
/>
<result
property=
"modelId"
column=
"MODEL_ID"
/>
<result
property=
"viewId"
column=
"VIEW_ID"
/>
<result
property=
"permissionType"
column=
"PERMISSION_TYPE"
/>
<result
property=
"permissionStatus"
column=
"PERMISSION_STATUS"
/>
<result
property=
"deleteStatus"
column=
"DELETE_STATUS"
/>
<result
property=
"incomeId"
column=
"INCOME_ID"
/>
...
...
@@ -32,6 +33,7 @@
a.MENU_NAME,
a.MENU_NAME_PARENT,
a.MENU_PARENT_ID,
a.PERMISSION_TYPE,
a.PERMISSION_STATUS,
a.DELETE_STATUS,
a.CREATE_TIME
...
...
Write
Preview
Markdown
is supported
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