Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gic-platform-auth
Overview
Overview
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
base_platform_enterprise
gic-platform-auth
Commits
aa145dfc
Commit
aa145dfc
authored
Sep 06, 2019
by
guojuxing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增/编辑角色验证名称重复
parent
747a2c29
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
56 additions
and
0 deletions
+56
-0
TabSysRoleMapper.java
...c/main/java/com/gic/auth/dao/mapper/TabSysRoleMapper.java
+13
-0
RoleService.java
...rvice/src/main/java/com/gic/auth/service/RoleService.java
+12
-0
RoleServiceImpl.java
.../main/java/com/gic/auth/service/impl/RoleServiceImpl.java
+9
-0
RoleApiServiceImpl.java
...a/com/gic/auth/service/outer/impl/RoleApiServiceImpl.java
+10
-0
TabSysRoleMapper.xml
...th-service/src/main/resources/mapper/TabSysRoleMapper.xml
+12
-0
No files found.
gic-platform-auth-service/src/main/java/com/gic/auth/dao/mapper/TabSysRoleMapper.java
View file @
aa145dfc
...
...
@@ -77,4 +77,16 @@ public interface TabSysRoleMapper {
int
deleteByRoleId
(
@Param
(
"roleId"
)
Integer
roleId
);
List
<
TabSysRole
>
listRoleNoPage
(
@Param
(
"enterpriseId"
)
Integer
enterpriseId
);
/**
* 查询数量根据名称
* @Title: countRepeatRoleName
* @Description:
* @author guojuxing
* @param enterpriseId
* @param roleId
* @param roleName
* @return int
*/
int
countRepeatRoleName
(
@Param
(
"enterpriseId"
)
Integer
enterpriseId
,
@Param
(
"roleId"
)
Integer
roleId
,
@Param
(
"roleName"
)
String
roleName
);
}
\ No newline at end of file
gic-platform-auth-service/src/main/java/com/gic/auth/service/RoleService.java
View file @
aa145dfc
...
...
@@ -68,4 +68,16 @@ public interface RoleService {
* @return java.util.List<com.gic.auth.entity.TabSysRole>
*/
List
<
TabSysRole
>
listRole
(
Integer
enterpriseId
);
/**
* 权限名称是否重复
* @Title: isRepeatRoleName
* @Description:
* @author guojuxing
* @param enterpriseId
* @param roleId
* @param roleName
* @return boolean
*/
boolean
isRepeatRoleName
(
Integer
enterpriseId
,
Integer
roleId
,
String
roleName
);
}
gic-platform-auth-service/src/main/java/com/gic/auth/service/impl/RoleServiceImpl.java
View file @
aa145dfc
...
...
@@ -58,4 +58,13 @@ public class RoleServiceImpl implements RoleService{
public
List
<
TabSysRole
>
listRole
(
Integer
enterpriseId
)
{
return
tabSysRoleMapper
.
listRoleNoPage
(
enterpriseId
);
}
@Override
public
boolean
isRepeatRoleName
(
Integer
enterpriseId
,
Integer
roleId
,
String
roleName
)
{
int
count
=
tabSysRoleMapper
.
countRepeatRoleName
(
enterpriseId
,
roleId
,
roleName
);
if
(
count
>
0
)
{
return
true
;
}
return
false
;
}
}
gic-platform-auth-service/src/main/java/com/gic/auth/service/outer/impl/RoleApiServiceImpl.java
View file @
aa145dfc
...
...
@@ -48,6 +48,11 @@ public class RoleApiServiceImpl implements RoleApiService{
dto
.
setCreateTime
(
new
Date
());
dto
.
setStatus
(
1
);
//验证名称不能重复
if
(
roleService
.
isRepeatRoleName
(
dto
.
getEnterpriseId
(),
null
,
dto
.
getRoleName
()))
{
return
ServiceResponse
.
failure
(
ErrorCode
.
PARAMETER_ERROR
.
getCode
(),
"权限名称重复"
);
}
Integer
roleId
=
roleService
.
save
(
dto
);
//删除之前的角色菜单数据
...
...
@@ -72,6 +77,11 @@ public class RoleApiServiceImpl implements RoleApiService{
return
paramValid
;
}
//验证名称不能重复
if
(
roleService
.
isRepeatRoleName
(
record
.
getEnterpriseId
(),
dto
.
getRoleId
(),
dto
.
getRoleName
()))
{
return
ServiceResponse
.
failure
(
ErrorCode
.
PARAMETER_ERROR
.
getCode
(),
"权限名称重复"
);
}
roleService
.
update
(
dto
);
//删除之前的角色菜单数据
menuRoleService
.
deleteByRoleId
(
dto
.
getRoleId
());
...
...
gic-platform-auth-service/src/main/resources/mapper/TabSysRoleMapper.xml
View file @
aa145dfc
...
...
@@ -130,4 +130,15 @@
where status = 1
and enterprise_id = #{enterpriseId}
</select>
<select
id=
"countRepeatRoleName"
resultType=
"int"
>
select count(1) from tab_sys_role
where status = 1
<if
test=
"roleId != null"
>
and role_id
<![CDATA[ <> ]]>
#{roleId}
</if>
and enterprise_id = #{enterpriseId}
and role_name = #{roleName}
</select>
</mapper>
\ No newline at end of file
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