From ef497ced624486c71f90d68b63bafa83cd46902a Mon Sep 17 00:00:00 2001 From: smallchill Date: Tue, 5 Dec 2023 01:15:29 +0800 Subject: [PATCH] =?UTF-8?q?:zap:=20=E4=BC=98=E5=8C=96sql=E9=98=B2=E6=B3=A8?= =?UTF-8?q?=E5=85=A5=E9=80=BB=E8=BE=91=EF=BC=8C=E9=81=BF=E5=85=8D=E5=8F=8C?= =?UTF-8?q?=E5=86=99=E7=AD=89=E6=83=85=E5=86=B5=E5=87=BA=E7=8E=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../core/mp/support/SqlKeyword.java | 37 ++++++++++++++++++- 1 file changed, 35 insertions(+), 2 deletions(-) diff --git a/blade-core-mybatis/src/main/java/org/springblade/core/mp/support/SqlKeyword.java b/blade-core-mybatis/src/main/java/org/springblade/core/mp/support/SqlKeyword.java index 212fb60..bb8ca31 100644 --- a/blade-core-mybatis/src/main/java/org/springblade/core/mp/support/SqlKeyword.java +++ b/blade-core-mybatis/src/main/java/org/springblade/core/mp/support/SqlKeyword.java @@ -16,12 +16,15 @@ package org.springblade.core.mp.support; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import lombok.SneakyThrows; import org.springblade.core.tool.utils.DateUtil; import org.springblade.core.tool.utils.Func; import org.springblade.core.tool.utils.StringPool; import org.springblade.core.tool.utils.StringUtil; +import java.sql.SQLException; import java.util.Map; +import java.util.regex.Pattern; /** * 定义常用的 sql关键字 @@ -29,7 +32,19 @@ import java.util.Map; * @author Chill */ public class SqlKeyword { - private final static String SQL_REGEX = "'|%|--|insert|delete|select|sleep|count|group|union|drop|truncate|alter|grant|execute|exec|xp_cmdshell|call|declare|sql"; + /** + * 常规sql字符匹配关键词 + */ + private final static String SQL_REGEX = "(?i)(?