Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
dp
Project
Project
Details
Activity
Releases
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
Spencer Chang
dp
Commits
35f3c618
Commit
35f3c618
authored
Sep 16, 2020
by
Spencer Chang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[fix] 修复当*是计算符号时不支持sql查询问题
parent
a7d6df93
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
2 deletions
+14
-2
SysDpDownloadLogServiceImpl.java
...ava-code/dp/service/impl/SysDpDownloadLogServiceImpl.java
+1
-1
SqlConstantUtils.java
v1-基础版本/java-code/dp/util/SqlConstantUtils.java
+1
-0
SqlUtils.java
v1-基础版本/java-code/dp/util/SqlUtils.java
+12
-1
No files found.
v1-基础版本/java-code/dp/service/impl/SysDpDownloadLogServiceImpl.java
View file @
35f3c618
...
...
@@ -54,7 +54,7 @@ public class SysDpDownloadLogServiceImpl implements SysDpDownloadLogService {
for
(
int
i
=
1
;
i
<=
length
-
1
;
i
++){
LocalDate
tmp
=
LocalDate
.
now
().
minusDays
(
i
);
Date
date
=
Date
.
from
(
tmp
.
atStartOfDay
().
atZone
(
ZoneId
.
systemDefault
()).
toInstant
());
downloadFiles
[
i
]
=
logPath
+
"leaf-"
+
DateUtil
.
format
(
new
Date
()
,
"yyyy-MM-dd"
)
+
".log"
;
downloadFiles
[
i
]
=
logPath
+
"leaf-"
+
DateUtil
.
format
(
date
,
"yyyy-MM-dd"
)
+
".log"
;
}
// 查找日志目录下所有文件
List
<
String
>
files
=
new
ArrayList
<>(
30
);
...
...
v1-基础版本/java-code/dp/util/SqlConstantUtils.java
View file @
35f3c618
...
...
@@ -7,6 +7,7 @@ package com.hand.hls.dp.util;
*/
public
interface
SqlConstantUtils
{
String
SQL_STAR
=
"*"
;
String
SQL_COMMA
=
","
;
String
SQL_SELECT
=
"select"
;
String
SQL_FROM
=
"from"
;
String
SQL_FROM_UPPER
=
"FROM"
;
...
...
v1-基础版本/java-code/dp/util/SqlUtils.java
View file @
35f3c618
...
...
@@ -60,7 +60,18 @@ public class SqlUtils {
for
(
String
condition
:
conditions
)
{
if
(
StringUtils
.
containsIgnoreCase
(
sql
,
condition
))
{
return
true
;
if
(
StringUtils
.
equals
(
condition
,
SqlConstantUtils
.
SQL_STAR
)){
String
tmpSql
=
sql
;
int
count
=
StringUtils
.
countMatches
(
tmpSql
,
SqlConstantUtils
.
SQL_STAR
);
for
(
int
i
=
0
;
i
<
count
;
i
++)
{
tmpSql
=
StringUtils
.
trim
(
StringUtils
.
substring
(
tmpSql
,
SqlConstantUtils
.
SQL_STAR
));
if
(
StringUtils
.
startsWithIgnoreCase
(
tmpSql
,
SqlConstantUtils
.
SQL_FROM
)
||
StringUtils
.
startsWithIgnoreCase
(
tmpSql
,
SqlConstantUtils
.
SQL_COMMA
)
)
{
return
true
;
}
}
}
else
{
return
true
;
}
}
}
return
false
;
...
...
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