Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
amos-boot-biz
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
项目统一框架
amos-boot-biz
Commits
6837cc9c
Commit
6837cc9c
authored
Jan 05, 2022
by
tianbo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
权限拦截器修改
parent
0592f77d
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
5 deletions
+7
-5
PermissionInterceptor.java
...s/boot/biz/common/interceptors/PermissionInterceptor.java
+7
-5
No files found.
amos-boot-biz-common/src/main/java/com/yeejoin/amos/boot/biz/common/interceptors/PermissionInterceptor.java
View file @
6837cc9c
...
...
@@ -34,6 +34,8 @@ import org.apache.poi.ss.formula.functions.T;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnExpression
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnProperty
;
import
org.typroject.tyboot.core.foundation.context.RequestContext
;
import
org.typroject.tyboot.core.foundation.utils.Bean
;
import
org.typroject.tyboot.core.foundation.utils.ValidationUtil
;
...
...
@@ -63,7 +65,7 @@ public class PermissionInterceptor implements Interceptor {
MetaObject
metaObject
=
SystemMetaObject
.
forObject
(
statementHandler
);
MappedStatement
mappedStatement
=
(
MappedStatement
)
metaObject
.
getValue
(
"delegate.mappedStatement"
);
// 处理mybatis plus
//
TODO
处理mybatis plus
String
dataAuthRule
=
PermissionInterceptorContext
.
getDataAuthRule
();
// 被拦截方法
...
...
@@ -74,15 +76,15 @@ public class PermissionInterceptor implements Interceptor {
PermissionInterceptorContext
.
clean
();
return
invocation
.
proceed
();
}
if
(!
ValidationUtil
.
isEmpty
(
dataAuth
)){
dataAuthRule
=
!
ValidationUtil
.
isEmpty
(
dataAuthRule
)
?
dataAuthRule
:
dataAuth
.
interfacePath
();
}
// 数据权限地址为空返回空数据
if
(
ValidationUtil
.
isEmpty
(
dataAuth
.
interfacePath
())
&&
ValidationUtil
.
isEmpty
(
dataAuthRule
))
{
if
(
ValidationUtil
.
isEmpty
(
dataAuthRule
))
{
// method.getReturnType().isPrimitive() = true 是count语句
PermissionInterceptorContext
.
clean
();
return
method
.
getReturnType
().
isPrimitive
()
?
invocation
.
proceed
()
:
null
;
}
dataAuthRule
=
ValidationUtil
.
isEmpty
(
dataAuth
.
interfacePath
())
?
dataAuthRule
:
dataAuth
.
interfacePath
();
ReginParams
reginParam
=
JSON
.
parseObject
(
redisUtils
.
get
(
RedisKey
.
buildReginKey
(
RequestContext
.
getExeUserId
()
,
RequestContext
.
getToken
())).
toString
(),
ReginParams
.
class
);
if
(
ValidationUtil
.
isEmpty
(
reginParam
)
||
ValidationUtil
.
isEmpty
(
reginParam
.
getUserModel
()))
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
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 comment