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
a43dbc42
Commit
a43dbc42
authored
Jun 08, 2022
by
huyuchen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
hyc 用户菜单字典调整
parent
0e019ad1
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
52 additions
and
9 deletions
+52
-9
ErrorCodes.java
....cloud.plus.v1/yifu/common/core/exception/ErrorCodes.java
+9
-0
SysUser.java
...com/yifu.cloud.plus.v1/yifu/admin/api/entity/SysUser.java
+3
-0
UserVO.java
...java/com/yifu.cloud.plus.v1/yifu/admin/api/vo/UserVO.java
+5
-0
SysRoleMenuServiceImpl.java
...us.v1/yifu/admin/service/impl/SysRoleMenuServiceImpl.java
+12
-0
SysUserServiceImpl.java
...d.plus.v1/yifu/admin/service/impl/SysUserServiceImpl.java
+15
-9
SysRoleMapper.xml
...yifu-upms-biz/src/main/resources/mapper/SysRoleMapper.xml
+2
-0
SysUserMapper.xml
...yifu-upms-biz/src/main/resources/mapper/SysUserMapper.xml
+6
-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 @
a43dbc42
...
...
@@ -108,4 +108,13 @@ public interface ErrorCodes {
*/
String
SYS_ROLE_UPDATE_SYSTEM
=
"sys.role.update.system"
;
/**
* 系统内置用户不允许删除
*/
String
SYS_USER_DELETE_SYSTEM
=
"sys.user.delete.system"
;
/**
* 系统内置用户不允许修改
*/
String
SYS_USER_UPDATE_SYSTEM
=
"sys.user.update.system"
;
}
yifu-upms/yifu-upms-api/src/main/java/com/yifu.cloud.plus.v1/yifu/admin/api/entity/SysUser.java
View file @
a43dbc42
...
...
@@ -117,6 +117,9 @@ public class SysUser extends BaseEntity {
@Schema
(
description
=
"邮箱"
)
private
String
email
;
@Schema
(
description
=
"是否是系统内置"
)
private
String
systemFlag
;
/**
* 0-正常,1-删除
*/
...
...
yifu-upms/yifu-upms-api/src/main/java/com/yifu.cloud.plus.v1/yifu/admin/api/vo/UserVO.java
View file @
a43dbc42
...
...
@@ -122,4 +122,9 @@ public class UserVO implements Serializable {
* 邮箱
*/
private
String
email
;
/**
* 是否是系统内置
*/
private
String
systemFlag
;
}
yifu-upms/yifu-upms-biz/src/main/java/com/yifu.cloud.plus.v1/yifu/admin/service/impl/SysRoleMenuServiceImpl.java
View file @
a43dbc42
...
...
@@ -19,14 +19,19 @@ package com.yifu.cloud.plus.v1.yifu.admin.service.impl;
import
cn.hutool.core.util.StrUtil
;
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.SysRole
;
import
com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysRoleMenu
;
import
com.yifu.cloud.plus.v1.yifu.admin.mapper.SysRoleMenuMapper
;
import
com.yifu.cloud.plus.v1.yifu.admin.service.SysRoleMenuService
;
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.exception.ErrorCodes
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.MsgUtils
;
import
lombok.RequiredArgsConstructor
;
import
org.springframework.cache.CacheManager
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.util.Assert
;
import
java.util.Arrays
;
import
java.util.List
;
...
...
@@ -47,6 +52,8 @@ public class SysRoleMenuServiceImpl extends ServiceImpl<SysRoleMenuMapper, SysRo
private
final
CacheManager
cacheManager
;
private
final
SysRoleService
sysRoleService
;
/**
* @param roleId 角色
* @param menuIds 菜单ID拼成的字符串,每个id之间根据逗号分隔
...
...
@@ -55,6 +62,11 @@ public class SysRoleMenuServiceImpl extends ServiceImpl<SysRoleMenuMapper, SysRo
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
Boolean
saveRoleMenus
(
Long
roleId
,
String
menuIds
)
{
SysRole
sysRole
=
sysRoleService
.
getById
(
roleId
);
String
roleType
=
"0"
;
// 系统内置
Assert
.
state
(!
roleType
.
equals
(
sysRole
.
getSystemFlag
()),
MsgUtils
.
getMessage
(
ErrorCodes
.
SYS_ROLE_UPDATE_SYSTEM
));
this
.
remove
(
Wrappers
.<
SysRoleMenu
>
query
().
lambda
().
eq
(
SysRoleMenu:
:
getRoleId
,
roleId
));
if
(
StrUtil
.
isBlank
(
menuIds
))
{
...
...
yifu-upms/yifu-upms-biz/src/main/java/com/yifu.cloud.plus.v1/yifu/admin/service/impl/SysUserServiceImpl.java
View file @
a43dbc42
...
...
@@ -96,15 +96,6 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
userRole
.
setRoleId
(
roleId
);
return
userRole
;
}).
forEach
(
sysUserRoleMapper:
:
insert
);
// 保存用户岗位信息
// Optional.ofNullable(userDto.getPost()).ifPresent(posts -> {
// posts.stream().map(postId -> {
// SysUserPost userPost = new SysUserPost();
// userPost.setUserId(sysUser.getUserId());
// userPost.setPostId(postId);
// return userPost;
// }).forEach(sysUserPostMapper::insert);
// });
return
Boolean
.
TRUE
;
}
...
...
@@ -171,6 +162,10 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
if
(
null
==
user
){
return
Boolean
.
FALSE
;
}
String
type
=
"0"
;
// 系统内置
Assert
.
state
(!
type
.
equals
(
sysUser
.
getSystemFlag
()),
MsgUtils
.
getMessage
(
ErrorCodes
.
SYS_USER_DELETE_SYSTEM
));
sysUserRoleMapper
.
deleteByUserId
(
sysUser
.
getUserId
());
this
.
removeById
(
sysUser
.
getUserId
());
return
Boolean
.
TRUE
;
...
...
@@ -181,6 +176,11 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
public
Boolean
updateUserInfo
(
UserDTO
userDto
)
{
UserVO
userVO
=
baseMapper
.
getUserVoByUsername
(
userDto
.
getUsername
());
String
type
=
"0"
;
// 系统内置
Assert
.
state
(!
type
.
equals
(
userDto
.
getSystemFlag
()),
MsgUtils
.
getMessage
(
ErrorCodes
.
SYS_USER_UPDATE_SYSTEM
));
Assert
.
isTrue
(
ENCODER
.
matches
(
userDto
.
getPassword
(),
userVO
.
getPassword
()),
MsgUtils
.
getMessage
(
ErrorCodes
.
SYS_USER_UPDATE_PASSWORDERROR
));
...
...
@@ -198,6 +198,12 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
@Transactional
(
rollbackFor
=
Exception
.
class
)
@CacheEvict
(
value
=
CacheConstants
.
USER_DETAILS
,
key
=
"#userDto.username"
)
public
Boolean
updateUser
(
UserDTO
userDto
)
{
String
userType
=
"0"
;
// 系统内置
Assert
.
state
(!
userType
.
equals
(
userDto
.
getSystemFlag
()),
MsgUtils
.
getMessage
(
ErrorCodes
.
SYS_USER_UPDATE_SYSTEM
));
SysUser
sysUser
=
new
SysUser
();
BeanUtils
.
copyProperties
(
userDto
,
sysUser
);
sysUser
.
setUpdateTime
(
LocalDateTime
.
now
());
...
...
yifu-upms/yifu-upms-biz/src/main/resources/mapper/SysRoleMapper.xml
View file @
a43dbc42
...
...
@@ -23,6 +23,7 @@
<result
column=
"role_name"
property=
"roleName"
/>
<result
column=
"role_code"
property=
"roleCode"
/>
<result
column=
"role_desc"
property=
"roleDesc"
/>
<result
column=
"system_flag"
property=
"systemFlag"
/>
<result
column=
"create_time"
property=
"createTime"
/>
<result
column=
"update_time"
property=
"updateTime"
/>
<result
column=
"del_flag"
property=
"delFlag"
/>
...
...
@@ -38,6 +39,7 @@
r.role_name,
r.role_code,
r.role_desc,
r.system_flag,
r.del_flag,
r.create_time,
r.update_time,
...
...
yifu-upms/yifu-upms-biz/src/main/resources/mapper/SysUserMapper.xml
View file @
a43dbc42
...
...
@@ -35,6 +35,7 @@
<result
column=
"user_group"
property=
"userGroup"
/>
<result
column=
"post"
property=
"post"
/>
<result
column=
"email"
property=
"email"
/>
<result
column=
"system_flag"
property=
"systemFlag"
/>
<collection
property=
"roleList"
ofType=
"com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysRole"
select=
"com.yifu.cloud.plus.v1.yifu.admin.mapper.SysRoleMapper.listRolesByUserId"
column=
"user_id"
>
</collection>
...
...
@@ -58,6 +59,7 @@
<result
column=
"user_group"
property=
"userGroup"
/>
<result
column=
"post"
property=
"post"
/>
<result
column=
"email"
property=
"email"
/>
<result
column=
"system_flag"
property=
"systemFlag"
/>
<collection
property=
"roleList"
ofType=
"com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysRole"
>
<id
column=
"role_id"
property=
"roleId"
/>
<result
column=
"role_name"
property=
"roleName"
/>
...
...
@@ -85,6 +87,7 @@
sys_user.user_group AS userGroup,
sys_user.post,
sys_user.email,
sys_user.system_flag AS systemFlag,
r.role_id,
r.role_name,
r.role_code,
...
...
@@ -108,6 +111,7 @@
sys_user.user_group AS userGroup,
sys_user.post,
sys_user.email,
sys_user.system_flag AS systemFlag,
r.role_id,
r.role_name,
r.role_code,
...
...
@@ -153,6 +157,7 @@
sys_user.user_group AS userGroup,
sys_user.post,
sys_user.email,
sys_user.system_flag AS systemFlag,
sys_dept.name AS deptName
FROM sys_user
LEFT JOIN sys_dept ON sys_dept.dept_id = sys_user.dept_id
...
...
@@ -182,6 +187,7 @@
u.group,
u.user_group userGroup,
u.email,
u.system_flag systemFlag,
d.name AS deptName
FROM sys_user u
LEFT JOIN sys_dept d ON d.dept_id = u.dept_id
...
...
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