Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
long-tern-care-service
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
hubin
long-tern-care-service
Commits
494ee193
Commit
494ee193
authored
Mar 22, 2022
by
duanzhihong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改角色
parent
38d86c17
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
1 deletion
+27
-1
UserController.java
...va/com/hungraim/ltc/system/controller/UserController.java
+6
-1
SystemUserRoleMapper.java
...ava/com/hungraim/ltc/system/dao/SystemUserRoleMapper.java
+5
-0
SystemUserRoleMapper.xml
...ervice/src/main/resources/mapper/SystemUserRoleMapper.xml
+16
-0
No files found.
system/system-admin-service/src/main/java/com/hungraim/ltc/system/controller/UserController.java
View file @
494ee193
...
@@ -8,6 +8,7 @@ import com.hungraim.ltc.constant.Gender;
...
@@ -8,6 +8,7 @@ import com.hungraim.ltc.constant.Gender;
import
com.hungraim.ltc.pojo.entity.system.SystemUser
;
import
com.hungraim.ltc.pojo.entity.system.SystemUser
;
import
com.hungraim.ltc.pojo.entity.system.SystemUserRole
;
import
com.hungraim.ltc.pojo.entity.system.SystemUserRole
;
import
com.hungraim.ltc.pojo.vo.system.ReqUserInfo
;
import
com.hungraim.ltc.pojo.vo.system.ReqUserInfo
;
import
com.hungraim.ltc.system.dao.SystemUserRoleMapper
;
import
com.hungraim.ltc.system.service.ISystemUserRoleService
;
import
com.hungraim.ltc.system.service.ISystemUserRoleService
;
import
com.hungraim.ltc.system.service.ISystemUserService
;
import
com.hungraim.ltc.system.service.ISystemUserService
;
import
com.hungraim.ltc.system.service.impl.SystemUserRoleServiceImpl
;
import
com.hungraim.ltc.system.service.impl.SystemUserRoleServiceImpl
;
...
@@ -20,6 +21,7 @@ import org.springframework.beans.factory.annotation.Autowired;
...
@@ -20,6 +21,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder
;
import
org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
import
javax.annotation.Resource
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.List
;
...
@@ -37,6 +39,8 @@ public class UserController {
...
@@ -37,6 +39,8 @@ public class UserController {
private
final
ISystemUserService
userInfoService
;
private
final
ISystemUserService
userInfoService
;
private
final
ISystemUserRoleService
userRoleService
;
private
final
ISystemUserRoleService
userRoleService
;
@Resource
private
SystemUserRoleMapper
systemUserRoleMapper
;
@Autowired
@Autowired
public
UserController
(
SystemUserServiceImpl
userInfoService
,
SystemUserRoleServiceImpl
userRoleService
)
{
public
UserController
(
SystemUserServiceImpl
userInfoService
,
SystemUserRoleServiceImpl
userRoleService
)
{
this
.
userInfoService
=
userInfoService
;
this
.
userInfoService
=
userInfoService
;
...
@@ -253,7 +257,8 @@ public class UserController {
...
@@ -253,7 +257,8 @@ public class UserController {
List
<
Long
>
deleteRoleResources
=
roleResources
.
stream
()
List
<
Long
>
deleteRoleResources
=
roleResources
.
stream
()
.
map
(
SystemUserRole:
:
getRoleId
).
filter
(
id
->
!
reqUserInfo
.
getRoleIds
().
contains
(
id
))
.
map
(
SystemUserRole:
:
getRoleId
).
filter
(
id
->
!
reqUserInfo
.
getRoleIds
().
contains
(
id
))
.
collect
(
Collectors
.
toList
());
.
collect
(
Collectors
.
toList
());
userRoleService
.
removeByIds
(
deleteRoleResources
);
systemUserRoleMapper
.
removeByIds
(
deleteRoleResources
,
reqUserInfo
.
getId
());
// userRoleService.removeByIds(deleteRoleResources);
return
Result
.
success
(
"更新成功"
);
return
Result
.
success
(
"更新成功"
);
}
}
/**
/**
...
...
system/system-admin-service/src/main/java/com/hungraim/ltc/system/dao/SystemUserRoleMapper.java
View file @
494ee193
...
@@ -3,7 +3,12 @@ package com.hungraim.ltc.system.dao;
...
@@ -3,7 +3,12 @@ package com.hungraim.ltc.system.dao;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.hungraim.ltc.pojo.entity.system.SystemUserRole
;
import
com.hungraim.ltc.pojo.entity.system.SystemUserRole
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
@Mapper
@Mapper
public
interface
SystemUserRoleMapper
extends
BaseMapper
<
SystemUserRole
>
{
public
interface
SystemUserRoleMapper
extends
BaseMapper
<
SystemUserRole
>
{
Integer
removeByIds
(
@Param
(
"roleIds"
)
List
<
Long
>
roleIds
,
@Param
(
"id"
)
Long
id
);
}
}
system/system-admin-service/src/main/resources/mapper/SystemUserRoleMapper.xml
0 → 100644
View file @
494ee193
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.hungraim.ltc.system.dao.SystemUserRoleMapper"
>
<delete
id=
"removeByIds"
parameterType=
"list"
>
delete from LTC_USER_ROLE where ROLE_ID in
<foreach
collection=
"roleIds"
item=
"roleId"
open=
"("
separator=
","
close=
")"
>
#{roleId}
</foreach>
and USER_ID=#{id}
</delete>
</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