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 1c3c9d10
authored
Oct 08, 2023
by
huangjinxin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:重写角色修改
1 parent
5bdc2b37
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
4 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 @
1c3c9d1
...
@@ -49,7 +49,8 @@ public class RoleController implements IRole {
...
@@ -49,7 +49,8 @@ public class RoleController implements IRole {
@Override
@Override
public
Result
<
RoleInfo
>
updateRole
(
@Validated
RoleInfo
roleInfo
)
{
public
Result
<
RoleInfo
>
updateRole
(
@Validated
RoleInfo
roleInfo
)
{
return
roleService
.
updateRole
(
roleInfo
);
roleInfo
=
roleService
.
updateRole
(
roleInfo
);
return
Result
.
success
(
roleInfo
);
}
}
@Override
@Override
...
...
project-user/src/main/java/com/dituhui/pea/user/service/RoleService.java
View file @
1c3c9d1
...
@@ -101,10 +101,11 @@ public class RoleService {
...
@@ -101,10 +101,11 @@ public class RoleService {
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
R
esult
<
RoleInfo
>
updateRole
(
RoleInfo
roleInfo
)
{
public
R
oleInfo
updateRole
(
RoleInfo
roleInfo
)
{
RoleEntity
entity
=
roleDao
.
findById
(
roleInfo
.
getId
()).
orElse
(
null
);
RoleEntity
entity
=
roleDao
.
findById
(
roleInfo
.
getId
()).
orElse
(
null
);
if
(
ObjectUtil
.
isEmpty
(
entity
))
{
if
(
ObjectUtil
.
isEmpty
(
entity
))
{
return
Result
.
failed
(
StatusCodeEnum
.
ROLE_DOES_NOT_EXIST
,
null
);
// return Result.failed(StatusCodeEnum.ROLE_DOES_NOT_EXIST, null);
return
roleInfo
;
}
}
RoleEntity
roleEntity
=
BeanUtil
.
copyProperties
(
roleInfo
,
RoleEntity
.
class
);
RoleEntity
roleEntity
=
BeanUtil
.
copyProperties
(
roleInfo
,
RoleEntity
.
class
);
roleEntity
.
setCreatedBy
(
entity
.
getCreatedBy
());
roleEntity
.
setCreatedBy
(
entity
.
getCreatedBy
());
...
@@ -120,7 +121,7 @@ public class RoleService {
...
@@ -120,7 +121,7 @@ public class RoleService {
}
}
}
}
roleInfo
=
BeanUtil
.
copyProperties
(
roleEntity
,
RoleInfo
.
class
);
roleInfo
=
BeanUtil
.
copyProperties
(
roleEntity
,
RoleInfo
.
class
);
return
Result
.
success
(
roleInfo
)
;
return
roleInfo
;
}
}
@Transactional
(
rollbackFor
=
Exception
.
class
)
@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