Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
yangxiujun
/
paidan_demo
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 5bdc2b37
authored
Oct 08, 2023
by
huangjinxin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:重写角色修改
1 parent
0fb8d76f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
8 deletions
project-user/src/main/java/com/dituhui/pea/user/controller/RoleController.java
project-user/src/main/java/com/dituhui/pea/user/service/RoleService.java
project-user/src/main/java/com/dituhui/pea/user/controller/RoleController.java
View file @
5bdc2b3
...
...
@@ -49,8 +49,7 @@ public class RoleController implements IRole {
@Override
public
Result
<
RoleInfo
>
updateRole
(
@Validated
RoleInfo
roleInfo
)
{
roleInfo
=
roleService
.
updateRole
(
roleInfo
);
return
Result
.
success
(
roleInfo
);
return
roleService
.
updateRole
(
roleInfo
);
}
@Override
...
...
project-user/src/main/java/com/dituhui/pea/user/service/RoleService.java
View file @
5bdc2b3
...
...
@@ -33,10 +33,7 @@ import org.springframework.transaction.annotation.Transactional;
import
org.springframework.transaction.support.DefaultTransactionDefinition
;
import
java.time.LocalDateTime
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.*
;
import
java.util.stream.Collectors
;
/**
...
...
@@ -104,8 +101,14 @@ public class RoleService {
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
RoleInfo
updateRole
(
RoleInfo
roleInfo
)
{
public
Result
<
RoleInfo
>
updateRole
(
RoleInfo
roleInfo
)
{
RoleEntity
entity
=
roleDao
.
findById
(
roleInfo
.
getId
()).
orElse
(
null
);
if
(
ObjectUtil
.
isEmpty
(
entity
))
{
return
Result
.
failed
(
StatusCodeEnum
.
ROLE_DOES_NOT_EXIST
,
null
);
}
RoleEntity
roleEntity
=
BeanUtil
.
copyProperties
(
roleInfo
,
RoleEntity
.
class
);
roleEntity
.
setCreatedBy
(
entity
.
getCreatedBy
());
roleEntity
.
setCreatedTime
(
entity
.
getCreatedTime
());
roleEntity
=
roleDao
.
save
(
roleEntity
);
List
<
RoleResourceInfo
>
resourceInfos
=
roleInfo
.
getResourceInfos
();
if
(
CollectionUtils
.
isNotEmpty
(
resourceInfos
))
{
...
...
@@ -117,7 +120,7 @@ public class RoleService {
}
}
roleInfo
=
BeanUtil
.
copyProperties
(
roleEntity
,
RoleInfo
.
class
);
return
roleInfo
;
return
Result
.
success
(
roleInfo
)
;
}
@Transactional
(
rollbackFor
=
Exception
.
class
)
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment