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
b637e85d
Commit
b637e85d
authored
Sep 04, 2019
by
guojuxing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
角色删除接口修改:验证是否正在被使用,如果是,不能被删除
parent
4b5d53e8
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
49 additions
and
0 deletions
+49
-0
TabSysUserRoleMapper.java
...in/java/com/gic/auth/dao/mapper/TabSysUserRoleMapper.java
+11
-0
UserRoleService.java
...e/src/main/java/com/gic/auth/service/UserRoleService.java
+10
-0
UserRoleServiceImpl.java
...n/java/com/gic/auth/service/impl/UserRoleServiceImpl.java
+9
-0
RoleApiServiceImpl.java
...a/com/gic/auth/service/outer/impl/RoleApiServiceImpl.java
+9
-0
TabSysUserRoleMapper.xml
...ervice/src/main/resources/mapper/TabSysUserRoleMapper.xml
+10
-0
No files found.
gic-platform-auth-service/src/main/java/com/gic/auth/dao/mapper/TabSysUserRoleMapper.java
View file @
b637e85d
...
...
@@ -72,4 +72,14 @@ public interface TabSysUserRoleMapper {
* @return java.util.List<com.gic.auth.entity.TabSysUserRole>
*/
List
<
TabSysUserRole
>
listUserRoleByUserId
(
@Param
(
"userId"
)
Integer
userId
);
/**
* 根据角色查询用户角色
* @Title: listUserRoleByRoleId
* @Description:
* @author guojuxing
* @param roleId
* @return java.util.List<com.gic.auth.entity.TabSysUserRole>
*/
List
<
TabSysUserRole
>
listUserRoleByRoleId
(
@Param
(
"roleId"
)
Integer
roleId
);
}
\ No newline at end of file
gic-platform-auth-service/src/main/java/com/gic/auth/service/UserRoleService.java
View file @
b637e85d
...
...
@@ -43,4 +43,14 @@ public interface UserRoleService {
* @return java.util.List<com.gic.auth.entity.TabSysUserRole>
*/
List
<
UserRoleDTO
>
listUserRoleByUserId
(
Integer
userId
);
/**
* 根据角色查询用户角色关联数据
* @Title: listUserRoleByRoleId
* @Description:
* @author guojuxing
* @param roleId
* @return java.util.List<com.gic.auth.entity.TabSysUserRole>
*/
List
<
TabSysUserRole
>
listUserRoleByRoleId
(
Integer
roleId
);
}
gic-platform-auth-service/src/main/java/com/gic/auth/service/impl/UserRoleServiceImpl.java
View file @
b637e85d
...
...
@@ -36,4 +36,13 @@ public class UserRoleServiceImpl implements UserRoleService{
}
return
new
ArrayList
<>();
}
@Override
public
List
<
TabSysUserRole
>
listUserRoleByRoleId
(
Integer
roleId
)
{
List
<
TabSysUserRole
>
list
=
tabSysUserRoleMapper
.
listUserRoleByRoleId
(
roleId
);
if
(
CollectionUtils
.
isNotEmpty
(
list
))
{
return
list
;
}
return
new
ArrayList
<>();
}
}
gic-platform-auth-service/src/main/java/com/gic/auth/service/outer/impl/RoleApiServiceImpl.java
View file @
b637e85d
...
...
@@ -6,6 +6,8 @@ import java.util.List;
import
com.gic.auth.dto.RoleListDTO
;
import
com.gic.auth.entity.TabSysRole
;
import
com.gic.auth.entity.TabSysUserRole
;
import
com.gic.auth.service.UserRoleService
;
import
com.gic.commons.util.EntityUtil
;
import
com.gic.commons.util.PageHelperUtils
;
import
com.gic.enterprise.error.ErrorCode
;
...
...
@@ -32,6 +34,8 @@ public class RoleApiServiceImpl implements RoleApiService{
private
RoleService
roleService
;
@Autowired
private
MenuRoleService
menuRoleService
;
@Autowired
private
UserRoleService
userRoleService
;
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Override
...
...
@@ -103,6 +107,11 @@ public class RoleApiServiceImpl implements RoleApiService{
if
(
record
==
null
)
{
return
ServiceResponse
.
failure
(
ErrorCode
.
PARAMETER_ERROR
.
getCode
(),
"角色数据有误,查无数据"
);
}
//判断是否正在被用户使用
List
<
TabSysUserRole
>
userRoleList
=
userRoleService
.
listUserRoleByRoleId
(
id
);
if
(
userRoleList
.
size
()
<
1
)
{
return
ServiceResponse
.
failure
(
ErrorCode
.
PARAMETER_ERROR
.
getCode
(),
"无法删除,正在被使用"
);
}
roleService
.
deleteById
(
id
);
return
ServiceResponse
.
success
();
}
...
...
gic-platform-auth-service/src/main/resources/mapper/TabSysUserRoleMapper.xml
View file @
b637e85d
...
...
@@ -128,4 +128,13 @@
where user_id = #{userId}
and status = 1
</select>
<select
id=
"listUserRoleByRoleId"
resultMap=
"BaseResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
from tab_sys_user_role
where role_id = #{userId}
and status = 1
</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