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
669fcc2c
Commit
669fcc2c
authored
Jan 30, 2023
by
“xuhd”
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1、解决修复用户管理修改用户信息会新增一条数据
2、解决修复角色权限无法保存问题
parent
a1dc9f09
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
29 additions
and
2 deletions
+29
-2
RoleController.java
...va/com/hungraim/ltc/system/controller/RoleController.java
+9
-1
UserController.java
...va/com/hungraim/ltc/system/controller/UserController.java
+1
-1
SystemRoleResourceMapper.java
...com/hungraim/ltc/system/dao/SystemRoleResourceMapper.java
+3
-0
SystemRoleResourceMapper.xml
...ce/src/main/resources/mapper/SystemRoleResourceMapper.xml
+16
-0
No files found.
system/system-admin-service/src/main/java/com/hungraim/ltc/system/controller/RoleController.java
View file @
669fcc2c
package
com
.
hungraim
.
ltc
.
system
.
controller
;
package
com
.
hungraim
.
ltc
.
system
.
controller
;
import
cn.hutool.core.util.StrUtil
;
import
cn.hutool.core.util.StrUtil
;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.hungraim.ltc.pojo.entity.system.SystemRole
;
import
com.hungraim.ltc.pojo.entity.system.SystemRole
;
import
com.hungraim.ltc.pojo.entity.system.SystemRoleResource
;
import
com.hungraim.ltc.pojo.entity.system.SystemRoleResource
;
import
com.hungraim.ltc.pojo.vo.system.ReqRoleInfo
;
import
com.hungraim.ltc.pojo.vo.system.ReqRoleInfo
;
import
com.hungraim.ltc.system.dao.SystemRoleResourceMapper
;
import
com.hungraim.ltc.system.service.ISystemRoleResourceService
;
import
com.hungraim.ltc.system.service.ISystemRoleResourceService
;
import
com.hungraim.ltc.system.service.ISystemRoleService
;
import
com.hungraim.ltc.system.service.ISystemRoleService
;
import
com.hungraim.ltc.util.Result
;
import
com.hungraim.ltc.util.Result
;
...
@@ -14,6 +16,7 @@ import lombok.extern.slf4j.Slf4j;
...
@@ -14,6 +16,7 @@ import lombok.extern.slf4j.Slf4j;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
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
;
...
@@ -29,6 +32,8 @@ public class RoleController {
...
@@ -29,6 +32,8 @@ public class RoleController {
@Autowired
@Autowired
private
ISystemRoleResourceService
roleResourceService
;
private
ISystemRoleResourceService
roleResourceService
;
@Resource
private
SystemRoleResourceMapper
systemRoleResourceMapper
;
@Autowired
@Autowired
private
ISystemRoleService
roleService
;
private
ISystemRoleService
roleService
;
...
@@ -177,7 +182,10 @@ public class RoleController {
...
@@ -177,7 +182,10 @@ public class RoleController {
List
<
Long
>
deleteRoleResources
=
roleResources
.
stream
()
List
<
Long
>
deleteRoleResources
=
roleResources
.
stream
()
.
map
(
SystemRoleResource:
:
getResourceId
).
filter
(
resourceId
->
!
reqRoleInfo
.
getResource
().
contains
(
resourceId
))
.
map
(
SystemRoleResource:
:
getResourceId
).
filter
(
resourceId
->
!
reqRoleInfo
.
getResource
().
contains
(
resourceId
))
.
collect
(
Collectors
.
toList
());
.
collect
(
Collectors
.
toList
());
roleResourceService
.
removeByIds
(
deleteRoleResources
);
if
(!
deleteRoleResources
.
isEmpty
()){
systemRoleResourceMapper
.
removeByIds
(
deleteRoleResources
,
reqRoleInfo
.
getId
());
}
return
Result
.
success
(
"更新成功"
);
return
Result
.
success
(
"更新成功"
);
}
}
...
...
system/system-admin-service/src/main/java/com/hungraim/ltc/system/controller/UserController.java
View file @
669fcc2c
...
@@ -229,7 +229,7 @@ public class UserController {
...
@@ -229,7 +229,7 @@ public class UserController {
}
}
if
(
flag
)
{
if
(
flag
)
{
systemUser
.
setUpdatedTime
(
new
Date
());
systemUser
.
setUpdatedTime
(
new
Date
());
userInfoService
.
save
(
systemUser
);
userInfoService
.
updateById
(
systemUser
);
}
}
//查询该角色下所有的资源数据
//查询该角色下所有的资源数据
List
<
SystemUserRole
>
roleResources
=
userRoleService
.
list
(
new
LambdaQueryWrapper
<
SystemUserRole
>().
eq
(
SystemUserRole:
:
getUserId
,
reqUserInfo
.
getId
()));
List
<
SystemUserRole
>
roleResources
=
userRoleService
.
list
(
new
LambdaQueryWrapper
<
SystemUserRole
>().
eq
(
SystemUserRole:
:
getUserId
,
reqUserInfo
.
getId
()));
...
...
system/system-admin-service/src/main/java/com/hungraim/ltc/system/dao/SystemRoleResourceMapper.java
View file @
669fcc2c
...
@@ -3,6 +3,7 @@ package com.hungraim.ltc.system.dao;
...
@@ -3,6 +3,7 @@ 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.SystemRoleResource
;
import
com.hungraim.ltc.pojo.entity.system.SystemRoleResource
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Param
;
import
org.apache.ibatis.annotations.Select
;
import
org.apache.ibatis.annotations.Select
;
import
java.util.List
;
import
java.util.List
;
...
@@ -22,4 +23,6 @@ public interface SystemRoleResourceMapper extends BaseMapper<SystemRoleResource>
...
@@ -22,4 +23,6 @@ public interface SystemRoleResourceMapper extends BaseMapper<SystemRoleResource>
*/
*/
@Select
(
"SELECT ROLE_ID FROM LTC_ROLE_RESOURCE WHERE RESOURCE_ID = #{resourceId} "
)
@Select
(
"SELECT ROLE_ID FROM LTC_ROLE_RESOURCE WHERE RESOURCE_ID = #{resourceId} "
)
List
<
Long
>
listRoleIds
(
long
resourceId
);
List
<
Long
>
listRoleIds
(
long
resourceId
);
Integer
removeByIds
(
@Param
(
"resourceIds"
)
List
<
Long
>
resourceIds
,
@Param
(
"id"
)
Long
id
);
}
}
system/system-admin-service/src/main/resources/mapper/SystemRoleResourceMapper.xml
0 → 100644
View file @
669fcc2c
<?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.SystemRoleResourceMapper"
>
<delete
id=
"removeByIds"
parameterType=
"list"
>
delete from LTC_ROLE_RESOURCE where RESOURCE_ID in
<foreach
collection=
"resourceIds"
item=
"resourceId"
open=
"("
separator=
","
close=
")"
>
#{resourceId}
</foreach>
and ROLE_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