Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
F
fgqyxxlr
Overview
Overview
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
yaru
fgqyxxlr
Commits
7728ad9e
Commit
7728ad9e
authored
Jul 04, 2020
by
RuoYi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
检查字符支持小数点&降级改成异常提醒
parent
868aed40
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
3 deletions
+7
-3
ruoyi-common/src/main/java/com/ruoyi/common/core/page/PageDomain.java
+3
-0
ruoyi-common/src/main/java/com/ruoyi/common/utils/sql/SqlUtil.java
+4
-3
No files found.
ruoyi-common/src/main/java/com/ruoyi/common/core/page/PageDomain.java
View file @
7728ad9e
...
...
@@ -11,10 +11,13 @@ public class PageDomain
{
/** 当前记录起始索引 */
private
Integer
pageNum
;
/** 每页显示记录数 */
private
Integer
pageSize
;
/** 排序列 */
private
String
orderByColumn
;
/** 排序的方向 "desc" 或者 "asc". */
private
String
isAsc
;
...
...
ruoyi-common/src/main/java/com/ruoyi/common/utils/sql/SqlUtil.java
View file @
7728ad9e
package
com
.
ruoyi
.
common
.
utils
.
sql
;
import
com.ruoyi.common.exception.base.BaseException
;
import
com.ruoyi.common.utils.StringUtils
;
/**
...
...
@@ -10,9 +11,9 @@ import com.ruoyi.common.utils.StringUtils;
public
class
SqlUtil
{
/**
* 仅支持字母、数字、下划线、空格、逗号(支持多个字段排序)
* 仅支持字母、数字、下划线、空格、逗号
、小数点
(支持多个字段排序)
*/
public
static
String
SQL_PATTERN
=
"[a-zA-Z0-9_\\ \\,]+"
;
public
static
String
SQL_PATTERN
=
"[a-zA-Z0-9_\\ \\,
\\.
]+"
;
/**
* 检查字符,防止注入绕过
...
...
@@ -21,7 +22,7 @@ public class SqlUtil
{
if
(
StringUtils
.
isNotEmpty
(
value
)
&&
!
isValidOrderBySql
(
value
))
{
return
StringUtils
.
EMPTY
;
throw
new
BaseException
(
"参数不符合规范,不能进行查询"
)
;
}
return
value
;
}
...
...
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