From a3dc9ecb2dafd60a069c46d7360f8f1f178f623a Mon Sep 17 00:00:00 2001 From: qi_liang Date: Mon, 27 May 2019 16:29:13 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/lq/code/interceptor/PageInteceptor.java | 12 ++++-------- src/main/java/com/lq/code/util/sql/SqlConstant.java | 5 +++++ .../webapp/WEB-INF/views/jsp/cms/sys/user/index.jsp | 5 ----- 3 files changed, 9 insertions(+), 13 deletions(-) diff --git a/src/main/java/com/lq/code/interceptor/PageInteceptor.java b/src/main/java/com/lq/code/interceptor/PageInteceptor.java index d02ef70..4c53e02 100755 --- a/src/main/java/com/lq/code/interceptor/PageInteceptor.java +++ b/src/main/java/com/lq/code/interceptor/PageInteceptor.java @@ -1,10 +1,7 @@ package com.lq.code.interceptor; import com.lq.code.util.StringUtil; -import com.lq.code.util.sql.AbstractDbBuiler; -import com.lq.code.util.sql.MysqlBuilder; -import com.lq.code.util.sql.OracleBuiler; -import com.lq.code.util.sql.PageInterface; +import com.lq.code.util.sql.*; import org.apache.ibatis.executor.Executor; import org.apache.ibatis.executor.statement.StatementHandler; import org.apache.ibatis.mapping.BoundSql; @@ -52,13 +49,12 @@ public class PageInteceptor implements Interceptor { String sql=boundSql.getSql(); PageInterface pageInterface=(PageInterface)boundSql.getParameterObject(); AbstractDbBuiler db = null; - if (dialect.equals("mysql")){ + if (SqlConstant.DB_TYPE_MYSQL.equals(dialect)){ db = new MysqlBuilder(); } - if (dialect.equals("oracle")){ - db = new OracleBuiler(); + if (SqlConstant.DB_TYPE_ORACLE.equals(dialect)){ + db = new OracleBuiler(); } -// String countSql= db.countSql(sql); String pageSql=db.concatPageSql(sql,pageInterface); metaStatementHandler.setValue("delegate.boundSql.sql",pageSql); diff --git a/src/main/java/com/lq/code/util/sql/SqlConstant.java b/src/main/java/com/lq/code/util/sql/SqlConstant.java index 3641346..e7add8c 100644 --- a/src/main/java/com/lq/code/util/sql/SqlConstant.java +++ b/src/main/java/com/lq/code/util/sql/SqlConstant.java @@ -8,4 +8,9 @@ package com.lq.code.util.sql; public class SqlConstant { public static final String SQL_SYMBOL = "_"; + + public static final String DB_TYPE_MYSQL = "mysql"; + + public static final String DB_TYPE_ORACLE = "oracle"; + } diff --git a/src/main/webapp/WEB-INF/views/jsp/cms/sys/user/index.jsp b/src/main/webapp/WEB-INF/views/jsp/cms/sys/user/index.jsp index 6b96834..58caf68 100755 --- a/src/main/webapp/WEB-INF/views/jsp/cms/sys/user/index.jsp +++ b/src/main/webapp/WEB-INF/views/jsp/cms/sys/user/index.jsp @@ -20,7 +20,6 @@