Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
wangzhen
/
shiro-test
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 3ee60786
authored
Aug 29, 2024
by
wangzhen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor the classes of the RBAC to PermissionService.
1 parent
6e99e2b5
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
4 deletions
src/main/java/com/myxrk/rbac/aspect/DataGridMaskAspect.java
src/main/java/com/myxrk/rbac/aspect/DataGridMaskAspect.java
View file @
3ee6078
...
@@ -50,8 +50,8 @@ public class DataGridMaskAspect {
...
@@ -50,8 +50,8 @@ public class DataGridMaskAspect {
return
result
;
return
result
;
}
}
Class
<?>
genericType
=
data
.
get
(
0
).
getClass
();
// 获取数据类型
// Type genericType= ((ParameterizedType)data.getClass().getGenericSuperclass()).getActualTypeArguments()[0]
;
Class
<?>
genericType
=
getDataEntryType
(
data
)
;
if
(
genericType
==
String
.
class
)
{
if
(
genericType
==
String
.
class
)
{
return
result
;
return
result
;
...
@@ -75,7 +75,7 @@ public class DataGridMaskAspect {
...
@@ -75,7 +75,7 @@ public class DataGridMaskAspect {
List
<
String
>
columns
=
permissionService
.
getColumnsByRoleAndDataGridKey
(
dgKey
,
role
);
List
<
String
>
columns
=
permissionService
.
getColumnsByRoleAndDataGridKey
(
dgKey
,
role
);
maskData
(
data
,
columns
,
genericType
);
maskData
(
data
,
columns
);
return
result
;
return
result
;
}
}
...
@@ -85,7 +85,14 @@ public class DataGridMaskAspect {
...
@@ -85,7 +85,14 @@ public class DataGridMaskAspect {
return
result
;
return
result
;
}
}
private
static
void
maskData
(
List
<?>
data
,
List
<
String
>
columns
,
Class
<?>
genericType
)
{
private
static
Class
<?>
getDataEntryType
(
List
<?>
data
)
{
return
data
.
get
(
0
).
getClass
();
}
private
static
void
maskData
(
List
<?>
data
,
List
<
String
>
columns
)
{
// 获取数据类型
Class
<?>
genericType
=
getDataEntryType
(
data
);
// 获取返回值的属性列表
// 获取返回值的属性列表
Set
<
String
>
header
=
getTableHeader
(
genericType
);
Set
<
String
>
header
=
getTableHeader
(
genericType
);
if
(!
header
.
containsAll
(
columns
))
{
if
(!
header
.
containsAll
(
columns
))
{
...
...
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