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
6fa63abe
Commit
6fa63abe
authored
Jun 08, 2022
by
huyuchen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
hyc 用户菜单字典调整
parent
8d13ac95
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
52 additions
and
13 deletions
+52
-13
ErrorCodes.java
....cloud.plus.v1/yifu/common/core/exception/ErrorCodes.java
+10
-0
messages_zh_CN.properties
...on-core/src/main/resources/i18n/messages_zh_CN.properties
+3
-0
SysRole.java
...com/yifu.cloud.plus.v1/yifu/admin/api/entity/SysRole.java
+4
-1
DictController.java
...u.cloud.plus.v1/yifu/admin/controller/DictController.java
+2
-4
RoleController.java
...u.cloud.plus.v1/yifu/admin/controller/RoleController.java
+3
-2
SysDictItemService.java
....cloud.plus.v1/yifu/admin/service/SysDictItemService.java
+2
-2
SysRoleService.java
...yifu.cloud.plus.v1/yifu/admin/service/SysRoleService.java
+7
-0
SysDictItemServiceImpl.java
...us.v1/yifu/admin/service/impl/SysDictItemServiceImpl.java
+4
-4
SysRoleServiceImpl.java
...d.plus.v1/yifu/admin/service/impl/SysRoleServiceImpl.java
+17
-0
No files found.
yifu-common/yifu-common-core/src/main/java/com/yifu.cloud.plus.v1/yifu/common/core/exception/ErrorCodes.java
View file @
6fa63abe
...
...
@@ -98,4 +98,14 @@ public interface ErrorCodes {
*/
String
SYS_DICT_DELETE_EXISTING
=
"sys.dict.delete.existing"
;
/**
* 系统内置角色不允许删除
*/
String
SYS_ROLE_DELETE_SYSTEM
=
"sys.role.delete.system"
;
/**
* 系统内置角色不能修改
*/
String
SYS_ROLE_UPDATE_SYSTEM
=
"sys.role.update.system"
;
}
yifu-common/yifu-common-core/src/main/resources/i18n/messages_zh_CN.properties
View file @
6fa63abe
...
...
@@ -24,3 +24,6 @@ sys.dict.delete.system=\u7CFB\u7EDF\u5185\u7F6E\u5B57\u5178\u9879\u76EE\u4E0D\u8
sys.dict.update.system
=
\u
7CFB
\u
7EDF
\u5185\u
7F6E
\u
5B57
\u5178\u9879\u
76EE
\u
4E0D
\u
80FD
\u
4FEE
\u6539
sys.dict.delete.existing
=
\u
5B57
\u5178\u
5B58
\u5728\u
4E0B
\u
7EA7
\u8282\u
70B9
\u
4E0D
\u
80FD
\u5931\u
8D25
sys.role.delete.system
=
\u
7CFB
\u
7EDF
\u5185\u
7F6E
\u
89D2
\u8272\u
4E0D
\u
80FD
\u5220\u9664
sys.role.update.system
=
\u
7CFB
\u
7EDF
\u5185\u
7F6E
\u
89D2
\u8272\u
4E0D
\u
80FD
\u
4FEE
\u6539
yifu-upms/yifu-upms-api/src/main/java/com/yifu.cloud.plus.v1/yifu/admin/api/entity/SysRole.java
View file @
6fa63abe
...
...
@@ -57,9 +57,12 @@ public class SysRole extends BaseEntity {
private
String
roleDesc
;
/**
*
删除标识(0-正常,1-删除)
*
是否是系统内置(0是,1否)
*/
@TableLogic
private
String
delFlag
;
@Schema
(
description
=
"是否是系统内置"
)
private
String
systemFlag
;
}
yifu-upms/yifu-upms-biz/src/main/java/com/yifu.cloud.plus.v1/yifu/admin/controller/DictController.java
View file @
6fa63abe
...
...
@@ -168,8 +168,7 @@ public class DictController {
@SysLog
(
"修改字典项"
)
@PutMapping
(
"/item"
)
public
R
updateById
(
@RequestBody
SysDictItem
sysDictItem
)
{
sysDictItemService
.
updateDictItem
(
sysDictItem
);
return
R
.
ok
();
return
R
.
ok
(
sysDictItemService
.
updateDictItem
(
sysDictItem
));
}
/**
...
...
@@ -180,8 +179,7 @@ public class DictController {
@SysLog
(
"删除字典项"
)
@DeleteMapping
(
"/item/{id:\\d+}"
)
public
R
removeDictItemById
(
@PathVariable
Long
id
)
{
sysDictItemService
.
removeDictItem
(
id
);
return
R
.
ok
();
return
R
.
ok
(
sysDictItemService
.
removeDictItem
(
id
));
}
@SysLog
(
"清除字典缓存"
)
...
...
yifu-upms/yifu-upms-biz/src/main/java/com/yifu.cloud.plus.v1/yifu/admin/controller/RoleController.java
View file @
6fa63abe
...
...
@@ -84,8 +84,9 @@ public class RoleController {
@SysLog
(
"修改角色"
)
@PutMapping
@PreAuthorize
(
"@pms.hasPermission('sys_role_edit')"
)
public
R
<
Boolean
>
update
(
@Valid
@RequestBody
SysRole
sysRole
)
{
return
R
.
ok
(
sysRoleService
.
updateById
(
sysRole
));
public
R
update
(
@Valid
@RequestBody
SysRole
sysRole
)
{
sysRoleService
.
updateRoleById
(
sysRole
);
return
R
.
ok
();
}
/**
...
...
yifu-upms/yifu-upms-biz/src/main/java/com/yifu.cloud.plus.v1/yifu/admin/service/SysDictItemService.java
View file @
6fa63abe
...
...
@@ -34,14 +34,14 @@ public interface SysDictItemService extends IService<SysDictItem> {
* @param id 字典项ID
* @return
*/
void
removeDictItem
(
Long
id
);
Boolean
removeDictItem
(
Long
id
);
/**
* 更新字典项
* @param item 字典项
* @return
*/
void
updateDictItem
(
SysDictItem
item
);
Boolean
updateDictItem
(
SysDictItem
item
);
/**
* 构建树
...
...
yifu-upms/yifu-upms-biz/src/main/java/com/yifu.cloud.plus.v1/yifu/admin/service/SysRoleService.java
View file @
6fa63abe
...
...
@@ -55,4 +55,11 @@ public interface SysRoleService extends IService<SysRole> {
*/
List
<
RoleExcelVO
>
listRole
();
/**
* 更新角色信息
* @param sysRole
* @return
*/
void
updateRoleById
(
SysRole
sysRole
);
}
yifu-upms/yifu-upms-biz/src/main/java/com/yifu.cloud.plus.v1/yifu/admin/service/impl/SysDictItemServiceImpl.java
View file @
6fa63abe
...
...
@@ -62,7 +62,7 @@ public class SysDictItemServiceImpl extends ServiceImpl<SysDictItemMapper, SysDi
*/
@Override
@CacheEvict
(
value
=
CacheConstants
.
DICT_DETAILS
,
allEntries
=
true
)
public
void
removeDictItem
(
Long
id
)
{
public
Boolean
removeDictItem
(
Long
id
)
{
// 查询父节点为当前节点的节点
List
<
SysDictItem
>
dictList
=
this
.
list
(
Wrappers
.<
SysDictItem
>
query
().
lambda
().
eq
(
SysDictItem:
:
getParentId
,
id
));
Assert
.
isTrue
(
CollUtil
.
isEmpty
(
dictList
),
MsgUtils
.
getMessage
(
ErrorCodes
.
SYS_MENU_DELETE_EXISTING
));
...
...
@@ -72,7 +72,7 @@ public class SysDictItemServiceImpl extends ServiceImpl<SysDictItemMapper, SysDi
// 系统内置
Assert
.
state
(!
DictTypeEnum
.
SYSTEM
.
getType
().
equals
(
dict
.
getSystemFlag
()),
MsgUtils
.
getMessage
(
ErrorCodes
.
SYS_DICT_DELETE_SYSTEM
));
this
.
removeById
(
id
);
return
this
.
removeById
(
id
);
}
/**
...
...
@@ -82,13 +82,13 @@ public class SysDictItemServiceImpl extends ServiceImpl<SysDictItemMapper, SysDi
*/
@Override
@CacheEvict
(
value
=
CacheConstants
.
DICT_DETAILS
,
key
=
"#item.type"
)
public
void
updateDictItem
(
SysDictItem
item
)
{
public
Boolean
updateDictItem
(
SysDictItem
item
)
{
// 查询字典
SysDict
dict
=
dictService
.
getById
(
item
.
getDictId
());
// 系统内置
Assert
.
state
(!
DictTypeEnum
.
SYSTEM
.
getType
().
equals
(
dict
.
getSystemFlag
()),
MsgUtils
.
getMessage
(
ErrorCodes
.
SYS_DICT_UPDATE_SYSTEM
));
this
.
updateById
(
item
);
return
this
.
updateById
(
item
);
}
/**
...
...
yifu-upms/yifu-upms-biz/src/main/java/com/yifu.cloud.plus.v1/yifu/admin/service/impl/SysRoleServiceImpl.java
View file @
6fa63abe
...
...
@@ -20,6 +20,7 @@ import cn.hutool.core.bean.BeanUtil;
import
cn.hutool.core.collection.CollUtil
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysDict
;
import
com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysRole
;
import
com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysRoleMenu
;
import
com.yifu.cloud.plus.v1.yifu.admin.api.vo.RoleExcelVO
;
...
...
@@ -27,7 +28,9 @@ import com.yifu.cloud.plus.v1.yifu.admin.mapper.SysRoleMapper;
import
com.yifu.cloud.plus.v1.yifu.admin.mapper.SysRoleMenuMapper
;
import
com.yifu.cloud.plus.v1.yifu.admin.service.SysRoleService
;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.CacheConstants
;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.enums.DictTypeEnum
;
import
com.yifu.cloud.plus.v1.yifu.common.core.exception.ErrorCodes
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.Common
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.MsgUtils
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.R
;
import
com.pig4cloud.plugin.excel.vo.ErrorMessage
;
...
...
@@ -35,6 +38,7 @@ import lombok.RequiredArgsConstructor;
import
org.springframework.cache.annotation.CacheEvict
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.util.Assert
;
import
org.springframework.validation.BindingResult
;
import
java.util.HashSet
;
...
...
@@ -65,6 +69,10 @@ public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole> impl
@Transactional
(
rollbackFor
=
Exception
.
class
)
@CacheEvict
(
value
=
CacheConstants
.
MENU_DETAILS
,
allEntries
=
true
)
public
Boolean
removeRoleById
(
Long
id
)
{
SysRole
sysRole
=
this
.
getById
(
id
);
String
type
=
"0"
;
//系统内置
Assert
.
state
(!
type
.
equals
(
sysRole
.
getSystemFlag
()),
MsgUtils
.
getMessage
(
ErrorCodes
.
SYS_ROLE_DELETE_SYSTEM
));
sysRoleMenuMapper
.
delete
(
Wrappers
.<
SysRoleMenu
>
update
().
lambda
().
eq
(
SysRoleMenu:
:
getRoleId
,
id
));
return
this
.
removeById
(
id
);
}
...
...
@@ -137,4 +145,13 @@ public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole> impl
this
.
save
(
sysRole
);
}
@Override
public
void
updateRoleById
(
SysRole
sysRole
)
{
String
type
=
"0"
;
// 系统内置
Assert
.
state
(!
type
.
equals
(
sysRole
.
getSystemFlag
()),
MsgUtils
.
getMessage
(
ErrorCodes
.
SYS_ROLE_UPDATE_SYSTEM
));
this
.
updateById
(
sysRole
);
}
}
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