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
5d926745
Commit
5d926745
authored
Mar 21, 2024
by
chenzhao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改代码 排除条件中空元素
parent
57558339
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
8 deletions
+7
-8
UserEmpowerInterceptor.java
...s/boot/module/hygf/api/config/UserEmpowerInterceptor.java
+7
-8
No files found.
amos-boot-system-jxiop/amos-boot-module-hygf-api/src/main/java/com/yeejoin/amos/boot/module/hygf/api/config/UserEmpowerInterceptor.java
View file @
5d926745
...
...
@@ -9,6 +9,7 @@ import net.sf.jsqlparser.expression.operators.conditional.AndExpression;
import
net.sf.jsqlparser.parser.CCJSqlParserUtil
;
import
net.sf.jsqlparser.statement.select.PlainSelect
;
import
net.sf.jsqlparser.statement.select.Select
;
import
org.apache.commons.lang.ArrayUtils
;
import
org.apache.ibatis.executor.Executor
;
import
org.apache.ibatis.executor.statement.StatementHandler
;
import
org.apache.ibatis.mapping.BoundSql
;
...
...
@@ -25,10 +26,7 @@ import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import
java.lang.reflect.Method
;
import
java.sql.Connection
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.List
;
import
java.util.Properties
;
import
java.util.*
;
@Intercepts
({
@Signature
(
type
=
Executor
.
class
,
method
=
"query"
,
args
=
{
MappedStatement
.
class
,
Object
.
class
,
RowBounds
.
class
,
ResultHandler
.
class
}),
@Signature
(
type
=
StatementHandler
.
class
,
method
=
"prepare"
,
args
=
{
Connection
.
class
,
Integer
.
class
})})
...
...
@@ -140,19 +138,20 @@ public class UserEmpowerInterceptor implements Interceptor {
//获取参数值,
StdUserEmpower
dataAuthRule
=(
StdUserEmpower
)
redisUtils
.
get
(
"Emp_"
+
RedisKey
.
buildReginKey
(
RequestContext
.
getExeUserId
(),
RequestContext
.
getToken
()));
String
[]
data
=
new
String
[]{
String
.
join
(
","
,
dataAuthRule
.
getAmosOrgCode
()),
dataAuthRule
.
getRegionalCompaniesCode
(),
dataAuthRule
.
getUserId
(),
dataAuthRule
.
getAdminRegionalCompaniesCode
()};
List
<
String
>
list
=
new
ArrayList
<>(
Arrays
.
asList
(
data
));
list
.
removeAll
(
Collections
.
singleton
(
null
));
BoundSql
boundSql
=
(
BoundSql
)
metaObject
.
getValue
(
"delegate.boundSql"
);
List
<
String
>
sq
;
//获取sql
String
sql
=
boundSql
.
getSql
();
List
<
String
>
fileds
=
Arrays
.
asList
(
filed
);
if
(!
ValidationUtil
.
isEmpty
(
dataAuthRule
.
getAdminRegionalCompaniesCode
()))
{
sq
=
selectSqlJXS
(
new
String
[]{
fileds
.
get
(
0
),
fileds
.
get
(
1
)},
fileCondition
,
Arrays
.
asList
(
data
)
);
sq
=
selectSqlJXS
(
new
String
[]{
fileds
.
get
(
0
),
fileds
.
get
(
1
)},
fileCondition
,
list
);
}
else
if
(!
ValidationUtil
.
isEmpty
(
dataAuthRule
.
getUserId
()))
{
sq
=
selectSqlJXS
(
new
String
[]{
fileds
.
get
(
0
),
fileds
.
get
(
2
)},
fileCondition
,
Arrays
.
asList
(
data
)
);
sq
=
selectSqlJXS
(
new
String
[]{
fileds
.
get
(
0
),
fileds
.
get
(
2
)},
fileCondition
,
list
);
}
else
{
sq
=
selectSqlJXS
(
new
String
[]{
fileds
.
get
(
0
),
fileds
.
get
(
1
)},
fileCondition
,
Arrays
.
asList
(
data
)
);
sq
=
selectSqlJXS
(
new
String
[]{
fileds
.
get
(
0
),
fileds
.
get
(
1
)},
fileCondition
,
list
);
}
String
sqldata
=
" "
;
...
...
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