From afb036a2cac3258afb95154e26b1688af2d3f859 Mon Sep 17 00:00:00 2001 From: qi_liang Date: Wed, 8 Apr 2020 08:17:12 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B6=88=E9=99=A4=E9=AD=94=E6=B3=95=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/com/lq/code/util/HttpKit.java | 8 ++++++-- src/main/java/com/lq/code/util/sql/AbstractDbBuiler.java | 7 ++++++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/lq/code/util/HttpKit.java b/src/main/java/com/lq/code/util/HttpKit.java index 8b8d21a..dcdfd0a 100755 --- a/src/main/java/com/lq/code/util/HttpKit.java +++ b/src/main/java/com/lq/code/util/HttpKit.java @@ -23,6 +23,10 @@ import java.util.Map.Entry; * @author */ public class HttpKit { + /** + * 问号 + */ + public static final String QUESTION_MARK = "?"; private static final String DEFAULT_CHARSET = "UTF-8"; private static final Logger LOGGER = Logger.getLogger(HttpKit.class); @@ -158,8 +162,8 @@ public class HttpKit { return url; } StringBuilder sb = new StringBuilder(url); - if (url.indexOf("?") == -1) { - sb.append("?"); + if (url.indexOf(QUESTION_MARK) == -1) { + sb.append(QUESTION_MARK); } else { sb.append("&"); } diff --git a/src/main/java/com/lq/code/util/sql/AbstractDbBuiler.java b/src/main/java/com/lq/code/util/sql/AbstractDbBuiler.java index bdccd29..ea5ebd6 100755 --- a/src/main/java/com/lq/code/util/sql/AbstractDbBuiler.java +++ b/src/main/java/com/lq/code/util/sql/AbstractDbBuiler.java @@ -10,6 +10,11 @@ import java.util.Set; */ public abstract class AbstractDbBuiler { + /** + * 括号 + */ + public static final String BRACKETS = ")"; + /** * 自动同步表结构 * @param classSet @@ -47,7 +52,7 @@ public abstract class AbstractDbBuiler { //SQL 转成大写适 String upperCaseSql = sql.toUpperCase(); //统计SQL排除排序SQL代码 - if (sql.lastIndexOf(SqlConstant.ORDER_SQL)>sql.lastIndexOf(")")){ + if (sql.lastIndexOf(SqlConstant.ORDER_SQL)>sql.lastIndexOf(BRACKETS)){ sb.append(sql.substring(upperCaseSql.indexOf(SqlConstant.FROM_SQL)+SqlConstant.FROM_SQL.length(),upperCaseSql.lastIndexOf(SqlConstant.ORDER_SQL))); }else{ sb.append(sql.substring(upperCaseSql.indexOf(SqlConstant.FROM_SQL)+SqlConstant.FROM_SQL.length()));