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 6fa6292c
authored
Oct 07, 2023
by
huangjinxin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix:实验代码
1 parent
e655fe84
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
45 additions
and
3 deletions
project-interface/src/main/java/com/dituhui/pea/user/IRole.java
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-interface/src/main/java/com/dituhui/pea/user/IRole.java
View file @
6fa6292
...
@@ -31,6 +31,16 @@ public interface IRole {
...
@@ -31,6 +31,16 @@ public interface IRole {
/**
/**
* 添加角色
*
* @param roleInfo 角色信息
* @return
*/
@RequestMapping
(
value
=
"/pea-user/role/delete2"
,
method
=
RequestMethod
.
POST
)
Result
<
RoleInfo
>
deleteRole2
(
@RequestBody
RoleInfo
roleInfo
);
/**
* 修改角色
* 修改角色
*
*
* @param roleInfo 角色信息
* @param roleInfo 角色信息
...
...
project-user/src/main/java/com/dituhui/pea/user/controller/RoleController.java
View file @
6fa6292
...
@@ -40,6 +40,14 @@ public class RoleController implements IRole {
...
@@ -40,6 +40,14 @@ public class RoleController implements IRole {
}
}
@Override
public
Result
<
RoleInfo
>
deleteRole2
(
@Validated
RoleInfo
roleInfo
)
{
roleInfo
=
roleService
.
addRole
(
roleInfo
);
return
Result
.
success
(
roleInfo
);
}
@Override
@Override
public
Result
<
RoleInfo
>
updateRole
(
@Validated
RoleInfo
roleInfo
)
{
public
Result
<
RoleInfo
>
updateRole
(
@Validated
RoleInfo
roleInfo
)
{
roleInfo
=
roleService
.
updateRole
(
roleInfo
);
roleInfo
=
roleService
.
updateRole
(
roleInfo
);
...
...
project-user/src/main/java/com/dituhui/pea/user/service/RoleService.java
View file @
6fa6292
...
@@ -114,9 +114,6 @@ public class RoleService {
...
@@ -114,9 +114,6 @@ public class RoleService {
public
void
deleteRole
(
String
roleId
)
{
public
void
deleteRole
(
String
roleId
)
{
// 查询角色是否存在
// 查询角色是否存在
RoleEntity
roleEntity
=
roleDao
.
findById
(
roleId
).
orElse
(
null
);
RoleEntity
roleEntity
=
roleDao
.
findById
(
roleId
).
orElse
(
null
);
roleEntity
.
setUpdatedTime
(
new
Date
());
roleEntity
.
setNotes
(
"chakhca"
);
roleDao
.
save
(
roleEntity
);
if
(
ObjectUtil
.
isNull
(
roleEntity
))
{
if
(
ObjectUtil
.
isNull
(
roleEntity
))
{
throw
new
BusinessException
(
StatusCodeEnum
.
ROLE_DOES_NOT_EXIST
);
throw
new
BusinessException
(
StatusCodeEnum
.
ROLE_DOES_NOT_EXIST
);
}
}
...
@@ -128,6 +125,33 @@ public class RoleService {
...
@@ -128,6 +125,33 @@ public class RoleService {
roleResourceDao
.
deleteByRoleId
(
roleId
);
roleResourceDao
.
deleteByRoleId
(
roleId
);
}
}
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
RoleInfo
deleteRole2
(
RoleInfo
roleInfo
)
{
String
name
=
roleInfo
.
getName
();
String
createdBy
=
roleInfo
.
getCreatedBy
();
String
notes
=
roleInfo
.
getNotes
();
RoleEntity
roleEntity
=
new
RoleEntity
();
roleEntity
.
setName
(
name
);
roleEntity
.
setCreatedBy
(
createdBy
);
roleEntity
.
setCreatedTime
(
new
Date
());
roleEntity
.
setNotes
(
notes
);
// RoleEntity roleEntity = assembleRole(roleInfo);
log
.
info
(
"新增角色入参:"
+
JSONObject
.
toJSONString
(
roleEntity
));
roleEntity
=
roleDao
.
save
(
roleEntity
);
// roleInfo = BeanUtil.copyProperties(roleEntity, RoleInfo.class);
roleInfo
.
setId
(
roleEntity
.
getId
());
List
<
RoleResourceInfo
>
resourceInfos
=
roleInfo
.
getResourceInfos
();
if
(
CollectionUtils
.
isNotEmpty
(
resourceInfos
))
{
for
(
RoleResourceInfo
resourceInfo
:
resourceInfos
)
{
RoleResourceEntity
roleResourceEntity
=
assembleRoleResource
(
roleInfo
.
getId
(),
resourceInfo
.
getResourceId
());
roleResourceDao
.
save
(
roleResourceEntity
);
}
}
log
.
info
(
"新增角色信息:"
+
JSONObject
.
toJSONString
(
roleInfo
));
return
roleInfo
;
}
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
addUserRole
(
String
roleId
,
String
userId
)
{
public
void
addUserRole
(
String
roleId
,
String
userId
)
{
// 查询角色是否存在
// 查询角色是否存在
...
...
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