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
526e05aa
Commit
526e05aa
authored
Jun 14, 2022
by
fangxinjiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
代码优化
parent
e0dbda54
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
105 additions
and
8 deletions
+105
-8
CommonConstants.java
...ud.plus.v1/yifu/common/core/constant/CommonConstants.java
+0
-2
ErrorCodes.java
....cloud.plus.v1/yifu/common/core/exception/ErrorCodes.java
+14
-0
messages_zh_CN.properties
...on-core/src/main/resources/i18n/messages_zh_CN.properties
+9
-5
MenuController.java
...u.cloud.plus.v1/yifu/admin/controller/MenuController.java
+23
-0
RoleController.java
...u.cloud.plus.v1/yifu/admin/controller/RoleController.java
+13
-1
SysRoleService.java
...yifu.cloud.plus.v1/yifu/admin/service/SysRoleService.java
+8
-0
SysMenuServiceImpl.java
...d.plus.v1/yifu/admin/service/impl/SysMenuServiceImpl.java
+1
-0
SysRoleServiceImpl.java
...d.plus.v1/yifu/admin/service/impl/SysRoleServiceImpl.java
+37
-0
No files found.
yifu-common/yifu-common-core/src/main/java/com/yifu.cloud.plus.v1/yifu/common/core/constant/CommonConstants.java
View file @
526e05aa
...
...
@@ -128,6 +128,4 @@ public interface CommonConstants {
* hgw 2022-6-9 17:36:35
*/
String
DOWN_LINE
=
"_"
;
String
EXIST_ENTITY
=
"已存在唯一性的数据"
;
}
yifu-common/yifu-common-core/src/main/java/com/yifu.cloud.plus.v1/yifu/common/core/exception/ErrorCodes.java
View file @
526e05aa
...
...
@@ -127,4 +127,18 @@ public interface ErrorCodes {
* 系统内置用户不允许修改
*/
String
SYS_USER_UPDATE_SYSTEM
=
"sys.user.update.system"
;
/**
* 已存在对应标识的角色
*/
String
SYS_ROLE_UPDATE_ERROR_CODE_EXIST
=
"sys.role.update.error.code.exist"
;
/**
* 已存在对应名称的菜单
*/
String
SYS_MENU_ADD_NAME_EXIST
=
"sys_menu_add_name_exist"
;
/**
* 已存在对应名称的角色
*/
String
SYS_ROLE_UPDATE_ERROR_NAME_EXIST
=
"sys.role.update.error.name.exist"
;
}
yifu-common/yifu-common-core/src/main/resources/i18n/messages_zh_CN.properties
View file @
526e05aa
...
...
@@ -2,6 +2,8 @@ sys.user.update.passwordError=\u539F\u5BC6\u7801\u9519\u8BEF\uFF0C\u4FEE\u6539\u
sys.user.query.error
=
\u
83B7
\u
53D6
\u
5F53
\u
524D
\u7528\u6237\u
4FE1
\u
606F
\u5931\u
8D25
sys.user.username.existing
=
{0}
\u7528\u6237\u
540D
\u
5DF2
\u
5B58
\u5728
sys.user.userInfo.empty
=
{0}
\u7528\u6237\u
4FE1
\u
606F
\u
4E3A
\u
7A7A
sys.user.update.system
=
\u
7CFB
\u
7EDF
\u5185\u
7F6E
\u7528\u6237\u
4E0D
\u
80FD
\u
4FEE
\u6539
sys.user.delete.system
=
\u
7CFB
\u
7EDF
\u5185\u
7F6E
\u7528\u6237\u
4E0D
\u
80FD
\u5220\u9664
sys.dept.deptName.inexistence
=
{0}
\u
90E8
\u
95E8
\u
540D
\u
79F0
\u
4E0D
\u
5B58
\u5728
...
...
@@ -10,27 +12,29 @@ sys.post.nameOrCode.existing={0} {1} \u5C97\u4F4D\u540D\u6216\u5C97\u4F4D\u7F16\
sys.role.roleName.inexistence
=
{0}
\u
89D2
\u8272\u
540D
\u
79F0
\u
4E0D
\u
5B58
\u5728
sys.role.nameOrCode.existing
=
{0} {1}
\u
89D2
\u8272\u
540D
\u6216\u
89D2
\u8272\u
7F16
\u7801\u
5DF2
\u
7ECF
\u
5B58
\u5728
sys.role.update.error.name.exist
=
\u
5DF2
\u
5B58
\u5728\u
5BF9
\u
5E94
\u
540D
\u
79F0
\u7684\u
89D2
\u8272
sys.param.delete.system
=
\u
7CFB
\u
7EDF
\u5185\u
7F6E
\u
53C2
\u6570\u
4E0D
\u
80FD
\u5220\u9664
sys.param.config.error
=
{0}
\u
7CFB
\u
7EDF
\u
53C2
\u6570\u
914D
\u
7F6E
\u9519\u
8BEF
sys.menu.delete.existing
=
\u
83DC
\u5355\u
542B
\u6709\u
4E0B
\u
7EA7
\u
4E0D
\u
80FD
\u5220\u9664
sys.menu.delete.system
=
\u
7CFB
\u
7EDF
\u5185\u
7F6E
\u
83DC
\u5355\u
4E0D
\u
80FD
\u5220\u9664
sys.menu.add.parent.error
=
\u
83DC
\u5355\u
4E0A
\u
7EA7
\u
83DC
\u5355\u
4E0D
\u
53EF
\u
4E3A
\u6570\u
636E
\u6743\u9650\u
914D
\u
7F6E
\u
7C7B
\u
83DC
\u5355
sys_menu_add_name_exist
=
"
\u
5DF2
\u
5B58
\u5728\u
5BF9
\u
5E94
\u
540D
\u
79F0
\u7684\u
83DC
\u5355
"
sys.app.sms.often
=
\u
9A8C
\u
8BC1
\u7801\u
53D1
\u9001\u
8FC7
\u9891\u
7E41
sys.app.phone.unregistered
=
{0}
\u
624B
\u
673A
\u
53F7
\u
672A
\u
6CE8
\u
518C
sys.dict.delete.system
=
\u
7CFB
\u
7EDF
\u5185\u
7F6E
\u
5B57
\u5178\u9879\u
76EE
\u
4E0D
\u
80FD
\u5220\u9664
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
\u5220\u9664
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
sys.role.update.error.code.exist
=
"
\u
5DF2
\u
5B58
\u5728\u
5BF9
\u
5E94
\u6807\u
8BC6
\u7684\u
89D2
\u8272
"
sys.role.delete.existing.user
=
\u
8BE5
\u
89D2
\u8272\u
4E0B
\u
8FD8
\u6709\u5173\u8054\u7684\u7528\u6237\u
FF0C
\u
8BF7
\u5148\u
5C06
\u7528\u6237\u
8F6C
\u
79FB
\u5230\u5176\u
4ED6
\u
89D2
\u8272
!
sys.user.update.system
=
\u
7CFB
\u
7EDF
\u5185\u
7F6E
\u7528\u6237\u
4E0D
\u
80FD
\u
4FEE
\u6539
sys.user.delete.system
=
\u
7CFB
\u
7EDF
\u5185\u
7F6E
\u7528\u6237\u
4E0D
\u
80FD
\u5220\u9664
yifu-upms/yifu-upms-biz/src/main/java/com/yifu.cloud.plus.v1/yifu/admin/controller/MenuController.java
View file @
526e05aa
...
...
@@ -18,9 +18,14 @@ package com.yifu.cloud.plus.v1.yifu.admin.controller;
import
cn.hutool.core.lang.tree.Tree
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysMenu
;
import
com.yifu.cloud.plus.v1.yifu.admin.service.SysMenuService
;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants
;
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.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog
;
import
com.yifu.cloud.plus.v1.yifu.common.security.util.SecurityUtils
;
...
...
@@ -33,6 +38,7 @@ import javax.validation.Valid;
import
java.util.Collection
;
import
java.util.List
;
import
java.util.Set
;
import
java.util.WeakHashMap
;
import
java.util.stream.Collectors
;
/**
...
...
@@ -124,6 +130,14 @@ public class MenuController {
@PostMapping
@PreAuthorize
(
"@pms.hasPermission('sys_menu_add')"
)
public
R
<
SysMenu
>
save
(
@Valid
@RequestBody
SysMenu
sysMenu
)
{
if
(
CommonConstants
.
ZERO_STRING
.
equals
(
sysMenu
.
getType
())){
SysMenu
sm
=
sysMenuService
.
getOne
(
Wrappers
.<
SysMenu
>
query
().
lambda
()
.
eq
(
SysMenu:
:
getName
,
sysMenu
.
getName
())
.
eq
(
SysMenu:
:
getDelFlag
,
CommonConstants
.
ZERO_STRING
));
if
(
Common
.
isNotNull
(
sm
)){
return
R
.
failed
(
MsgUtils
.
getMessage
(
ErrorCodes
.
SYS_MENU_ADD_NAME_EXIST
));
}
}
SysMenu
menu
=
sysMenuService
.
saveAsso
(
sysMenu
);
return
R
.
ok
(
menu
);
}
...
...
@@ -149,6 +163,15 @@ public class MenuController {
@PutMapping
@PreAuthorize
(
"@pms.hasPermission('sys_menu_edit')"
)
public
R
<
Boolean
>
update
(
@Valid
@RequestBody
SysMenu
sysMenu
)
{
if
(
CommonConstants
.
ZERO_STRING
.
equals
(
sysMenu
.
getType
())){
SysMenu
sm
=
sysMenuService
.
getOne
(
Wrappers
.<
SysMenu
>
query
().
lambda
()
.
eq
(
SysMenu:
:
getName
,
sysMenu
.
getName
())
.
eq
(
SysMenu:
:
getDelFlag
,
CommonConstants
.
ZERO_STRING
)
.
ne
(
SysMenu:
:
getMenuId
,
sysMenu
.
getMenuId
()));
if
(
Common
.
isNotNull
(
sm
)){
return
R
.
failed
(
MsgUtils
.
getMessage
(
ErrorCodes
.
SYS_MENU_ADD_NAME_EXIST
));
}
}
return
R
.
ok
(
sysMenuService
.
updateMenuById
(
sysMenu
));
}
...
...
yifu-upms/yifu-upms-biz/src/main/java/com/yifu.cloud.plus.v1/yifu/admin/controller/RoleController.java
View file @
526e05aa
...
...
@@ -26,6 +26,7 @@ import com.yifu.cloud.plus.v1.yifu.admin.api.vo.RoleExcelVO;
import
com.yifu.cloud.plus.v1.yifu.admin.api.vo.RoleVo
;
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.util.Common
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.R
;
import
com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog
;
import
io.swagger.v3.oas.annotations.tags.Tag
;
...
...
@@ -70,9 +71,16 @@ public class RoleController {
@PostMapping
@PreAuthorize
(
"@pms.hasPermission('sys_role_add')"
)
public
R
<
Boolean
>
save
(
@Valid
@RequestBody
SysRole
sysRole
)
{
R
<
Boolean
>
check
=
sysRoleService
.
getBooleanR
(
sysRole
);
if
(
Common
.
isNotNull
(
check
))
{
return
check
;
}
return
R
.
ok
(
sysRoleService
.
save
(
sysRole
));
}
/**
* 修改角色
* @param sysRole 角色信息
...
...
@@ -81,7 +89,11 @@ public class RoleController {
@SysLog
(
"修改角色"
)
@PutMapping
@PreAuthorize
(
"@pms.hasPermission('sys_role_edit')"
)
public
R
update
(
@Valid
@RequestBody
SysRole
sysRole
)
{
public
R
<
Boolean
>
update
(
@Valid
@RequestBody
SysRole
sysRole
)
{
R
<
Boolean
>
check
=
sysRoleService
.
getBooleanR
(
sysRole
);
if
(
Common
.
isNotNull
(
check
))
{
return
check
;
}
sysRoleService
.
updateRoleById
(
sysRole
);
return
R
.
ok
();
}
...
...
yifu-upms/yifu-upms-biz/src/main/java/com/yifu.cloud.plus.v1/yifu/admin/service/SysRoleService.java
View file @
526e05aa
...
...
@@ -64,4 +64,12 @@ public interface SysRoleService extends IService<SysRole> {
*/
void
updateRoleById
(
SysRole
sysRole
);
/**
* @Author fxj
* @Description 验证角色名称和角色编码
* @Date 17:23 2022/6/14
* @Param
* @return
**/
R
<
Boolean
>
getBooleanR
(
SysRole
sysRole
);
}
yifu-upms/yifu-upms-biz/src/main/java/com/yifu.cloud.plus.v1/yifu/admin/service/impl/SysMenuServiceImpl.java
View file @
526e05aa
...
...
@@ -239,6 +239,7 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
extra
.
put
(
"sortOrder"
,
menu
.
getSortOrder
());
extra
.
put
(
"keepAlive"
,
menu
.
getKeepAlive
());
extra
.
put
(
"systemFlag"
,
menu
.
getSystemFlag
());
extra
.
put
(
"flag"
,
menu
.
getFlag
());
node
.
setExtra
(
extra
);
return
node
;
};
...
...
yifu-upms/yifu-upms-biz/src/main/java/com/yifu.cloud.plus.v1/yifu/admin/service/impl/SysRoleServiceImpl.java
View file @
526e05aa
...
...
@@ -183,5 +183,42 @@ public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole> impl
MsgUtils
.
getMessage
(
ErrorCodes
.
SYS_ROLE_UPDATE_SYSTEM
));
this
.
updateById
(
sysRole
);
}
/**
* @Author fxj
* @Description 验证角色名称和角色编码
* @Date 17:23 2022/6/14
* @Param type 0 名称 1 编码
* @return
**/
@Override
public
R
<
Boolean
>
getBooleanR
(
SysRole
sysRole
)
{
SysRole
role
=
baseMapper
.
selectOne
(
buildCheckQueryWrapper
(
sysRole
,
CommonConstants
.
ONE_STRING
));
if
(
Common
.
isNotNull
(
role
)
&&
Common
.
isNotNull
(
sysRole
.
getRoleCode
())){
return
R
.
failed
(
MsgUtils
.
getMessage
(
ErrorCodes
.
SYS_ROLE_UPDATE_ERROR_CODE_EXIST
));
}
role
=
baseMapper
.
selectOne
(
buildCheckQueryWrapper
(
sysRole
,
CommonConstants
.
ZERO_STRING
));
if
(
Common
.
isNotNull
(
role
)
&&
Common
.
isNotNull
(
sysRole
.
getRoleName
())){
return
R
.
failed
(
MsgUtils
.
getMessage
(
ErrorCodes
.
SYS_ROLE_UPDATE_ERROR_NAME_EXIST
));
}
return
null
;
}
private
LambdaQueryWrapper
buildCheckQueryWrapper
(
SysRole
sysRole
,
String
type
)
{
LambdaQueryWrapper
<
SysRole
>
wrapper
=
Wrappers
.
lambdaQuery
();
if
(
Common
.
isNotNull
(
sysRole
.
getRoleId
())){
wrapper
.
ne
(
SysRole:
:
getRoleId
,
sysRole
.
getRoleId
());
}
if
(
CommonConstants
.
ZERO_STRING
.
equals
(
type
)){
if
(
StrUtil
.
isNotBlank
(
sysRole
.
getRoleName
())){
wrapper
.
likeRight
(
SysRole:
:
getRoleName
,
sysRole
.
getRoleName
());
}
}
if
(
CommonConstants
.
ONE_STRING
.
equals
(
type
)){
if
(
StrUtil
.
isNotBlank
(
sysRole
.
getRoleCode
())){
wrapper
.
likeRight
(
SysRole:
:
getRoleCode
,
sysRole
.
getRoleCode
());
}
}
wrapper
.
last
(
CommonConstants
.
LAST_ONE_SQL
);
return
wrapper
;
}
}
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