Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
eshiled-new
/
ne-shield-usercenter
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit f9bd5faf
authored
May 12, 2022
by
levphon
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
V1.7.0 结清数据控制
1 parent
30e942d8
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
47 additions
and
2 deletions
src/main/java/cn/com/glsx/shield/modules/mapper/RoleBizDataPermissionMapper.java
src/main/java/cn/com/glsx/shield/modules/model/view/RoleDTO.java
src/main/java/cn/com/glsx/shield/modules/service/RoleService.java
src/main/resources/mapper/RoleBizDataPermissionMapper.xml
src/main/java/cn/com/glsx/shield/modules/mapper/RoleBizDataPermissionMapper.java
View file @
f9bd5fa
...
@@ -17,4 +17,8 @@ public interface RoleBizDataPermissionMapper extends CommonBaseMapper<RoleBizDat
...
@@ -17,4 +17,8 @@ public interface RoleBizDataPermissionMapper extends CommonBaseMapper<RoleBizDat
int
updateVisibilityByRoleIdAndType
(
@Param
(
"roleId"
)
Long
roleId
,
@Param
(
"type"
)
Integer
type
,
@Param
(
"visibility"
)
Integer
visibility
);
int
updateVisibilityByRoleIdAndType
(
@Param
(
"roleId"
)
Long
roleId
,
@Param
(
"type"
)
Integer
type
,
@Param
(
"visibility"
)
Integer
visibility
);
int
logicDeleteByRoleId
(
@Param
(
"roleId"
)
Long
roleId
);
int
logicDeleteByRoleIdAndType
(
@Param
(
"roleId"
)
Long
roleId
,
@Param
(
"type"
)
Integer
type
);
}
}
\ No newline at end of file
\ No newline at end of file
src/main/java/cn/com/glsx/shield/modules/model/view/RoleDTO.java
View file @
f9bd5fa
package
cn
.
com
.
glsx
.
shield
.
modules
.
model
.
view
;
package
cn
.
com
.
glsx
.
shield
.
modules
.
model
.
view
;
import
cn.com.glsx.auth.model.BizDataPermission
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
lombok.Data
;
import
lombok.Data
;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.List
;
@Data
@Data
public
class
RoleDTO
{
public
class
RoleDTO
{
...
@@ -31,6 +33,11 @@ public class RoleDTO {
...
@@ -31,6 +33,11 @@ public class RoleDTO {
private
Integer
rolePermissionType
;
private
Integer
rolePermissionType
;
/**
/**
* 业务数据权限
*/
private
List
<
BizDataPermission
>
bizDataPermissions
;
/**
* 指定租户权限
* 指定租户权限
*/
*/
private
String
permTenants
;
private
String
permTenants
;
...
...
src/main/java/cn/com/glsx/shield/modules/service/RoleService.java
View file @
f9bd5fa
package
cn
.
com
.
glsx
.
shield
.
modules
.
service
;
package
cn
.
com
.
glsx
.
shield
.
modules
.
service
;
import
cn.com.glsx.auth.model.BizDataPermission
;
import
cn.com.glsx.auth.utils.ShieldContextHolder
;
import
cn.com.glsx.auth.utils.ShieldContextHolder
;
import
cn.com.glsx.shield.common.exception.UserCenterException
;
import
cn.com.glsx.shield.common.exception.UserCenterException
;
import
cn.com.glsx.shield.modules.converter.RoleBizDataPermissionConverter
;
import
cn.com.glsx.shield.modules.converter.RoleConverter
;
import
cn.com.glsx.shield.modules.converter.RoleConverter
;
import
cn.com.glsx.shield.modules.entity.*
;
import
cn.com.glsx.shield.modules.entity.*
;
import
cn.com.glsx.shield.modules.mapper.*
;
import
cn.com.glsx.shield.modules.mapper.*
;
...
@@ -219,7 +221,13 @@ public class RoleService {
...
@@ -219,7 +221,13 @@ public class RoleService {
//业务数据权限
//业务数据权限
if
(
roleBO
.
getBizPermissionType
()
!=
null
)
{
if
(
roleBO
.
getBizPermissionType
()
!=
null
)
{
// TODO: 2022/5/10
RoleBizDataPermission
bizDataPermission
=
new
RoleBizDataPermission
();
bizDataPermission
.
setRoleId
(
role
.
getId
());
bizDataPermission
.
setType
(
roleBO
.
getBizPermissionType
());
bizDataPermission
.
setVisibility
(
roleBO
.
getBizPermissionVisibility
());
bizDataPermission
.
setCreatedBy
(
ShieldContextHolder
.
getUserId
());
bizDataPermission
.
setCreatedDate
(
new
Date
());
roleBizDataPermissionMapper
.
insert
(
bizDataPermission
);
}
}
//角色菜单
//角色菜单
...
@@ -275,9 +283,16 @@ public class RoleService {
...
@@ -275,9 +283,16 @@ public class RoleService {
roleDataPermissionMapper
.
insertList
(
permTenantList
);
roleDataPermissionMapper
.
insertList
(
permTenantList
);
}
}
roleBizDataPermissionMapper
.
logicDeleteByRoleIdAndType
(
role
.
getId
(),
roleBO
.
getBizPermissionType
());
//业务数据权限
//业务数据权限
if
(
roleBO
.
getBizPermissionType
()
!=
null
)
{
if
(
roleBO
.
getBizPermissionType
()
!=
null
)
{
// TODO: 2022/5/10
RoleBizDataPermission
bizDataPermission
=
new
RoleBizDataPermission
();
bizDataPermission
.
setRoleId
(
role
.
getId
());
bizDataPermission
.
setType
(
roleBO
.
getBizPermissionType
());
bizDataPermission
.
setVisibility
(
roleBO
.
getBizPermissionVisibility
());
bizDataPermission
.
setCreatedBy
(
ShieldContextHolder
.
getUserId
());
bizDataPermission
.
setCreatedDate
(
new
Date
());
roleBizDataPermissionMapper
.
insert
(
bizDataPermission
);
}
}
//角色菜单
//角色菜单
...
@@ -361,6 +376,12 @@ public class RoleService {
...
@@ -361,6 +376,12 @@ public class RoleService {
String
roleTenants
=
StringUtils
.
join
(
permTenantIdList
,
','
);
String
roleTenants
=
StringUtils
.
join
(
permTenantIdList
,
','
);
roleDTO
.
setPermTenants
(
roleTenants
);
roleDTO
.
setPermTenants
(
roleTenants
);
}
}
//业务数据权限
List
<
RoleBizDataPermission
>
roleBizDataPermissionList
=
roleBizDataPermissionMapper
.
selectByRoleId
(
id
);
List
<
BizDataPermission
>
bizDataPermissionList
=
Lists
.
newArrayList
();
roleBizDataPermissionList
.
forEach
(
rbdp
->
bizDataPermissionList
.
add
(
RoleBizDataPermissionConverter
.
INSTANCE
.
bo2simple
(
rbdp
)));
roleDTO
.
setBizDataPermissions
(
bizDataPermissionList
);
}
}
return
roleDTO
;
return
roleDTO
;
}
}
...
...
src/main/resources/mapper/RoleBizDataPermissionMapper.xml
View file @
f9bd5fa
...
@@ -49,4 +49,17 @@
...
@@ -49,4 +49,17 @@
where role_id = #{roleId}
where role_id = #{roleId}
and type = #{type}
and type = #{type}
</update>
</update>
<update
id=
"logicDeleteByRoleId"
>
update t_role_biz_data_permission
set del_flag = -1
where role_id = #{roleId}
</update>
<update
id=
"logicDeleteByRoleIdAndType"
>
update t_role_biz_data_permission
set del_flag = -1
where role_id = #{roleId}
and type = #{type}
</update>
</mapper>
</mapper>
\ No newline at end of file
\ No newline at end of file
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