From 52d48fa63eb62d87df796c86b5d04c39a0b993e2 Mon Sep 17 00:00:00 2001 From: RuoYi Date: Thu, 23 Jul 2020 11:29:40 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A3=80=E6=9F=A5=E5=AD=97=E7=AC=A6=E6=94=AF?= =?UTF-8?q?=E6=8C=81=E5=B0=8F=E6=95=B0=E7=82=B9&=E9=99=8D=E7=BA=A7?= =?UTF-8?q?=E6=94=B9=E6=88=90=E5=BC=82=E5=B8=B8=E6=8F=90=E9=86=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/ruoyi/common/utils/sql/SqlUtil.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/sql/SqlUtil.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/sql/SqlUtil.java index b8aeaa1..39e88ef 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/sql/SqlUtil.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/sql/SqlUtil.java @@ -1,5 +1,6 @@ package com.ruoyi.common.utils.sql; +import com.ruoyi.common.exception.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; }