Explorar o código

3.0 代码改为 jdk 1.8

hubin %!s(int64=7) %!d(string=hai) anos
pai
achega
6bb03b37fa
Modificáronse 100 ficheiros con 988 adicións e 980 borrados
  1. 4 4
      mybatis-plus-annotation/src/main/java/com/baomidou/mybatisplus/annotation/FieldFill.java
  2. 3 3
      mybatis-plus-annotation/src/main/java/com/baomidou/mybatisplus/annotation/FieldStrategy.java
  3. 3 3
      mybatis-plus-annotation/src/main/java/com/baomidou/mybatisplus/annotation/IdType.java
  4. 1 1
      mybatis-plus-annotation/src/main/java/com/baomidou/mybatisplus/annotation/KeySequence.java
  5. 5 5
      mybatis-plus-annotation/src/main/java/com/baomidou/mybatisplus/annotation/SqlCondition.java
  6. 3 3
      mybatis-plus-annotation/src/main/java/com/baomidou/mybatisplus/annotation/TableField.java
  7. 1 1
      mybatis-plus-annotation/src/main/java/com/baomidou/mybatisplus/annotation/TableId.java
  8. 2 2
      mybatis-plus-annotation/src/main/java/com/baomidou/mybatisplus/annotation/TableLogic.java
  9. 2 2
      mybatis-plus-annotation/src/main/java/com/baomidou/mybatisplus/annotation/TableName.java
  10. 2 2
      mybatis-plus-core/src/main/java/com/baomidou/mybatisplus/core/MybatisConfiguration.java
  11. 14 14
      mybatis-plus-core/src/main/java/com/baomidou/mybatisplus/core/MybatisDefaultParameterHandler.java
  12. 15 15
      mybatis-plus-core/src/main/java/com/baomidou/mybatisplus/core/MybatisMapperAnnotationBuilder.java
  13. 1 1
      mybatis-plus-core/src/main/java/com/baomidou/mybatisplus/core/MybatisMapperRegistry.java
  14. 2 2
      mybatis-plus-core/src/main/java/com/baomidou/mybatisplus/core/MybatisSessionFactoryBuilder.java
  15. 75 75
      mybatis-plus-core/src/main/java/com/baomidou/mybatisplus/core/MybatisXMLConfigBuilder.java
  16. 8 8
      mybatis-plus-core/src/main/java/com/baomidou/mybatisplus/core/assist/ISqlRunner.java
  17. 1 1
      mybatis-plus-core/src/main/java/com/baomidou/mybatisplus/core/conditions/Condition.java
  18. 2 2
      mybatis-plus-core/src/main/java/com/baomidou/mybatisplus/core/conditions/EntityWrapper.java
  19. 13 13
      mybatis-plus-core/src/main/java/com/baomidou/mybatisplus/core/conditions/MybatisAbstractSQL.java
  20. 6 6
      mybatis-plus-core/src/main/java/com/baomidou/mybatisplus/core/conditions/SqlPlus.java
  21. 4 4
      mybatis-plus-core/src/main/java/com/baomidou/mybatisplus/core/enums/SqlLike.java
  22. 27 27
      mybatis-plus-core/src/main/java/com/baomidou/mybatisplus/core/enums/SqlMethod.java
  23. 1 1
      mybatis-plus-core/src/main/java/com/baomidou/mybatisplus/core/handlers/MetaObjectHandler.java
  24. 105 105
      mybatis-plus-core/src/main/java/com/baomidou/mybatisplus/core/handlers/SqlReservedWordsHandler.java
  25. 87 87
      mybatis-plus-core/src/main/java/com/baomidou/mybatisplus/core/injector/AutoSqlInjector.java
  26. 16 16
      mybatis-plus-core/src/main/java/com/baomidou/mybatisplus/core/mapper/BaseMapper.java
  27. 1 1
      mybatis-plus-core/src/main/java/com/baomidou/mybatisplus/core/metadata/Column.java
  28. 1 1
      mybatis-plus-core/src/main/java/com/baomidou/mybatisplus/core/metadata/GlobalConfiguration.java
  29. 2 2
      mybatis-plus-core/src/main/java/com/baomidou/mybatisplus/core/metadata/TableInfo.java
  30. 4 4
      mybatis-plus-core/src/main/java/com/baomidou/mybatisplus/core/pagination/Page.java
  31. 1 1
      mybatis-plus-core/src/main/java/com/baomidou/mybatisplus/core/pagination/PageHelper.java
  32. 1 1
      mybatis-plus-core/src/main/java/com/baomidou/mybatisplus/core/pagination/Pagination.java
  33. 2 2
      mybatis-plus-core/src/main/java/com/baomidou/mybatisplus/core/parser/SqlParserHelper.java
  34. 5 5
      mybatis-plus-core/src/main/java/com/baomidou/mybatisplus/core/toolkit/ClassUtils.java
  35. 3 3
      mybatis-plus-core/src/main/java/com/baomidou/mybatisplus/core/toolkit/GlobalConfigUtils.java
  36. 7 7
      mybatis-plus-core/src/main/java/com/baomidou/mybatisplus/core/toolkit/IOUtils.java
  37. 1 1
      mybatis-plus-core/src/main/java/com/baomidou/mybatisplus/core/toolkit/IdWorker.java
  38. 2 2
      mybatis-plus-core/src/main/java/com/baomidou/mybatisplus/core/toolkit/PluginUtils.java
  39. 8 8
      mybatis-plus-core/src/main/java/com/baomidou/mybatisplus/core/toolkit/ReflectionKit.java
  40. 5 5
      mybatis-plus-core/src/main/java/com/baomidou/mybatisplus/core/toolkit/Sequence.java
  41. 15 15
      mybatis-plus-core/src/main/java/com/baomidou/mybatisplus/core/toolkit/StringUtils.java
  42. 1 1
      mybatis-plus-core/src/main/java/com/baomidou/mybatisplus/core/toolkit/SystemClock.java
  43. 7 7
      mybatis-plus-core/src/main/java/com/baomidou/mybatisplus/core/toolkit/TableInfoHelper.java
  44. 41 41
      mybatis-plus-core/src/main/java/com/baomidou/mybatisplus/core/toolkit/sql/SqlFormatter.java
  45. 2 2
      mybatis-plus-core/src/main/java/com/baomidou/mybatisplus/core/toolkit/sql/SqlHelper.java
  46. 13 13
      mybatis-plus-core/src/main/java/com/baomidou/mybatisplus/core/toolkit/sql/SqlUtils.java
  47. 2 2
      mybatis-plus-core/src/main/java/com/baomidou/mybatisplus/core/toolkit/sql/StringEscape.java
  48. 2 1
      mybatis-plus-core/src/test/java/com/baomidou/mybatisplus/core/test/Main.java
  49. 12 9
      mybatis-plus-core/src/test/java/com/baomidou/mybatisplus/core/test/Query.java
  50. 10 9
      mybatis-plus-core/src/test/java/com/baomidou/mybatisplus/core/test/QueryHelper.java
  51. 2 0
      mybatis-plus-core/src/test/java/com/baomidou/mybatisplus/core/test/Role.java
  52. 1 0
      mybatis-plus-core/src/test/java/com/baomidou/mybatisplus/core/test/User.java
  53. 7 7
      mybatis-plus-extension/src/main/java/com/baomidou/mybatisplus/extension/MybatisSqlSessionTemplate.java
  54. 13 13
      mybatis-plus-extension/src/main/java/com/baomidou/mybatisplus/extension/activerecord/Model.java
  55. 11 11
      mybatis-plus-extension/src/main/java/com/baomidou/mybatisplus/extension/enums/DBType.java
  56. 1 1
      mybatis-plus-extension/src/main/java/com/baomidou/mybatisplus/extension/handlers/BlobTypeHandler.java
  57. 1 1
      mybatis-plus-extension/src/main/java/com/baomidou/mybatisplus/extension/handlers/EnumTypeHandler.java
  58. 1 1
      mybatis-plus-extension/src/main/java/com/baomidou/mybatisplus/extension/handlers/MybatisMapWrapper.java
  59. 1 1
      mybatis-plus-extension/src/main/java/com/baomidou/mybatisplus/extension/incrementer/DB2KeyGenerator.java
  60. 2 2
      mybatis-plus-extension/src/main/java/com/baomidou/mybatisplus/extension/incrementer/H2KeyGenerator.java
  61. 2 2
      mybatis-plus-extension/src/main/java/com/baomidou/mybatisplus/extension/incrementer/OracleKeyGenerator.java
  62. 2 2
      mybatis-plus-extension/src/main/java/com/baomidou/mybatisplus/extension/incrementer/PostgreKeyGenerator.java
  63. 49 49
      mybatis-plus-extension/src/main/java/com/baomidou/mybatisplus/extension/injector/LogicSqlInjector.java
  64. 2 2
      mybatis-plus-extension/src/main/java/com/baomidou/mybatisplus/extension/plugins/CachePaginationInterceptor.java
  65. 9 9
      mybatis-plus-extension/src/main/java/com/baomidou/mybatisplus/extension/plugins/OptimisticLockerInterceptor.java
  66. 11 11
      mybatis-plus-extension/src/main/java/com/baomidou/mybatisplus/extension/plugins/PaginationInterceptor.java
  67. 19 19
      mybatis-plus-extension/src/main/java/com/baomidou/mybatisplus/extension/plugins/PerformanceInterceptor.java
  68. 7 7
      mybatis-plus-extension/src/main/java/com/baomidou/mybatisplus/extension/plugins/SqlExplainInterceptor.java
  69. 2 2
      mybatis-plus-extension/src/main/java/com/baomidou/mybatisplus/extension/plugins/pagination/DialectFactory.java
  70. 10 10
      mybatis-plus-extension/src/main/java/com/baomidou/mybatisplus/extension/plugins/pagination/dialects/DB2Dialect.java
  71. 2 2
      mybatis-plus-extension/src/main/java/com/baomidou/mybatisplus/extension/plugins/pagination/dialects/H2Dialect.java
  72. 1 1
      mybatis-plus-extension/src/main/java/com/baomidou/mybatisplus/extension/plugins/pagination/dialects/HSQLDialect.java
  73. 1 1
      mybatis-plus-extension/src/main/java/com/baomidou/mybatisplus/extension/plugins/pagination/dialects/MySqlDialect.java
  74. 3 3
      mybatis-plus-extension/src/main/java/com/baomidou/mybatisplus/extension/plugins/pagination/dialects/OracleDialect.java
  75. 1 1
      mybatis-plus-extension/src/main/java/com/baomidou/mybatisplus/extension/plugins/pagination/dialects/PostgreDialect.java
  76. 12 12
      mybatis-plus-extension/src/main/java/com/baomidou/mybatisplus/extension/plugins/pagination/dialects/SQLServer2005Dialect.java
  77. 2 2
      mybatis-plus-extension/src/main/java/com/baomidou/mybatisplus/extension/plugins/pagination/dialects/SQLServerDialect.java
  78. 1 1
      mybatis-plus-extension/src/main/java/com/baomidou/mybatisplus/extension/plugins/pagination/dialects/SQLiteDialect.java
  79. 2 2
      mybatis-plus-extension/src/main/java/com/baomidou/mybatisplus/extension/plugins/pagination/optimize/JsqlParserCountOptimize.java
  80. 4 4
      mybatis-plus-extension/src/main/java/com/baomidou/mybatisplus/extension/plugins/tenant/TenantSqlParser.java
  81. 2 2
      mybatis-plus-extension/src/main/java/com/baomidou/mybatisplus/extension/service/IService.java
  82. 11 11
      mybatis-plus-extension/src/main/java/com/baomidou/mybatisplus/extension/service/impl/ServiceImpl.java
  83. 19 19
      mybatis-plus-extension/src/main/java/com/baomidou/mybatisplus/extension/spring/MybatisMapperRefresh.java
  84. 18 18
      mybatis-plus-extension/src/main/java/com/baomidou/mybatisplus/extension/spring/MybatisSqlSessionFactoryBean.java
  85. 12 12
      mybatis-plus-extension/src/main/java/com/baomidou/mybatisplus/extension/toolkit/JdbcUtils.java
  86. 2 2
      mybatis-plus-extension/src/main/java/com/baomidou/mybatisplus/extension/toolkit/PackageHelper.java
  87. 1 1
      mybatis-plus-extension/src/main/java/com/baomidou/mybatisplus/extension/toolkit/SqlRunner.java
  88. 3 3
      mybatis-plus-extension/src/main/java/com/baomidou/mybatisplus/extension/toolkit/VersionUtils.java
  89. 5 5
      mybatis-plus-extension/src/test/java/com/baomidou/mybatisplus/extension/test/CrudTest.java
  90. 68 68
      mybatis-plus-extension/src/test/java/com/baomidou/mybatisplus/extension/test/EntityWrapperTest.java
  91. 6 6
      mybatis-plus-extension/src/test/java/com/baomidou/mybatisplus/extension/test/GlobalConfigurationTest.java
  92. 1 1
      mybatis-plus-extension/src/test/java/com/baomidou/mybatisplus/extension/test/IdWorkerTest.java
  93. 1 1
      mybatis-plus-extension/src/test/java/com/baomidou/mybatisplus/extension/test/MybatisMapperRefreshTest.java
  94. 3 3
      mybatis-plus-extension/src/test/java/com/baomidou/mybatisplus/extension/test/StringUtilsTest.java
  95. 12 12
      mybatis-plus-extension/src/test/java/com/baomidou/mybatisplus/extension/test/activerecord/ActiveRecordTest.java
  96. 1 1
      mybatis-plus-extension/src/test/java/com/baomidou/mybatisplus/extension/test/h2/H2LogicDeleteSqlParserTest.java
  97. 15 15
      mybatis-plus-extension/src/test/java/com/baomidou/mybatisplus/extension/test/h2/H2LogicDeleteTest.java
  98. 22 22
      mybatis-plus-extension/src/test/java/com/baomidou/mybatisplus/extension/test/h2/H2MapUnderline2CamelTest.java
  99. 42 42
      mybatis-plus-extension/src/test/java/com/baomidou/mybatisplus/extension/test/h2/H2MetaObjAndVersionAndOptLockTest.java
  100. 11 11
      mybatis-plus-extension/src/test/java/com/baomidou/mybatisplus/extension/test/h2/H2MetaObjectHandler.java

+ 4 - 4
mybatis-plus-annotation/src/main/java/com/baomidou/mybatisplus/annotation/FieldFill.java

@@ -24,10 +24,10 @@ package com.baomidou.mybatisplus.annotation;
  * @Date 2017-06-27
  */
 public enum FieldFill {
-    DEFAULT(0, "默认不处理" ),
-    INSERT(1, "插入填充字段" ),
-    UPDATE(2, "更新填充字段" ),
-    INSERT_UPDATE(3, "插入和更新填充字段" );
+    DEFAULT(0, "默认不处理"),
+    INSERT(1, "插入填充字段"),
+    UPDATE(2, "更新填充字段"),
+    INSERT_UPDATE(3, "插入和更新填充字段");
 
     /**
      * 主键

+ 3 - 3
mybatis-plus-annotation/src/main/java/com/baomidou/mybatisplus/annotation/FieldStrategy.java

@@ -24,9 +24,9 @@ package com.baomidou.mybatisplus.annotation;
  * @Date 2016-09-09
  */
 public enum FieldStrategy {
-    IGNORED(0, "忽略判断" ),
-    NOT_NULL(1, "非 NULL 判断" ),
-    NOT_EMPTY(2, "非空判断" );
+    IGNORED(0, "忽略判断"),
+    NOT_NULL(1, "非 NULL 判断"),
+    NOT_EMPTY(2, "非空判断");
 
     /**
      * 主键

+ 3 - 3
mybatis-plus-annotation/src/main/java/com/baomidou/mybatisplus/annotation/IdType.java

@@ -24,11 +24,11 @@ package com.baomidou.mybatisplus.annotation;
  * @Date 2015-11-10
  */
 public enum IdType {
-    AUTO(0, "数据库ID自增" ), INPUT(1, "用户输入ID" ),
+    AUTO(0, "数据库ID自增"), INPUT(1, "用户输入ID"),
 
     /* 以下2种类型、只有当插入对象ID 为空,才自动填充。 */
-    ID_WORKER(2, "全局唯一ID" ), UUID(3, "全局唯一ID" ), NONE(4, "该类型为未设置主键类型" ),
-    ID_WORKER_STR(5, "字符串全局唯一ID" );
+    ID_WORKER(2, "全局唯一ID"), UUID(3, "全局唯一ID"), NONE(4, "该类型为未设置主键类型"),
+    ID_WORKER_STR(5, "字符串全局唯一ID");
 
     /**
      * 主键

+ 1 - 1
mybatis-plus-annotation/src/main/java/com/baomidou/mybatisplus/annotation/KeySequence.java

@@ -42,7 +42,7 @@ public @interface KeySequence {
      * 序列名
      * </p>
      */
-    String value() default "" ;
+    String value() default "";
 
     /**
      * <p>

+ 5 - 5
mybatis-plus-annotation/src/main/java/com/baomidou/mybatisplus/annotation/SqlCondition.java

@@ -28,23 +28,23 @@ public class SqlCondition {
     /**
      * 等于
      */
-    public static final String EQUAL = "%s=#{%s}" ;
+    public static final String EQUAL = "%s=#{%s}";
     /**
      * 不等于
      */
-    public static final String NOT_EQUAL = "%s&lt;&gt;#{%s}" ;
+    public static final String NOT_EQUAL = "%s&lt;&gt;#{%s}";
     /**
      * % 两边 %
      */
-    public static final String LIKE = "%s LIKE CONCAT('%%',#{%s},'%%')" ;
+    public static final String LIKE = "%s LIKE CONCAT('%%',#{%s},'%%')";
     /**
      * % 左
      */
-    public static final String LIKE_LEFT = "%s LIKE CONCAT('%%',#{%s})" ;
+    public static final String LIKE_LEFT = "%s LIKE CONCAT('%%',#{%s})";
     /**
      * 右 %
      */
-    public static final String LIKE_RIGHT = "%s LIKE CONCAT(#{%s},'%%')" ;
+    public static final String LIKE_RIGHT = "%s LIKE CONCAT(#{%s},'%%')";
 
 
 }

+ 3 - 3
mybatis-plus-annotation/src/main/java/com/baomidou/mybatisplus/annotation/TableField.java

@@ -40,7 +40,7 @@ public @interface TableField {
      * 字段值(驼峰命名方式,该值可无)
      * </p>
      */
-    String value() default "" ;
+    String value() default "";
 
     /**
      * <p>
@@ -51,7 +51,7 @@ public @interface TableField {
      * 支持:@TableField(el = "role, typeHandler=com.baomidou.springcloud.typehandler.PhoneTypeHandler")
      * </p>
      */
-    String el() default "" ;
+    String el() default "";
 
     /**
      * <p>
@@ -86,7 +86,7 @@ public @interface TableField {
      * 输出 SQL 为:update 表 set 字段=now() where ...
      * </p>
      */
-    String update() default "" ;
+    String update() default "";
 
     /**
      * <p>

+ 1 - 1
mybatis-plus-annotation/src/main/java/com/baomidou/mybatisplus/annotation/TableId.java

@@ -39,7 +39,7 @@ public @interface TableId {
      * 字段值(驼峰命名方式,该值可无)
      * </p>
      */
-    String value() default "" ;
+    String value() default "";
 
     /**
      * <p>

+ 2 - 2
mybatis-plus-annotation/src/main/java/com/baomidou/mybatisplus/annotation/TableLogic.java

@@ -39,13 +39,13 @@ public @interface TableLogic {
      * 默认逻辑未删除值(该值可无、会自动获取全局配置)
      * </p>
      */
-    String value() default "" ;
+    String value() default "";
 
     /**
      * <p>
      * 默认逻辑删除值(该值可无、会自动获取全局配置)
      * </p>
      */
-    String delval() default "" ;
+    String delval() default "";
 
 }

+ 2 - 2
mybatis-plus-annotation/src/main/java/com/baomidou/mybatisplus/annotation/TableName.java

@@ -39,13 +39,13 @@ public @interface TableName {
      * 实体对应的表名
      * </p>
      */
-    String value() default "" ;
+    String value() default "";
 
     /**
      * <p>
      * 实体映射结果集
      * </p>
      */
-    String resultMap() default "" ;
+    String resultMap() default "";
 
 }

+ 2 - 2
mybatis-plus-core/src/main/java/com/baomidou/mybatisplus/core/MybatisConfiguration.java

@@ -49,7 +49,7 @@ public class MybatisConfiguration extends Configuration {
      */
     public MybatisConfiguration() {
         this.setDefaultScriptingLanguage(MybatisXMLLanguageDriver.class);
-        logger.debug("Mybatis-plus init success." );
+        logger.debug("Mybatis-plus init success.");
     }
 
     /**
@@ -75,7 +75,7 @@ public class MybatisConfiguration extends Configuration {
                 /*
                  * 说明已加载了xml中的节点; 忽略mapper中的SqlProvider数据
                  */
-                logger.error("mapper[" + ms.getId() + "] is ignored, because it's exists, maybe from xml file" );
+                logger.error("mapper[" + ms.getId() + "] is ignored, because it's exists, maybe from xml file");
                 return;
             }
         }

+ 14 - 14
mybatis-plus-core/src/main/java/com/baomidou/mybatisplus/core/MybatisDefaultParameterHandler.java

@@ -85,7 +85,7 @@ public class MybatisDefaultParameterHandler extends DefaultParameterHandler {
      */
     private static Field getAdditionalParametersField() {
         try {
-            Field additionalParametersField = BoundSql.class.getDeclaredField("additionalParameters" );
+            Field additionalParametersField = BoundSql.class.getDeclaredField("additionalParameters");
             additionalParametersField.setAccessible(true);
             return additionalParametersField;
         } catch (NoSuchFieldException e) {
@@ -138,13 +138,13 @@ public class MybatisDefaultParameterHandler extends DefaultParameterHandler {
                 TableInfo tableInfo = null;
                 if (parameterObject instanceof Map) {
                     Map map = (Map) parameterObject;
-                    if (map.containsKey("et" )) {
-                        Object et = map.get("et" );
+                    if (map.containsKey("et")) {
+                        Object et = map.get("et");
                         if (et != null) {
                             if (et instanceof Map) {
                                 Map realEtMap = (Map) et;
-                                if (realEtMap.containsKey("MP_OPTLOCK_ET_ORIGINAL" )) {//refer to OptimisticLockerInterceptor.MP_OPTLOCK_ET_ORIGINAL
-                                    tableInfo = TableInfoHelper.getTableInfo(realEtMap.get("MP_OPTLOCK_ET_ORIGINAL" ).getClass());
+                                if (realEtMap.containsKey("MP_OPTLOCK_ET_ORIGINAL")) {//refer to OptimisticLockerInterceptor.MP_OPTLOCK_ET_ORIGINAL
+                                    tableInfo = TableInfoHelper.getTableInfo(realEtMap.get("MP_OPTLOCK_ET_ORIGINAL").getClass());
                                 }
                             } else {
                                 tableInfo = TableInfoHelper.getTableInfo(et.getClass());
@@ -172,19 +172,19 @@ public class MybatisDefaultParameterHandler extends DefaultParameterHandler {
      * @param parameter 插入数据库对象
      * @return
      */
-    @SuppressWarnings({"rawtypes" , "unchecked"})
+    @SuppressWarnings({"rawtypes", "unchecked"})
     protected static Collection<Object> getParameters(Object parameter) {
         Collection<Object> parameters = null;
         if (parameter instanceof Collection) {
             parameters = (Collection) parameter;
         } else if (parameter instanceof Map) {
             Map parameterMap = (Map) parameter;
-            if (parameterMap.containsKey("collection" )) {
-                parameters = (Collection) parameterMap.get("collection" );
-            } else if (parameterMap.containsKey("list" )) {
-                parameters = (List) parameterMap.get("list" );
-            } else if (parameterMap.containsKey("array" )) {
-                parameters = Arrays.asList((Object[]) parameterMap.get("array" ));
+            if (parameterMap.containsKey("collection")) {
+                parameters = (Collection) parameterMap.get("collection");
+            } else if (parameterMap.containsKey("list")) {
+                parameters = (List) parameterMap.get("list");
+            } else if (parameterMap.containsKey("array")) {
+                parameters = Arrays.asList((Object[]) parameterMap.get("array"));
             }
         }
         return parameters;
@@ -234,7 +234,7 @@ public class MybatisDefaultParameterHandler extends DefaultParameterHandler {
         return metaObject.getOriginalObject();
     }
 
-    @SuppressWarnings({"rawtypes" , "unchecked"})
+    @SuppressWarnings({"rawtypes", "unchecked"})
     @Override
     public void setParameters(PreparedStatement ps) {
         // 反射获取动态参数
@@ -244,7 +244,7 @@ public class MybatisDefaultParameterHandler extends DefaultParameterHandler {
         } catch (IllegalAccessException e) {
             // ignored, Because it will never happen.
         }
-        ErrorContext.instance().activity("setting parameters" ).object(mappedStatement.getParameterMap().getId());
+        ErrorContext.instance().activity("setting parameters").object(mappedStatement.getParameterMap().getId());
         List<ParameterMapping> parameterMappings = boundSql.getParameterMappings();
         if (parameterMappings != null) {
             for (int i = 0; i < parameterMappings.size(); i++) {

+ 15 - 15
mybatis-plus-core/src/main/java/com/baomidou/mybatisplus/core/MybatisMapperAnnotationBuilder.java

@@ -117,7 +117,7 @@ public class MybatisMapperAnnotationBuilder extends MapperAnnotationBuilder {
         // 执行父类
         super(configuration, type);
 
-        String resource = type.getName().replace('.', '/') + ".java (best guess)" ;
+        String resource = type.getName().replace('.', '/') + ".java (best guess)";
         this.assistant = new MapperBuilderAssistant(configuration, resource);
         this.configuration = configuration;
         this.type = type;
@@ -181,7 +181,7 @@ public class MybatisMapperAnnotationBuilder extends MapperAnnotationBuilder {
         // to prevent loading again a resource twice
         // this flag is set at XMLMapperBuilder#bindMapperForNamespace
         if (!configuration.isResourceLoaded("namespace:" + type.getName())) {
-            String xmlResource = type.getName().replace('.', '/') + ".xml" ;
+            String xmlResource = type.getName().replace('.', '/') + ".xml";
             InputStream inputStream = null;
             try {
                 inputStream = Resources.getResourceAsStream(type.getClassLoader(), xmlResource);
@@ -223,10 +223,10 @@ public class MybatisMapperAnnotationBuilder extends MapperAnnotationBuilder {
             Class<?> refType = cacheDomainRef.value();
             String refName = cacheDomainRef.name();
             if (refType == void.class && refName.isEmpty()) {
-                throw new BuilderException("Should be specified either value() or name() attribute in the @CacheNamespaceRef" );
+                throw new BuilderException("Should be specified either value() or name() attribute in the @CacheNamespaceRef");
             }
             if (refType != void.class && !refName.isEmpty()) {
-                throw new BuilderException("Cannot use both value() and name() attribute in the @CacheNamespaceRef" );
+                throw new BuilderException("Cannot use both value() and name() attribute in the @CacheNamespaceRef");
             }
             String namespace = (refType != void.class) ? refType.getName() : refName;
             assistant.useCacheRef(namespace);
@@ -250,11 +250,11 @@ public class MybatisMapperAnnotationBuilder extends MapperAnnotationBuilder {
         }
         StringBuilder suffix = new StringBuilder();
         for (Class<?> c : method.getParameterTypes()) {
-            suffix.append("-" );
+            suffix.append("-");
             suffix.append(c.getSimpleName());
         }
         if (suffix.length() < 1) {
-            suffix.append("-void" );
+            suffix.append("-void");
         }
         return type.getName() + "." + method.getName() + suffix;
     }
@@ -289,7 +289,7 @@ public class MybatisMapperAnnotationBuilder extends MapperAnnotationBuilder {
             String column = discriminator.column();
             Class<?> javaType = discriminator.javaType() == void.class ? String.class : discriminator.javaType();
             JdbcType jdbcType = discriminator.jdbcType() == JdbcType.UNDEFINED ? null : discriminator.jdbcType();
-            @SuppressWarnings("unchecked" )
+            @SuppressWarnings("unchecked")
             Class<? extends TypeHandler<?>> typeHandler = (Class<? extends TypeHandler<?>>) (discriminator.typeHandler() == UnknownTypeHandler.class ? null
                 : discriminator.typeHandler());
             Case[] cases = discriminator.cases();
@@ -321,7 +321,7 @@ public class MybatisMapperAnnotationBuilder extends MapperAnnotationBuilder {
             boolean useCache = isSelect;
 
             KeyGenerator keyGenerator;
-            String keyProperty = "id" ;
+            String keyProperty = "id";
             String keyColumn = null;
             if (SqlCommandType.INSERT.equals(sqlCommandType) || SqlCommandType.UPDATE.equals(sqlCommandType)) {
                 // first check for SelectKey annotation - that overrides everything else
@@ -360,7 +360,7 @@ public class MybatisMapperAnnotationBuilder extends MapperAnnotationBuilder {
                 StringBuilder sb = new StringBuilder();
                 for (String resultMap : resultMaps) {
                     if (sb.length() > 0) {
-                        sb.append("," );
+                        sb.append(",");
                     }
                     sb.append(resultMap);
                 }
@@ -483,7 +483,7 @@ public class MybatisMapperAnnotationBuilder extends MapperAnnotationBuilder {
                     throw new BindingException("You cannot supply both a static SQL and SqlProvider to method named " + method.getName());
                 }
                 Annotation sqlAnnotation = method.getAnnotation(sqlAnnotationType);
-                final String[] strings = (String[]) sqlAnnotation.getClass().getMethod("value" ).invoke(sqlAnnotation);
+                final String[] strings = (String[]) sqlAnnotation.getClass().getMethod("value").invoke(sqlAnnotation);
                 return buildSqlSourceFromStrings(strings, parameterType, languageDriver);
             } else if (sqlProviderAnnotationType != null) {
                 Annotation sqlProviderAnnotation = method.getAnnotation(sqlProviderAnnotationType);
@@ -499,7 +499,7 @@ public class MybatisMapperAnnotationBuilder extends MapperAnnotationBuilder {
         final StringBuilder sql = new StringBuilder();
         for (String fragment : strings) {
             sql.append(fragment);
-            sql.append(" " );
+            sql.append(" ");
         }
         return languageDriver.createSqlSource(configuration, sql.toString().trim(), parameterTypeClass);
     }
@@ -552,7 +552,7 @@ public class MybatisMapperAnnotationBuilder extends MapperAnnotationBuilder {
             if (result.id()) {
                 flags.add(ResultFlag.ID);
             }
-            @SuppressWarnings("unchecked" )
+            @SuppressWarnings("unchecked")
             Class<? extends TypeHandler<?>> typeHandler = (Class<? extends TypeHandler<?>>)
                 ((result.typeHandler() == UnknownTypeHandler.class) ? null : result.typeHandler());
             ResultMapping resultMapping = assistant.buildResultMapping(
@@ -579,7 +579,7 @@ public class MybatisMapperAnnotationBuilder extends MapperAnnotationBuilder {
         if (nestedSelect.length() < 1) {
             nestedSelect = result.many().select();
         }
-        if (!nestedSelect.contains("." )) {
+        if (!nestedSelect.contains(".")) {
             nestedSelect = type.getName() + "." + nestedSelect;
         }
         return nestedSelect;
@@ -597,7 +597,7 @@ public class MybatisMapperAnnotationBuilder extends MapperAnnotationBuilder {
 
     private boolean hasNestedSelect(Result result) {
         if (result.one().select().length() > 0 && result.many().select().length() > 0) {
-            throw new BuilderException("Cannot use both @One and @Many annotation in the same @Result" );
+            throw new BuilderException("Cannot use both @One and @Many annotation in the same @Result");
         }
         return result.one().select().length() > 0 || result.many().select().length() > 0;
     }
@@ -609,7 +609,7 @@ public class MybatisMapperAnnotationBuilder extends MapperAnnotationBuilder {
             if (arg.id()) {
                 flags.add(ResultFlag.ID);
             }
-            @SuppressWarnings("unchecked" )
+            @SuppressWarnings("unchecked")
             Class<? extends TypeHandler<?>> typeHandler = (Class<? extends TypeHandler<?>>)
                 (arg.typeHandler() == UnknownTypeHandler.class ? null : arg.typeHandler());
             ResultMapping resultMapping = assistant.buildResultMapping(

+ 1 - 1
mybatis-plus-core/src/main/java/com/baomidou/mybatisplus/core/MybatisMapperRegistry.java

@@ -52,7 +52,7 @@ public class MybatisMapperRegistry extends MapperRegistry {
     public <T> T getMapper(Class<T> type, SqlSession sqlSession) {
         final MapperProxyFactory<T> mapperProxyFactory = (MapperProxyFactory<T>) knownMappers.get(type);
         if (mapperProxyFactory == null) {
-            throw new BindingException("Type " + type + " is not known to the MybatisPlusMapperRegistry." );
+            throw new BindingException("Type " + type + " is not known to the MybatisPlusMapperRegistry.");
         }
         try {
             return mapperProxyFactory.newInstance(sqlSession);

+ 2 - 2
mybatis-plus-core/src/main/java/com/baomidou/mybatisplus/core/MybatisSessionFactoryBuilder.java

@@ -47,7 +47,7 @@ public class MybatisSessionFactoryBuilder extends SqlSessionFactoryBuilder {
             GlobalConfigUtils.setGlobalConfig(parser.getConfiguration(), this.globalConfig);
             return build(parser.parse());
         } catch (Exception e) {
-            throw ExceptionFactory.wrapException("Error building SqlSession." , e);
+            throw ExceptionFactory.wrapException("Error building SqlSession.", e);
         } finally {
             ErrorContext.instance().reset();
             IOUtils.closeQuietly(reader);
@@ -61,7 +61,7 @@ public class MybatisSessionFactoryBuilder extends SqlSessionFactoryBuilder {
             GlobalConfigUtils.setGlobalConfig(parser.getConfiguration(), this.globalConfig);
             return build(parser.parse());
         } catch (Exception e) {
-            throw ExceptionFactory.wrapException("Error building SqlSession." , e);
+            throw ExceptionFactory.wrapException("Error building SqlSession.", e);
         } finally {
             ErrorContext.instance().reset();
             IOUtils.closeQuietly(inputStream);

+ 75 - 75
mybatis-plus-core/src/main/java/com/baomidou/mybatisplus/core/MybatisXMLConfigBuilder.java

@@ -95,7 +95,7 @@ public class MybatisXMLConfigBuilder extends BaseBuilder {
     private MybatisXMLConfigBuilder(XPathParser parser, String environment, Properties props) {
         //TODO 自定义 Configuration
         super(new MybatisConfiguration());
-        ErrorContext.instance().resource("SQL Mapper Configuration" );
+        ErrorContext.instance().resource("SQL Mapper Configuration");
         this.configuration.setVariables(props);
         this.parsed = false;
         this.environment = environment;
@@ -104,30 +104,30 @@ public class MybatisXMLConfigBuilder extends BaseBuilder {
 
     public Configuration parse() {
         if (parsed) {
-            throw new BuilderException("Each XMLConfigBuilder can only be used once." );
+            throw new BuilderException("Each XMLConfigBuilder can only be used once.");
         }
         parsed = true;
-        parseConfiguration(parser.evalNode("/configuration" ));
+        parseConfiguration(parser.evalNode("/configuration"));
         return configuration;
     }
 
     private void parseConfiguration(XNode root) {
         try {
             //issue #117 read properties first
-            propertiesElement(root.evalNode("properties" ));
-            Properties settings = settingsAsProperties(root.evalNode("settings" ));
+            propertiesElement(root.evalNode("properties"));
+            Properties settings = settingsAsProperties(root.evalNode("settings"));
             loadCustomVfs(settings);
-            typeAliasesElement(root.evalNode("typeAliases" ));
-            pluginElement(root.evalNode("plugins" ));
-            objectFactoryElement(root.evalNode("objectFactory" ));
-            objectWrapperFactoryElement(root.evalNode("objectWrapperFactory" ));
-            reflectorFactoryElement(root.evalNode("reflectorFactory" ));
+            typeAliasesElement(root.evalNode("typeAliases"));
+            pluginElement(root.evalNode("plugins"));
+            objectFactoryElement(root.evalNode("objectFactory"));
+            objectWrapperFactoryElement(root.evalNode("objectWrapperFactory"));
+            reflectorFactoryElement(root.evalNode("reflectorFactory"));
             settingsElement(settings);
             // read it after objectFactory and objectWrapperFactory issue #631
-            environmentsElement(root.evalNode("environments" ));
-            databaseIdProviderElement(root.evalNode("databaseIdProvider" ));
-            typeHandlerElement(root.evalNode("typeHandlers" ));
-            mapperElement(root.evalNode("mappers" ));
+            environmentsElement(root.evalNode("environments"));
+            databaseIdProviderElement(root.evalNode("databaseIdProvider"));
+            typeHandlerElement(root.evalNode("typeHandlers"));
+            mapperElement(root.evalNode("mappers"));
         } catch (Exception e) {
             throw new BuilderException("Error parsing SQL Mapper Configuration. Cause: " + e, e);
         }
@@ -142,19 +142,19 @@ public class MybatisXMLConfigBuilder extends BaseBuilder {
         MetaClass metaConfig = MetaClass.forClass(Configuration.class, localReflectorFactory);
         for (Object key : props.keySet()) {
             if (!metaConfig.hasSetter(String.valueOf(key))) {
-                throw new BuilderException("The setting " + key + " is not known.  Make sure you spelled it correctly (case sensitive)." );
+                throw new BuilderException("The setting " + key + " is not known.  Make sure you spelled it correctly (case sensitive).");
             }
         }
         return props;
     }
 
     private void loadCustomVfs(Properties props) throws ClassNotFoundException {
-        String value = props.getProperty("vfsImpl" );
+        String value = props.getProperty("vfsImpl");
         if (value != null) {
-            String[] clazzes = value.split("," );
+            String[] clazzes = value.split(",");
             for (String clazz : clazzes) {
                 if (!clazz.isEmpty()) {
-                    @SuppressWarnings("unchecked" )
+                    @SuppressWarnings("unchecked")
                     Class<? extends VFS> vfsImpl = (Class<? extends VFS>) Resources.classForName(clazz);
                     configuration.setVfsImpl(vfsImpl);
                 }
@@ -166,11 +166,11 @@ public class MybatisXMLConfigBuilder extends BaseBuilder {
         if (parent != null) {
             for (XNode child : parent.getChildren()) {
                 if ("package".equals(child.getName())) {
-                    String typeAliasPackage = child.getStringAttribute("name" );
+                    String typeAliasPackage = child.getStringAttribute("name");
                     configuration.getTypeAliasRegistry().registerAliases(typeAliasPackage);
                 } else {
-                    String alias = child.getStringAttribute("alias" );
-                    String type = child.getStringAttribute("type" );
+                    String alias = child.getStringAttribute("alias");
+                    String type = child.getStringAttribute("type");
                     try {
                         Class<?> clazz = Resources.classForName(type);
                         if (alias == null) {
@@ -189,7 +189,7 @@ public class MybatisXMLConfigBuilder extends BaseBuilder {
     private void pluginElement(XNode parent) throws Exception {
         if (parent != null) {
             for (XNode child : parent.getChildren()) {
-                String interceptor = child.getStringAttribute("interceptor" );
+                String interceptor = child.getStringAttribute("interceptor");
                 Properties properties = child.getChildrenAsProperties();
                 Interceptor interceptorInstance = (Interceptor) resolveClass(interceptor).newInstance();
                 interceptorInstance.setProperties(properties);
@@ -200,7 +200,7 @@ public class MybatisXMLConfigBuilder extends BaseBuilder {
 
     private void objectFactoryElement(XNode context) throws Exception {
         if (context != null) {
-            String type = context.getStringAttribute("type" );
+            String type = context.getStringAttribute("type");
             Properties properties = context.getChildrenAsProperties();
             ObjectFactory factory = (ObjectFactory) resolveClass(type).newInstance();
             factory.setProperties(properties);
@@ -210,7 +210,7 @@ public class MybatisXMLConfigBuilder extends BaseBuilder {
 
     private void objectWrapperFactoryElement(XNode context) throws Exception {
         if (context != null) {
-            String type = context.getStringAttribute("type" );
+            String type = context.getStringAttribute("type");
             ObjectWrapperFactory factory = (ObjectWrapperFactory) resolveClass(type).newInstance();
             configuration.setObjectWrapperFactory(factory);
         }
@@ -218,7 +218,7 @@ public class MybatisXMLConfigBuilder extends BaseBuilder {
 
     private void reflectorFactoryElement(XNode context) throws Exception {
         if (context != null) {
-            String type = context.getStringAttribute("type" );
+            String type = context.getStringAttribute("type");
             ReflectorFactory factory = (ReflectorFactory) resolveClass(type).newInstance();
             configuration.setReflectorFactory(factory);
         }
@@ -227,10 +227,10 @@ public class MybatisXMLConfigBuilder extends BaseBuilder {
     private void propertiesElement(XNode context) throws Exception {
         if (context != null) {
             Properties defaults = context.getChildrenAsProperties();
-            String resource = context.getStringAttribute("resource" );
-            String url = context.getStringAttribute("url" );
+            String resource = context.getStringAttribute("resource");
+            String url = context.getStringAttribute("url");
             if (resource != null && url != null) {
-                throw new BuilderException("The properties element cannot specify both a URL and a resource based property file reference.  Please specify one or the other." );
+                throw new BuilderException("The properties element cannot specify both a URL and a resource based property file reference.  Please specify one or the other.");
             }
             if (resource != null) {
                 defaults.putAll(Resources.getResourceAsProperties(resource));
@@ -247,45 +247,45 @@ public class MybatisXMLConfigBuilder extends BaseBuilder {
     }
 
     private void settingsElement(Properties props) throws Exception {
-        configuration.setAutoMappingBehavior(AutoMappingBehavior.valueOf(props.getProperty("autoMappingBehavior" , "PARTIAL" )));
-        configuration.setAutoMappingUnknownColumnBehavior(AutoMappingUnknownColumnBehavior.valueOf(props.getProperty("autoMappingUnknownColumnBehavior" , "NONE" )));
-        configuration.setCacheEnabled(booleanValueOf(props.getProperty("cacheEnabled" ), true));
-        configuration.setProxyFactory((ProxyFactory) createInstance(props.getProperty("proxyFactory" )));
-        configuration.setLazyLoadingEnabled(booleanValueOf(props.getProperty("lazyLoadingEnabled" ), false));
-        configuration.setAggressiveLazyLoading(booleanValueOf(props.getProperty("aggressiveLazyLoading" ), false));
-        configuration.setMultipleResultSetsEnabled(booleanValueOf(props.getProperty("multipleResultSetsEnabled" ), true));
-        configuration.setUseColumnLabel(booleanValueOf(props.getProperty("useColumnLabel" ), true));
-        configuration.setUseGeneratedKeys(booleanValueOf(props.getProperty("useGeneratedKeys" ), false));
-        configuration.setDefaultExecutorType(ExecutorType.valueOf(props.getProperty("defaultExecutorType" , "SIMPLE" )));
-        configuration.setDefaultStatementTimeout(integerValueOf(props.getProperty("defaultStatementTimeout" ), null));
-        configuration.setDefaultFetchSize(integerValueOf(props.getProperty("defaultFetchSize" ), null));
-        configuration.setMapUnderscoreToCamelCase(booleanValueOf(props.getProperty("mapUnderscoreToCamelCase" ), false));
-        configuration.setSafeRowBoundsEnabled(booleanValueOf(props.getProperty("safeRowBoundsEnabled" ), false));
-        configuration.setLocalCacheScope(LocalCacheScope.valueOf(props.getProperty("localCacheScope" , "SESSION" )));
-        configuration.setJdbcTypeForNull(JdbcType.valueOf(props.getProperty("jdbcTypeForNull" , "OTHER" )));
-        configuration.setLazyLoadTriggerMethods(stringSetValueOf(props.getProperty("lazyLoadTriggerMethods" ), "equals,clone,hashCode,toString" ));
-        configuration.setSafeResultHandlerEnabled(booleanValueOf(props.getProperty("safeResultHandlerEnabled" ), true));
-        configuration.setDefaultScriptingLanguage(resolveClass(props.getProperty("defaultScriptingLanguage" )));
-        configuration.setCallSettersOnNulls(booleanValueOf(props.getProperty("callSettersOnNulls" ), false));
-        configuration.setUseActualParamName(booleanValueOf(props.getProperty("useActualParamName" ), true));
-        configuration.setReturnInstanceForEmptyRow(booleanValueOf(props.getProperty("returnInstanceForEmptyRow" ), false));
-        configuration.setLogPrefix(props.getProperty("logPrefix" ));
-        @SuppressWarnings("unchecked" )
-        Class<? extends Log> logImpl = (Class<? extends Log>) resolveClass(props.getProperty("logImpl" ));
+        configuration.setAutoMappingBehavior(AutoMappingBehavior.valueOf(props.getProperty("autoMappingBehavior", "PARTIAL")));
+        configuration.setAutoMappingUnknownColumnBehavior(AutoMappingUnknownColumnBehavior.valueOf(props.getProperty("autoMappingUnknownColumnBehavior", "NONE")));
+        configuration.setCacheEnabled(booleanValueOf(props.getProperty("cacheEnabled"), true));
+        configuration.setProxyFactory((ProxyFactory) createInstance(props.getProperty("proxyFactory")));
+        configuration.setLazyLoadingEnabled(booleanValueOf(props.getProperty("lazyLoadingEnabled"), false));
+        configuration.setAggressiveLazyLoading(booleanValueOf(props.getProperty("aggressiveLazyLoading"), false));
+        configuration.setMultipleResultSetsEnabled(booleanValueOf(props.getProperty("multipleResultSetsEnabled"), true));
+        configuration.setUseColumnLabel(booleanValueOf(props.getProperty("useColumnLabel"), true));
+        configuration.setUseGeneratedKeys(booleanValueOf(props.getProperty("useGeneratedKeys"), false));
+        configuration.setDefaultExecutorType(ExecutorType.valueOf(props.getProperty("defaultExecutorType", "SIMPLE")));
+        configuration.setDefaultStatementTimeout(integerValueOf(props.getProperty("defaultStatementTimeout"), null));
+        configuration.setDefaultFetchSize(integerValueOf(props.getProperty("defaultFetchSize"), null));
+        configuration.setMapUnderscoreToCamelCase(booleanValueOf(props.getProperty("mapUnderscoreToCamelCase"), false));
+        configuration.setSafeRowBoundsEnabled(booleanValueOf(props.getProperty("safeRowBoundsEnabled"), false));
+        configuration.setLocalCacheScope(LocalCacheScope.valueOf(props.getProperty("localCacheScope", "SESSION")));
+        configuration.setJdbcTypeForNull(JdbcType.valueOf(props.getProperty("jdbcTypeForNull", "OTHER")));
+        configuration.setLazyLoadTriggerMethods(stringSetValueOf(props.getProperty("lazyLoadTriggerMethods"), "equals,clone,hashCode,toString"));
+        configuration.setSafeResultHandlerEnabled(booleanValueOf(props.getProperty("safeResultHandlerEnabled"), true));
+        configuration.setDefaultScriptingLanguage(resolveClass(props.getProperty("defaultScriptingLanguage")));
+        configuration.setCallSettersOnNulls(booleanValueOf(props.getProperty("callSettersOnNulls"), false));
+        configuration.setUseActualParamName(booleanValueOf(props.getProperty("useActualParamName"), true));
+        configuration.setReturnInstanceForEmptyRow(booleanValueOf(props.getProperty("returnInstanceForEmptyRow"), false));
+        configuration.setLogPrefix(props.getProperty("logPrefix"));
+        @SuppressWarnings("unchecked")
+        Class<? extends Log> logImpl = (Class<? extends Log>) resolveClass(props.getProperty("logImpl"));
         configuration.setLogImpl(logImpl);
-        configuration.setConfigurationFactory(resolveClass(props.getProperty("configurationFactory" )));
+        configuration.setConfigurationFactory(resolveClass(props.getProperty("configurationFactory")));
     }
 
     private void environmentsElement(XNode context) throws Exception {
         if (context != null) {
             if (environment == null) {
-                environment = context.getStringAttribute("default" );
+                environment = context.getStringAttribute("default");
             }
             for (XNode child : context.getChildren()) {
-                String id = child.getStringAttribute("id" );
+                String id = child.getStringAttribute("id");
                 if (isSpecifiedEnvironment(id)) {
-                    TransactionFactory txFactory = transactionManagerElement(child.evalNode("transactionManager" ));
-                    DataSourceFactory dsFactory = dataSourceElement(child.evalNode("dataSource" ));
+                    TransactionFactory txFactory = transactionManagerElement(child.evalNode("transactionManager"));
+                    DataSourceFactory dsFactory = dataSourceElement(child.evalNode("dataSource"));
                     DataSource dataSource = dsFactory.getDataSource();
                     Environment.Builder environmentBuilder = new Environment.Builder(id)
                         .transactionFactory(txFactory)
@@ -299,10 +299,10 @@ public class MybatisXMLConfigBuilder extends BaseBuilder {
     private void databaseIdProviderElement(XNode context) throws Exception {
         DatabaseIdProvider databaseIdProvider = null;
         if (context != null) {
-            String type = context.getStringAttribute("type" );
+            String type = context.getStringAttribute("type");
             // awful patch to keep backward compatibility
             if ("VENDOR".equals(type)) {
-                type = "DB_VENDOR" ;
+                type = "DB_VENDOR";
             }
             Properties properties = context.getChildrenAsProperties();
             databaseIdProvider = (DatabaseIdProvider) resolveClass(type).newInstance();
@@ -317,36 +317,36 @@ public class MybatisXMLConfigBuilder extends BaseBuilder {
 
     private TransactionFactory transactionManagerElement(XNode context) throws Exception {
         if (context != null) {
-            String type = context.getStringAttribute("type" );
+            String type = context.getStringAttribute("type");
             Properties props = context.getChildrenAsProperties();
             TransactionFactory factory = (TransactionFactory) resolveClass(type).newInstance();
             factory.setProperties(props);
             return factory;
         }
-        throw new BuilderException("Environment declaration requires a TransactionFactory." );
+        throw new BuilderException("Environment declaration requires a TransactionFactory.");
     }
 
     private DataSourceFactory dataSourceElement(XNode context) throws Exception {
         if (context != null) {
-            String type = context.getStringAttribute("type" );
+            String type = context.getStringAttribute("type");
             Properties props = context.getChildrenAsProperties();
             DataSourceFactory factory = (DataSourceFactory) resolveClass(type).newInstance();
             factory.setProperties(props);
             return factory;
         }
-        throw new BuilderException("Environment declaration requires a DataSourceFactory." );
+        throw new BuilderException("Environment declaration requires a DataSourceFactory.");
     }
 
     private void typeHandlerElement(XNode parent) throws Exception {
         if (parent != null) {
             for (XNode child : parent.getChildren()) {
                 if ("package".equals(child.getName())) {
-                    String typeHandlerPackage = child.getStringAttribute("name" );
+                    String typeHandlerPackage = child.getStringAttribute("name");
                     typeHandlerRegistry.register(typeHandlerPackage);
                 } else {
-                    String javaTypeName = child.getStringAttribute("javaType" );
-                    String jdbcTypeName = child.getStringAttribute("jdbcType" );
-                    String handlerTypeName = child.getStringAttribute("handler" );
+                    String javaTypeName = child.getStringAttribute("javaType");
+                    String jdbcTypeName = child.getStringAttribute("jdbcType");
+                    String handlerTypeName = child.getStringAttribute("handler");
                     Class<?> javaTypeClass = resolveClass(javaTypeName);
                     JdbcType jdbcType = resolveJdbcType(jdbcTypeName);
                     Class<?> typeHandlerClass = resolveClass(handlerTypeName);
@@ -401,15 +401,15 @@ public class MybatisXMLConfigBuilder extends BaseBuilder {
     private void setResource(XNode parent, Set<String> resources, Set<Class<?>> mapper) throws ClassNotFoundException {
         for (XNode child : parent.getChildren()) {
             if ("package".equals(child.getName())) {
-                String mapperPackage = child.getStringAttribute("name" );
+                String mapperPackage = child.getStringAttribute("name");
                 ResolverUtil<Class<?>> resolverUtil = new ResolverUtil<>();
                 resolverUtil.find(new ResolverUtil.IsA(Object.class), mapperPackage);
                 Set<Class<? extends Class<?>>> mapperSet = resolverUtil.getClasses();
                 mapper.addAll(mapperSet);
             } else {
-                String resource = child.getStringAttribute("resource" );
-                String url = child.getStringAttribute("url" );
-                String mapperClass = child.getStringAttribute("class" );
+                String resource = child.getStringAttribute("resource");
+                String url = child.getStringAttribute("url");
+                String mapperClass = child.getStringAttribute("class");
                 if (resource != null && url == null && mapperClass == null) {
                     resources.add(resource);
                 } else if (resource == null && url != null && mapperClass == null) {
@@ -419,7 +419,7 @@ public class MybatisXMLConfigBuilder extends BaseBuilder {
                     mapper.add(mapperInterface);
                 } else {
                     throw new BuilderException(
-                        "A mapper element may only specify a url, resource or class, but not more than one." );
+                        "A mapper element may only specify a url, resource or class, but not more than one.");
                 }
             }
         }
@@ -427,9 +427,9 @@ public class MybatisXMLConfigBuilder extends BaseBuilder {
 
     private boolean isSpecifiedEnvironment(String id) {
         if (environment == null) {
-            throw new BuilderException("No environment specified." );
+            throw new BuilderException("No environment specified.");
         } else if (id == null) {
-            throw new BuilderException("Environment requires an id attribute." );
+            throw new BuilderException("Environment requires an id attribute.");
         } else if (environment.equals(id)) {
             return true;
         }

+ 8 - 8
mybatis-plus-core/src/main/java/com/baomidou/mybatisplus/core/assist/ISqlRunner.java

@@ -16,14 +16,14 @@ import com.baomidou.mybatisplus.core.pagination.Page;
  */
 public abstract class ISqlRunner {
 
-    public static final String INSERT = "com.baomidou.mybatisplus.core.mapper.SqlRunner.Insert" ;
-    public static final String DELETE = "com.baomidou.mybatisplus.core.mapper.SqlRunner.Delete" ;
-    public static final String UPDATE = "com.baomidou.mybatisplus.core.mapper.SqlRunner.Update" ;
-    public static final String SELECT_LIST = "com.baomidou.mybatisplus.core.mapper.SqlRunner.SelectList" ;
-    public static final String SELECT_OBJS = "com.baomidou.mybatisplus.core.mapper.SqlRunner.SelectObjs" ;
-    public static final String COUNT = "com.baomidou.mybatisplus.core.mapper.SqlRunner.Count" ;
-    public static final String SQLScript = "${sql}" ;
-    public static final String SQL = "sql" ;
+    public static final String INSERT = "com.baomidou.mybatisplus.core.mapper.SqlRunner.Insert";
+    public static final String DELETE = "com.baomidou.mybatisplus.core.mapper.SqlRunner.Delete";
+    public static final String UPDATE = "com.baomidou.mybatisplus.core.mapper.SqlRunner.Update";
+    public static final String SELECT_LIST = "com.baomidou.mybatisplus.core.mapper.SqlRunner.SelectList";
+    public static final String SELECT_OBJS = "com.baomidou.mybatisplus.core.mapper.SqlRunner.SelectObjs";
+    public static final String COUNT = "com.baomidou.mybatisplus.core.mapper.SqlRunner.Count";
+    public static final String SQLScript = "${sql}";
+    public static final String SQL = "sql";
 
     public static SqlSessionFactory FACTORY;
 

+ 1 - 1
mybatis-plus-core/src/main/java/com/baomidou/mybatisplus/core/conditions/Condition.java

@@ -23,7 +23,7 @@ package com.baomidou.mybatisplus.core.conditions;
  * @author hubin Caratacus
  * @date 2016-11-7
  */
-@SuppressWarnings({"rawtypes" , "serial"})
+@SuppressWarnings({"rawtypes", "serial"})
 public abstract class Condition {
 
     /**

+ 2 - 2
mybatis-plus-core/src/main/java/com/baomidou/mybatisplus/core/conditions/EntityWrapper.java

@@ -26,7 +26,7 @@ import com.baomidou.mybatisplus.core.toolkit.StringUtils;
  * @author hubin , yanghu , Dyang , Caratacus
  * @Date 2016-11-7
  */
-@SuppressWarnings("serial" )
+@SuppressWarnings("serial")
 public class EntityWrapper<T> extends Wrapper<T> {
 
     /**
@@ -72,7 +72,7 @@ public class EntityWrapper<T> extends Wrapper<T> {
         /*
          * 根据当前实体判断是否需要将WHERE替换成 AND 增加实体不为空但所有属性为空的情况
          */
-        return isWhere != null ? (isWhere ? sqlWhere : sqlWhere.replaceFirst("WHERE" , AND_OR)) : sqlWhere.replaceFirst("WHERE" , AND_OR);
+        return isWhere != null ? (isWhere ? sqlWhere : sqlWhere.replaceFirst("WHERE", AND_OR)) : sqlWhere.replaceFirst("WHERE", AND_OR);
     }
 
 }

+ 13 - 13
mybatis-plus-core/src/main/java/com/baomidou/mybatisplus/core/conditions/MybatisAbstractSQL.java

@@ -31,13 +31,13 @@ import com.baomidou.mybatisplus.core.toolkit.StringUtils;
  * @author yanghu
  * @Date 2016-08-22
  */
-@SuppressWarnings("serial" )
+@SuppressWarnings("serial")
 public abstract class MybatisAbstractSQL<T> implements Serializable {
 
-    private static final String AND = " AND " ;
-    private static final String OR = " OR " ;
-    private static final String AND_NEW = ") \nAND (" ;
-    private static final String OR_NEW = ") \nOR (" ;
+    private static final String AND = " AND ";
+    private static final String OR = " OR ";
+    private static final String AND_NEW = ") \nAND (";
+    private static final String OR_NEW = ") \nOR (";
 
     /**
      * SQL条件
@@ -184,13 +184,13 @@ public abstract class MybatisAbstractSQL<T> implements Serializable {
             parts = clearNull(parts);
             if (!parts.isEmpty()) {
                 if (!builder.isEmpty()) {
-                    builder.append("\n" );
+                    builder.append("\n");
                 }
 
                 builder.append(keyword);
-                builder.append(" " );
+                builder.append(" ");
                 builder.append(open);
-                String last = "__" ;
+                String last = "__";
                 for (int i = 0, n = parts.size(); i < n; i++) {
                     String part = parts.get(i);
                     if (i > 0) {
@@ -232,12 +232,12 @@ public abstract class MybatisAbstractSQL<T> implements Serializable {
          * @return
          */
         private String buildSQL(SafeAppendable builder) {
-            sqlClause(builder, "WHERE" , where, "(" , ")" , AND);
-            sqlClause(builder, "GROUP BY" , groupBy, "" , "" , ", " );
-            sqlClause(builder, "HAVING" , having, "(" , ")" , AND);
-            sqlClause(builder, "ORDER BY" , orderBy, "" , "" , ", " );
+            sqlClause(builder, "WHERE", where, "(", ")", AND);
+            sqlClause(builder, "GROUP BY", groupBy, "", "", ", ");
+            sqlClause(builder, "HAVING", having, "(", ")", AND);
+            sqlClause(builder, "ORDER BY", orderBy, "", "", ", ");
             if (StringUtils.isNotEmpty(last)) {
-                builder.append(" " );
+                builder.append(" ");
                 builder.append(last);
             }
             return builder.toString();

+ 6 - 6
mybatis-plus-core/src/main/java/com/baomidou/mybatisplus/core/conditions/SqlPlus.java

@@ -25,11 +25,11 @@ import com.baomidou.mybatisplus.core.toolkit.StringUtils;
  * @author yanghu , Caratacus , hubin
  * @Date 2016-08-22
  */
-@SuppressWarnings("serial" )
+@SuppressWarnings("serial")
 public class SqlPlus extends MybatisAbstractSQL<SqlPlus> {
 
-    private final String IS_NOT_NULL = " IS NOT NULL" ;
-    private final String IS_NULL = " IS NULL" ;
+    private final String IS_NOT_NULL = " IS NOT NULL";
+    private final String IS_NULL = " IS NULL";
 
     @Override
     public SqlPlus getSelf() {
@@ -87,9 +87,9 @@ public class SqlPlus extends MybatisAbstractSQL<SqlPlus> {
         if (StringUtils.isNotEmpty(value)) {
             StringBuilder inSql = new StringBuilder();
             if (isNot) {
-                inSql.append(" NOT" );
+                inSql.append(" NOT");
             }
-            inSql.append(" EXISTS (" ).append(value).append(")" );
+            inSql.append(" EXISTS (").append(value).append(")");
             WHERE(inSql.toString());
         }
     }
@@ -117,7 +117,7 @@ public class SqlPlus extends MybatisAbstractSQL<SqlPlus> {
      */
     private void handlerNull(String columns, String sqlPart) {
         if (StringUtils.isNotEmpty(columns)) {
-            String[] cols = columns.split("," );
+            String[] cols = columns.split(",");
             for (String col : cols) {
                 if (StringUtils.isNotEmpty(col.trim())) {
                     WHERE(col + sqlPart);

+ 4 - 4
mybatis-plus-core/src/main/java/com/baomidou/mybatisplus/core/enums/SqlLike.java

@@ -27,19 +27,19 @@ public enum SqlLike {
     /**
      * LEFT
      */
-    LEFT("left" , "左边%" ),
+    LEFT("left", "左边%"),
     /**
      * RIGHT
      */
-    RIGHT("right" , "右边%" ),
+    RIGHT("right", "右边%"),
     /**
      * CUSTOM
      */
-    CUSTOM("custom" , "定制" ),
+    CUSTOM("custom", "定制"),
     /**
      * DEFAULT
      */
-    DEFAULT("default" , "两边%" );
+    DEFAULT("default", "两边%");
 
     /**
      * 主键

+ 27 - 27
mybatis-plus-core/src/main/java/com/baomidou/mybatisplus/core/enums/SqlMethod.java

@@ -27,58 +27,58 @@ public enum SqlMethod {
     /**
      * 插入
      */
-    INSERT_ONE("insert" , "插入一条数据(选择字段插入)" , "<script>INSERT INTO %s %s VALUES %s</script>" ),
-    INSERT_ONE_ALL_COLUMN("insertAllColumn" , "插入一条数据(全部字段插入)" , "<script>INSERT INTO %s %s VALUES %s</script>" ),
+    INSERT_ONE("insert", "插入一条数据(选择字段插入)", "<script>INSERT INTO %s %s VALUES %s</script>"),
+    INSERT_ONE_ALL_COLUMN("insertAllColumn", "插入一条数据(全部字段插入)", "<script>INSERT INTO %s %s VALUES %s</script>"),
 
     /**
      * 删除
      */
-    DELETE_BY_ID("deleteById" , "根据ID 删除一条数据" , "<script>DELETE FROM %s WHERE %s=#{%s}</script>" ),
-    DELETE_BY_MAP("deleteByMap" , "根据columnMap 条件删除记录" , "<script>DELETE FROM %s %s</script>" ),
-    DELETE("delete" , "根据 entity 条件删除记录" , "<script>DELETE FROM %s %s</script>" ),
-    DELETE_BATCH_BY_IDS("deleteBatchIds" , "根据ID集合,批量删除数据" , "<script>DELETE FROM %s WHERE %s IN (%s)</script>" ),
+    DELETE_BY_ID("deleteById", "根据ID 删除一条数据", "<script>DELETE FROM %s WHERE %s=#{%s}</script>"),
+    DELETE_BY_MAP("deleteByMap", "根据columnMap 条件删除记录", "<script>DELETE FROM %s %s</script>"),
+    DELETE("delete", "根据 entity 条件删除记录", "<script>DELETE FROM %s %s</script>"),
+    DELETE_BATCH_BY_IDS("deleteBatchIds", "根据ID集合,批量删除数据", "<script>DELETE FROM %s WHERE %s IN (%s)</script>"),
 
     /**
      * 逻辑删除
      */
-    LOGIC_DELETE_BY_ID("deleteById" , "根据ID 逻辑删除一条数据" , "<script>UPDATE %s %s WHERE %s=#{%s}</script>" ),
-    LOGIC_DELETE_BY_MAP("deleteByMap" , "根据columnMap 条件逻辑删除记录" , "<script>UPDATE %s %s %s</script>" ),
-    LOGIC_DELETE("delete" , "根据 entity 条件逻辑删除记录" , "<script>UPDATE %s %s %s</script>" ),
-    LOGIC_DELETE_BATCH_BY_IDS("deleteBatchIds" , "根据ID集合,批量逻辑删除数据" , "<script>UPDATE %s %s WHERE %s IN (%s)</script>" ),
+    LOGIC_DELETE_BY_ID("deleteById", "根据ID 逻辑删除一条数据", "<script>UPDATE %s %s WHERE %s=#{%s}</script>"),
+    LOGIC_DELETE_BY_MAP("deleteByMap", "根据columnMap 条件逻辑删除记录", "<script>UPDATE %s %s %s</script>"),
+    LOGIC_DELETE("delete", "根据 entity 条件逻辑删除记录", "<script>UPDATE %s %s %s</script>"),
+    LOGIC_DELETE_BATCH_BY_IDS("deleteBatchIds", "根据ID集合,批量逻辑删除数据", "<script>UPDATE %s %s WHERE %s IN (%s)</script>"),
 
     /**
      * 修改
      */
-    UPDATE_BY_ID("updateById" , "根据ID 选择修改数据" , "<script>UPDATE %s %s WHERE %s=#{%s} %s</script>" ),
-    UPDATE_ALL_COLUMN_BY_ID("updateAllColumnById" , "根据ID 修改全部数据" , "<script>UPDATE %s %s WHERE %s=#{%s} %s</script>" ),
-    UPDATE("update" , "根据 whereEntity 条件,更新记录" , "<script>UPDATE %s %s %s</script>" ),
+    UPDATE_BY_ID("updateById", "根据ID 选择修改数据", "<script>UPDATE %s %s WHERE %s=#{%s} %s</script>"),
+    UPDATE_ALL_COLUMN_BY_ID("updateAllColumnById", "根据ID 修改全部数据", "<script>UPDATE %s %s WHERE %s=#{%s} %s</script>"),
+    UPDATE("update", "根据 whereEntity 条件,更新记录", "<script>UPDATE %s %s %s</script>"),
 
     /**
      * 逻辑删除 -> 修改
      */
-    LOGIC_UPDATE_BY_ID("updateById" , "根据ID 修改数据" , "<script>UPDATE %s %s WHERE %s=#{%s} %s</script>" ),
-    LOGIC_UPDATE_ALL_COLUMN_BY_ID("updateAllColumnById" , "根据ID 选择修改数据" , "<script>UPDATE %s %s WHERE %s=#{%s} %s</script>" ),
+    LOGIC_UPDATE_BY_ID("updateById", "根据ID 修改数据", "<script>UPDATE %s %s WHERE %s=#{%s} %s</script>"),
+    LOGIC_UPDATE_ALL_COLUMN_BY_ID("updateAllColumnById", "根据ID 选择修改数据", "<script>UPDATE %s %s WHERE %s=#{%s} %s</script>"),
 
 
     /**
      * 查询
      */
-    SELECT_BY_ID("selectById" , "根据ID 查询一条数据" , "SELECT %s FROM %s WHERE %s=#{%s}" ),
-    SELECT_BY_MAP("selectByMap" , "根据columnMap 查询一条数据" , "<script>SELECT %s FROM %s %s</script>" ),
-    SELECT_BATCH_BY_IDS("selectBatchIds" , "根据ID集合,批量查询数据" , "<script>SELECT %s FROM %s WHERE %s IN (%s)</script>" ),
-    SELECT_ONE("selectOne" , "查询满足条件一条数据" , "<script>SELECT %s FROM %s %s</script>" ),
-    SELECT_COUNT("selectCount" , "查询满足条件总记录数" , "<script>SELECT COUNT(1) FROM %s %s</script>" ),
-    SELECT_LIST("selectList" , "查询满足条件所有数据" , "<script>SELECT %s FROM %s %s</script>" ),
-    SELECT_PAGE("selectPage" , "查询满足条件所有数据(并翻页)" , "<script>SELECT %s FROM %s %s</script>" ),
-    SELECT_MAPS("selectMaps" , "查询满足条件所有数据" , "<script>SELECT %s FROM %s %s</script>" ),
-    SELECT_MAPS_PAGE("selectMapsPage" , "查询满足条件所有数据(并翻页)" , "<script>SELECT %s FROM %s %s</script>" ),
-    SELECT_OBJS("selectObjs" , "查询满足条件所有数据" , "<script>SELECT %s FROM %s %s</script>" ),
+    SELECT_BY_ID("selectById", "根据ID 查询一条数据", "SELECT %s FROM %s WHERE %s=#{%s}"),
+    SELECT_BY_MAP("selectByMap", "根据columnMap 查询一条数据", "<script>SELECT %s FROM %s %s</script>"),
+    SELECT_BATCH_BY_IDS("selectBatchIds", "根据ID集合,批量查询数据", "<script>SELECT %s FROM %s WHERE %s IN (%s)</script>"),
+    SELECT_ONE("selectOne", "查询满足条件一条数据", "<script>SELECT %s FROM %s %s</script>"),
+    SELECT_COUNT("selectCount", "查询满足条件总记录数", "<script>SELECT COUNT(1) FROM %s %s</script>"),
+    SELECT_LIST("selectList", "查询满足条件所有数据", "<script>SELECT %s FROM %s %s</script>"),
+    SELECT_PAGE("selectPage", "查询满足条件所有数据(并翻页)", "<script>SELECT %s FROM %s %s</script>"),
+    SELECT_MAPS("selectMaps", "查询满足条件所有数据", "<script>SELECT %s FROM %s %s</script>"),
+    SELECT_MAPS_PAGE("selectMapsPage", "查询满足条件所有数据(并翻页)", "<script>SELECT %s FROM %s %s</script>"),
+    SELECT_OBJS("selectObjs", "查询满足条件所有数据", "<script>SELECT %s FROM %s %s</script>"),
 
     /**
      * 逻辑删除 -> 查询
      */
-    LOGIC_SELECT_BY_ID("selectById" , "根据ID 查询一条数据" , "SELECT %s FROM %s WHERE %s=#{%s} %s" ),
-    LOGIC_SELECT_BATCH_BY_IDS("selectBatchIds" , "根据ID集合,批量查询数据" , "<script>SELECT %s FROM %s WHERE %s IN (%s) %s</script>" );
+    LOGIC_SELECT_BY_ID("selectById", "根据ID 查询一条数据", "SELECT %s FROM %s WHERE %s=#{%s} %s"),
+    LOGIC_SELECT_BATCH_BY_IDS("selectBatchIds", "根据ID集合,批量查询数据", "<script>SELECT %s FROM %s WHERE %s IN (%s) %s</script>");
 
     private final String method;
     private final String desc;

+ 1 - 1
mybatis-plus-core/src/main/java/com/baomidou/mybatisplus/core/handlers/MetaObjectHandler.java

@@ -28,7 +28,7 @@ import org.apache.ibatis.reflection.SystemMetaObject;
  */
 public abstract class MetaObjectHandler {
 
-    protected static final String META_OBJ_PREFIX = "et" ;
+    protected static final String META_OBJ_PREFIX = "et";
 
     /**
      * <p>

+ 105 - 105
mybatis-plus-core/src/main/java/com/baomidou/mybatisplus/core/handlers/SqlReservedWordsHandler.java

@@ -20,111 +20,111 @@ public abstract class SqlReservedWordsHandler {
     public static final Set<String> RESERVED_WORDS;
 
     static {
-        String[] words = {"AUDIT" , "VOLUMES" , "MINVALUE" , "STATIC" , "FLOOR" , "CATALOG" , "YEAR" , "TRIGGER_CATALOG" , "WLM" ,
-            "DISCONNECT" , "PARTITION" , "LEFT" , " MODE" , "SEARCH" , "CURRENT_PATH" , "DAYOFYEAR" , "SIZE" , "RESTRICT" , "RELEASE" ,
-            "WHERE" , "POSTFIX" , "SQLWARNING" , "UID" , "AS" , "AT" , "SYSID" , "DATABASE" , "SPECIFIC_NAME" , "TIMEZONE_MINUTE" ,
-            "LC_CTYPE" , "ATTRIBUTES" , "LOCATION" , "A" , "DOMAIN" , "C" , "SET" , " INCREMENT" , "MERGE" , "G" , "DAYS" , "HEADER" ,
-            "K" , "CONSTRAINT" , "M" , "PRECISION" , "ROLE" , "COLLATION_NAME" , "BY" , "STRAIGHT_JOIN" , "CHARACTER" , "INSTEAD" ,
-            "DUAL" , "DSNHATTR" , "BERNOULLI" , " ADD" , "CLUSTERED" , "CONTINUE" , "DIV" , "OPERATOR" , "SETS" , "SECURITY" ,
-            "CURRENT_LC_CTYPE" , "TRUNCATE" , "CURSOR" , "SQL_LOW_PRIORITY_UPDATES" , "CONSTRAINT_SCHEMA" , "STATEMENT" ,
-            "TABLE_NAME" , "NODENUMBER" , "DO" , "RECOVERY" , "LOW_PRIORITY" , "ADMIN" , "ESCAPED" , "CAPTURE" , "ALLOW" , "VARYING" ,
-            "DISABLE" , "STRICT" , "SQL_BIG_RESULT" , "ABORT" , "FOR" , "IMPLICIT" , "USING" , "EXEC" , "DEFERRABLE" , "RAISERROR" ,
-            "USER_DEFINED_TYPE_NAME" , "VALIDATOR" , "UNDO" , "STATE" , "WITHIN" , "NCHAR" , "ABSOLUTE" , "PREORDER" , "SCHEMA" ,
-            "SEQUENCE" , "ASSIGNMENT" , "COLUMNS" , "END-EXEC1" , "GO" , "ROW_NUMBER" , "BIT" , "INTERSECT" , "SYSDATE" , "WITH" ,
-            "CLASS_ORIGIN" , "ACTION" , "ISNULL" , "VALIDATE" , " COMPRESS" , "START" , "CHARACTER_LENGTH" , "BULK" , "EVERY" ,
-            "NULLIF" , "CEIL" , "FLUSH" , "MIN_ROWS" , "GRANTED" , "IF" , "BIT_LENGTH" , "PARAMETER" , "CHARACTER_SET_SCHEMA" ,
-            "DEFINITION" , "NCLOB" , "FIELDS" , "IN" , "DISTINCT" , "STYLE" , "IS" , "MASTER_BIND" , "REGR_INTERCEPT" , "TERMINATE" ,
-            "FORCE" , "FENCED" , " IMMEDIATE" , "MAP" , "READTEXT" , "SYSFUN" , "EXIT" , "DBCC" , "OPENROWSET" , "COLLATION" , "GOTO" ,
-            "RAID0" , "MAX" , "CASCADE" , "DELIMITERS" , "TRANSACTION" , "SECQTY" , "IGNORE" , "COMMENT" , "OFF" , "CHARACTERS" ,
-            "IDENTITYCOL" , "USAGE" , "UPDATE" , "SAVE" , "REQUIRE" , "DISTINCTROW" , "USE" , "RETURNS" , "LOCATORS" ,
-            "CHARACTERISTICS" , "FIRST" , "LINENO" , "ONLINE" , "SELECT" , "EXCLUDING" , "TABLES" , "OUTFILE" , "ERASE" , "GREATEST" ,
-            "UTC_DATE" , "VARCHARACTER" , "INVOKER" , "STOGROUP" , "DEPTH" , "CURRENT_USER" , "LN" , "ARRAY" , "ATOMIC" , " ALTER" ,
-            "COLUMN_NAME" , "COLUMN" , "MODE" , " COMMENT" , "DECIMAL" , "RESET" , "NEW_TABLE" , "ROUTINE_NAME" , "COMPRESS" ,
-            "OVERLAY" , "READ_WRITE" , "COALESCE" , "STATUS" , " EXCLUSIVE" , "UNBOUNDED" , "REGR_SLOPE" , "CORRESPONDING" ,
-            "TIMESTAMP" , "MESSAGE_OCTET_LENGTH" , "SQL_LOG_OFF" , "RETURNED_LENGTH" , "DISALLOW" , "PRIVILEGES" , "SQL" , "READ" ,
-            " IDENTIFIED" , "REAL" , "LESS" , "DIAGNOSTICS" , "QUERYNO" , "NO" , "FLOAT" , "COMMAND_FUNCTION_CODE" ,
-            "CURRENT_TIMESTAMP" , "TIES" , "ROUTINE" , "SUBLIST" , "FOLLOWING" , "ROLLBACK" , "MEMBER" , "DSSIZE" , "DUMP" ,
-            "EXTERNAL" , "GROUPING" , "OF" , "CHANGE" , "RECHECK" , " NUMBER" , "ON" , "DBINFO" , "OR" , "EQUALS" , "CREATEROLE" ,
-            "PRIMARY" , "SSL" , "MATCHED" , "DAYOFWEEK" , "DYNAMIC_FUNCTION_CODE" , "ENCODING" , "OPTIMIZATION" , "SECOND" ,
-            "UNKNOWN" , "HOUR_SECOND" , "REFERENCES" , "ROWS" , "JAVA" , "SPATIAL" , "INHERIT" , "CREATE" ,
-            "PARAMETER_SPECIFIC_SCHEMA" , "LEAST" , "OLD" , "TRIGGER" , "BETWEEN" , "OBID" , "CONVERT" , "POSITION" , "PROCESS" ,
-            "SQL_SELECT_LIMIT" , "NOTHING" , "DEALLOCATE" , "SUBPAGES" , "INNER" , "SQL_BIG_SELECTS" , "EACH" , "OPTIONALLY" ,
-            "SETUSER" , "BIGINT" , "NOAUDIT" , "SUM" , "OPTIONS" , "MIN" , "BITVAR" , "VARCHAR" , "SQLCA" , "KEY" , "PROGRAM" , "CALL" ,
-            "WAITFOR" , "RELOAD" , "DELAY_KEY_WRITE" , "USER_DEFINED_TYPE_SCHEMA" , "RLIKE" , "EDITPROC" , "GROUP" ,
-            "DATETIME_INTERVAL_PRECISION" , "ASSOCIATE" , "RESTORE" , "OFFSET" , "TEMPORARY" , "STANDARD" , "OPENDATASOURCE" ,
-            "STATISTICS" , "COBOL" , "SECOND_MICROSECOND" , "NULLABLE" , "COMMITTED" , "DELAYED" , "PERCENT" , " ONLINE" , "DB2SQL" ,
-            "TO" , "CONSTRUCTOR" , "DB2GNRL" , "UNION" , "FREEZE" , "SCOPE" , "CLASS" , "VIEW" , "LINES" , "ASSERTION" , "PACKAGE" ,
-            "TRIGGER_NAME" , "CONSTRAINTS" , "LABEL" , "CURRENT_TIME" , "DEFERRED" , "REPLACE" , "KEY_MEMBER" , "INTEGER" ,
-            "OVERRIDING" , "UNIQUE" , " MAXEXTENTS" , "TRAILING" , "COVAR_SAMP" , "FINAL" , " NOAUDIT" , "FULL" , "NAME" , "YEARS" ,
-            "ROW_COUNT" , "NOCREATEROLE" , "CEILING" , "LAST" , "MAXVALUE" , "QUOTE" , "TOAST" , "LOCALTIME" , "CONTAINS" , "GENERAL" ,
-            "DELIMITER" , "STDIN" , "REGEXP" , "REGR_COUNT" , "NOTIFY" , "NEXT" , "GLOBAL" , "LEAVE" , "SHOW" , "SHUTDOWN" , "VERBOSE" ,
-            "NORMALIZE" , "CURRENT_TIMEZONE" , "MOD" , "EXISTS" , "TIME" , "MYISAM" , "INHERITS" , "DATETIME" , "HOURS" ,
-            "NOMINVALUE" , "BOOL" , "ERRLVL" , "NESTING" , "FALSE" , "MINUTES" , "SECTION" , "NOCHECK" , "NOTNULL" ,
-            "PERCENTILE_CONT" , "SYMMETRIC" , "VALID" , "PLAN" , "SHARE" , "TRAN" , "STDDEV_SAMP" , "WHEN" ,
-            "TRANSACTIONS_COMMITTED" , "BREAK" , "LOCAL" , "CONSTRAINT_CATALOG" , "DICTIONARY" , "LOGIN" , "CLUSTER" , "GRANTS" ,
-            "DAY_MINUTE" , "LONGBLOB" , "CYCLE" , "CAST" , "INSTANCE" , "VARCHAR2" , "FUNCTION" , "LEADING" , "MODIFIES" , "NOWAIT" ,
-            "CASE" , "OUT" , "OPTIMIZE" , "REGR_SXX" , "REGR_SXY" , "OVERLAPS" , "GET" , "DENSE_RANK" , "PUBLIC" , "COUNT" , "TREAT" ,
-            "NAMES" , " NOCOMPRESS" , "IDENTITY_INSERT" , "NONCLUSTERED" , "LENGTH" , "UNSIGNED" , "CHAR" , "BEGIN" , "MAX_ROWS" ,
-            "WRITE" , "ORDER" , "ISOLATION" , "REPLICATION" , "SQL_CALC_FOUND_ROWS" , "REGR_SYY" , "LANCOMPILER" , " CLUSTER" ,
-            "CHARACTER_SET_NAME" , "SIGNAL" , "SUBMULTISET" , "COLLATE" , "MODIFY" , "INSTANTIABLE" , "UNCOMMITTED" , "RESIGNAL" ,
-            "MORE" , "PROC" , "REPEATABLE" , "COMPLETION" , "KEY_TYPE" , "KILL" , "TRANSFORMS" , "VOLATILE" , "INPUT" , "SUBSTRING" ,
-            "ZONE" , "VCAT" , "DEREF" , "AUXILIARY" , "REGR_AVGY" , "REGR_AVGX" , "TEMPLATE" , "INCLUDING" , "INSENSITIVE" , "BOTH" ,
-            "CHARACTER_SET_CATALOG" , "ENABLE" , "EXCEPT" , "HOSTS" , "SCHEMA_NAME" , "PREFIX" , "SCROLL" , "METHOD" , "DAY_SECOND" ,
-            "DESTRUCTOR" , "OIDS" , "INT" , "PASCAL" , "COLLID" , "PART" , "ALSO" , "CARDINALITY" , "ACCESS" , "OPENQUERY" , "CLOB" ,
-            "COMMIT" , "DISPATCH" , "STRUCTURE" , "DETERMINISTIC" , "SAVEPOINT" , "UNTIL" , "USER" , "TEMP" , "MEDIUMBLOB" , "MOVE" ,
-            "CROSS" , "SMALLINT" , "UESCAPE" , "USER_DEFINED_TYPE_CATALOG" , "RESULT" , "SQLID" , "PATH" , "RESULT_SET_LOCATOR" ,
-            "PURGE" , "TRIM" , "ROWGUIDCOL" , "RAW" , "RANK" , "VAR_POP" , "MUMPS" , "TRANSLATION" , "MINUS" , "EXPLAIN" ,
-            "PARAMETER_SPECIFIC_CATALOG" , " INITIAL" , "MESSAGE_LENGTH" , "HOUR_MINUTE" , "LISTEN" , "WIDTH_BUCKET" , "STORAGE" ,
-            "CURRENT_DEFAULT_TRANSFORM_GROUP" , "STDOUT" , "CUBE" , "IMMUTABLE" , "REGR_R2" , "SQL_LOG_UPDATE" , "XOR" ,
-            "FREETEXTTABLE" , "ALTER" , "MONTHNAME" , "FUSION" , "DESTROY" , "PARAMETER_SPECIFIC_NAME" , "TEXTSIZE" , "SPACE" ,
-            "UPPER" , "ABS" , "CREATEUSER" , "INTEGRITY" , "OCTET_LENGTH" , "TINYINT" , "INTERVAL" , "COLLATION_SCHEMA" ,
-            "CATALOG_NAME" , "UNLISTEN" , "MASTER_SSL_VERIFY_SERVER_CERT" , "POWER" , "CONNECTION" , "PAD" , "REF" , "LOCALE" ,
-            "OPERATION" , "SIMPLE" , "VARBINARY" , "VARIABLES" , "ADA" , "VIRTUAL" , " FILE" , "SYSTEM" , "ADD" , "SCOPE_CATALOG" ,
-            "SQLERROR" , "CHECKED" , "VARIANT" , "OLD_TABLE" , "INFIX" , "TRUSTED" , "INDEX" , "FOUND" , "HOLD" , "EXTRACT" ,
-            "OFFSETS" , "ATTRIBUTE" , "PERCENTILE_DISC" , "ITERATE" , "CURRENT_SERVER" , "CACHE" , " LOCK" , "CURRENT" , " NOWAIT" ,
-            "RETURNED_SQLSTATE" , "SYSPROC" , "CONNECTION_NAME" , "END" , "PRESERVE" , "LOAD" , "TERMINATED" , "BINARY" , "FORWARD" ,
-            "SOME" , "LAST_INSERT_ID" , "OUTER" , "INFILE" , "RENAME" , "EXCLUSIVE" , "FILTER" , "IDENTIFIED" , "NORMALIZED" ,
-            " COLUMN" , "INITIALLY" , "OVER" , "CURRENT_ROLE" , "GRANT" , "OTHERS" , "SONAME" , "CHAR_LENGTH" , "NOMAXVALUE" ,
-            "ROWID" , "DEFAULT" , "SQRT" , "JOIN" , "LOCK" , "TEXT" , "UNNEST" , "AVG_ROW_LENGTH" , "SESSION_USER" , "AGGREGATE" ,
-            "MULTISET" , "ELSE" , "TRANSACTION_ACTIVE" , "LANGUAGE" , "PERCENT_RANK" , "ENUM" , "NATIONAL" , "SETOF" ,
-            "RETURNED_CARDINALITY" , "SYNONYM" , "CURRENT_TRANSFORM_GROUP_FOR_TYPE" , "SPECIFICTYPE" , "TOP" , "FORTRAN" ,
-            "DEGREE" , "ASYMMETRIC" , "GRAPHIC" , "ALWAYS" , "MEDIUMTEXT" , "SYSTEM_USER" , "ROUTINE_CATALOG" , "CURSOR_NAME" ,
-            "RIGHT" , "STABLE" , "FILE" , "CREATEDB" , "DISTRIBUTED" , "FILLFACTOR" , "FETCH" , "NUMERIC" , "STARTING" , "REVOKE" ,
-            "SQLEXCEPTION" , "DYNAMIC" , "CHAIN" , "CALLED" , "INCREMENT" , "ELEMENT" , "MAXEXTENTS" , "ROUTINE_SCHEMA" ,
-            "IO_AFTER_GTIDS" , "TRIGGER_SCHEMA" , "ALL" , "NEW" , "THAN" , "ALIAS" , "HOST" , "VALUE" , "LOGS" , "SERIALIZABLE" ,
-            "X509" , "AUTO_INCREMENT" , "BACKUP" , "MINUTE_MICROSECOND" , "ALLOCATE" , "HOLDLOCK" , "MINUTE" , "SCALE" , "TINYTEXT" ,
-            "DESCRIBE" , "NOCREATEDB" , " INTERSECT" , " PCTFREE" , " PRIOR" , "NULL" , "TRUE" , "PCTFREE" , "EXISTING" ,
-            "PARAMETERS" , "OBJECT" , "TABLESPACE" , "UTC_TIME" , " LEVEL" , "MODULE" , "PASSWORD" , "EXCLUDE" , "SQL_WARNINGS" ,
-            "AND" , "SQLCODE" , "ROW" , "CURRENT_DATE" , "MESSAGE_TEXT" , "DISK" , "RANGE" , "VACUUM" , "MLSLABEL" , "STORED" , "HOUR" ,
-            "CONCAT" , "APPLICATION" , "INITIAL" , "ANY" , "PLI" , "HEAP" , " AUDIT" , "NATURAL" , "NOINHERIT" , "STORES" , "UNNAMED" ,
-            "KEYS" , "RESTART" , "READS" , "NUMPARTS" , "CSV" , "IMPLEMENTATION" , "ORDERING" , "TRANSLATE" , "REINDEX" , "JAR" ,
-            "EXP" , "MATCH" , "PRINT" , "NOCREATEUSER" , "CHECKSUM" , "ELSEIF" , "MONTH" , "ROWCOUNT" , "AFTER" , "CLOSE" , "RRN" ,
-            "MONTHS" , "OWNER" , "DENY" , "END-EXEC" , "INCLUDE" , "OCTETS" , "UPDATETEXT" , "PRIOR" , "SYSIBM" , " DATE" ,
-            "SCRATCHPAD" , "NODENAME" , "IDENTITY" , "ARE" , "FULLTEXT" , "SOURCE" , "CONDITION" , "THEN" , "PROCEDURAL" , "UNLOCK" ,
-            "HIERARCHY" , "ORDINALITY" , "INTO" , "MICROSECONDS" , "REPEAT" , "MICROSECOND" , "EXCEPTION" , "INDICATOR" , "FREE" ,
-            "RETURNED_OCTET_LENGTH" , "NOCOMPRESS" , "ASC" , "DELETE" , "COVAR_POP" , "VARIABLE" , " INDEX" , "PREPARED" ,
-            "GENERATED" , "SIMILAR" , "LONG" , "RESOURCE" , "INT1" , "INT2" , "PROCEDURE" , "INT3" , "STDDEV_POP" , "INT4" , "SECONDS" ,
-            "COLLECT" , "ANALYZE" , "RUN" , "UNDER" , "INT8" , "OPEN" , "DERIVED" , "NO_WRITE_TO_BINLOG" , "REFERENCING" , "STRING" ,
-            "PSID" , "BREADTH" , "STAY" , "LOCATOR" , "NOCACHE" , "LOOP" , "HIGH_PRIORITY" , "IMMEDIATE" , "DESC" , "FREETEXT" ,
-            "NUMBER" , "AUX" , "OUTPUT" , "LONGTEXT" , "DATABASES" , "BOOLEAN" , "AVG" , "NOT" , "PLACING" , "INTERSECTION" , "LOWER" ,
-            "SPECIFIC" , "MINUTE_SECOND" , "FLOAT8" , "HAVING" , "FIELDPROC" , "FLOAT4" , "SQLSTATE" , "RECONFIGURE" , "LOCKMAX" ,
-            "BACKWARD" , "BUFFERPOOL" , "VALIDPROC" , " MINUS" , "COMMAND_FUNCTION" , "DROP" , "RETURN" , "FOREIGN" ,
-            "PARAMETER_NAME" , "TSEQUAL" , "SQL_SMALL_RESULT" , "RULE" , "SERVER_NAME" , "DAYOFMONTH" , "IO_BEFORE_GTIDS" ,
-            "PARTIAL" , "MEDIUMINT" , "TRANSACTIONS_ROLLED_BACK" , "OPENXML" , " DROP" , "ESCAPE" , "SCOPE_NAME" , "ISAM" , "LINEAR" ,
-            "PARAMETER_ORDINAL_POSITION" , " OFFLINE" , "ROWNUM" , "DATETIME_INTERVAL_CODE" , "DEFINED" , "LOCALTIMESTAMP" ,
-            " CONNECT" , "ISOBID" , "TABLE" , "ANALYSE" , "DEFINER" , "SCOPE_SCHEMA" , "COLLATION_CATALOG" , "NONE" , "PROCESSLIST" ,
-            "TYPE" , "USER_DEFINED_TYPE_CODE" , "DESCRIPTOR" , "PIECESIZE" , "OPTION" , "WHENEVER" , "ENCLOSED" , "LEVEL" ,
-            "COUNT_BIG" , "ASENSITIVE" , "LOCKSIZE" , "TINYBLOB" , "PREPARE" , "CHECK" , "WITHOUT" , "WORK" , "HANDLER" , "CUME_DIST" ,
-            "WRITETEXT" , "INITIALIZE" , "DAY_HOUR" , "ILIKE" , "CONNECT" , "TABLESAMPLE" , "INSERT_ID" , "MIDDLEINT" , "RELATIVE" ,
-            "LARGE" , "ACCESSIBLE" , "VALUES" , "DOUBLE" , "ASUTIME" , "DEFAULTS" , "NOLOGIN" , "TIMEZONE_HOUR" , "COMPUTE" , "COPY" ,
-            "SELF" , "SESSION" , "NOCYCLE" , "DUMMY" , "WINDOW" , "EXECUTE" , "PRECEDING" , "PACK_KEYS" , "NOORDER" , "CHECKPOINT" ,
-            " LONG" , "DAY" , "AUTHORIZATION" , "CCSID" , "COLLECTION" , "BLOB" , "PRIQTY" , "RECURSIVE" , "ONLY" , "FROM" ,
-            "SQL_BIG_TABLES" , "LATERAL" , "TRANSFORM" , "HOUR_MICROSECOND" , "SENSITIVE" , "SUBCLASS_ORIGIN" , "CONVERSION" ,
-            "DAY_MICROSECOND" , "SEPARATOR" , "OPTIMIZER_COSTS" , "NOSUPERUSER" , "DATE" , "ROLLUP" , "TOP_LEVEL_COUNT" , "CORR" ,
-            "UNENCRYPTED" , "UTC_TIMESTAMP" , "LIKE" , "ZEROFILL" , "DATA" , "SUCCESSFUL" , "INSERT" , "YEAR_MONTH" , "OFFLINE" ,
-            "INOUT" , "VAR_SAMP" , "BROWSE" , "SCHEMAS" , "CONSTRAINT_NAME" , "PARAMETER_MODE" , "LIMIT" , "LINKTYPE" , "NULLS" ,
-            "DEC" , "CASCADED" , "ENCRYPTED" , "CONTAINSTABLE" , "DYNAMIC_FUNCTION" , "CONDITION_NUMBER" , "BEFORE" , "DB2GENERAL" ,
-            "DECLARE" , "SUPERUSER" , "WHILE"};
+        String[] words = {"AUDIT", "VOLUMES", "MINVALUE", "STATIC", "FLOOR", "CATALOG", "YEAR", "TRIGGER_CATALOG", "WLM",
+            "DISCONNECT", "PARTITION", "LEFT", " MODE", "SEARCH", "CURRENT_PATH", "DAYOFYEAR", "SIZE", "RESTRICT", "RELEASE",
+            "WHERE", "POSTFIX", "SQLWARNING", "UID", "AS", "AT", "SYSID", "DATABASE", "SPECIFIC_NAME", "TIMEZONE_MINUTE",
+            "LC_CTYPE", "ATTRIBUTES", "LOCATION", "A", "DOMAIN", "C", "SET", " INCREMENT", "MERGE", "G", "DAYS", "HEADER",
+            "K", "CONSTRAINT", "M", "PRECISION", "ROLE", "COLLATION_NAME", "BY", "STRAIGHT_JOIN", "CHARACTER", "INSTEAD",
+            "DUAL", "DSNHATTR", "BERNOULLI", " ADD", "CLUSTERED", "CONTINUE", "DIV", "OPERATOR", "SETS", "SECURITY",
+            "CURRENT_LC_CTYPE", "TRUNCATE", "CURSOR", "SQL_LOW_PRIORITY_UPDATES", "CONSTRAINT_SCHEMA", "STATEMENT",
+            "TABLE_NAME", "NODENUMBER", "DO", "RECOVERY", "LOW_PRIORITY", "ADMIN", "ESCAPED", "CAPTURE", "ALLOW", "VARYING",
+            "DISABLE", "STRICT", "SQL_BIG_RESULT", "ABORT", "FOR", "IMPLICIT", "USING", "EXEC", "DEFERRABLE", "RAISERROR",
+            "USER_DEFINED_TYPE_NAME", "VALIDATOR", "UNDO", "STATE", "WITHIN", "NCHAR", "ABSOLUTE", "PREORDER", "SCHEMA",
+            "SEQUENCE", "ASSIGNMENT", "COLUMNS", "END-EXEC1", "GO", "ROW_NUMBER", "BIT", "INTERSECT", "SYSDATE", "WITH",
+            "CLASS_ORIGIN", "ACTION", "ISNULL", "VALIDATE", " COMPRESS", "START", "CHARACTER_LENGTH", "BULK", "EVERY",
+            "NULLIF", "CEIL", "FLUSH", "MIN_ROWS", "GRANTED", "IF", "BIT_LENGTH", "PARAMETER", "CHARACTER_SET_SCHEMA",
+            "DEFINITION", "NCLOB", "FIELDS", "IN", "DISTINCT", "STYLE", "IS", "MASTER_BIND", "REGR_INTERCEPT", "TERMINATE",
+            "FORCE", "FENCED", " IMMEDIATE", "MAP", "READTEXT", "SYSFUN", "EXIT", "DBCC", "OPENROWSET", "COLLATION", "GOTO",
+            "RAID0", "MAX", "CASCADE", "DELIMITERS", "TRANSACTION", "SECQTY", "IGNORE", "COMMENT", "OFF", "CHARACTERS",
+            "IDENTITYCOL", "USAGE", "UPDATE", "SAVE", "REQUIRE", "DISTINCTROW", "USE", "RETURNS", "LOCATORS",
+            "CHARACTERISTICS", "FIRST", "LINENO", "ONLINE", "SELECT", "EXCLUDING", "TABLES", "OUTFILE", "ERASE", "GREATEST",
+            "UTC_DATE", "VARCHARACTER", "INVOKER", "STOGROUP", "DEPTH", "CURRENT_USER", "LN", "ARRAY", "ATOMIC", " ALTER",
+            "COLUMN_NAME", "COLUMN", "MODE", " COMMENT", "DECIMAL", "RESET", "NEW_TABLE", "ROUTINE_NAME", "COMPRESS",
+            "OVERLAY", "READ_WRITE", "COALESCE", "STATUS", " EXCLUSIVE", "UNBOUNDED", "REGR_SLOPE", "CORRESPONDING",
+            "TIMESTAMP", "MESSAGE_OCTET_LENGTH", "SQL_LOG_OFF", "RETURNED_LENGTH", "DISALLOW", "PRIVILEGES", "SQL", "READ",
+            " IDENTIFIED", "REAL", "LESS", "DIAGNOSTICS", "QUERYNO", "NO", "FLOAT", "COMMAND_FUNCTION_CODE",
+            "CURRENT_TIMESTAMP", "TIES", "ROUTINE", "SUBLIST", "FOLLOWING", "ROLLBACK", "MEMBER", "DSSIZE", "DUMP",
+            "EXTERNAL", "GROUPING", "OF", "CHANGE", "RECHECK", " NUMBER", "ON", "DBINFO", "OR", "EQUALS", "CREATEROLE",
+            "PRIMARY", "SSL", "MATCHED", "DAYOFWEEK", "DYNAMIC_FUNCTION_CODE", "ENCODING", "OPTIMIZATION", "SECOND",
+            "UNKNOWN", "HOUR_SECOND", "REFERENCES", "ROWS", "JAVA", "SPATIAL", "INHERIT", "CREATE",
+            "PARAMETER_SPECIFIC_SCHEMA", "LEAST", "OLD", "TRIGGER", "BETWEEN", "OBID", "CONVERT", "POSITION", "PROCESS",
+            "SQL_SELECT_LIMIT", "NOTHING", "DEALLOCATE", "SUBPAGES", "INNER", "SQL_BIG_SELECTS", "EACH", "OPTIONALLY",
+            "SETUSER", "BIGINT", "NOAUDIT", "SUM", "OPTIONS", "MIN", "BITVAR", "VARCHAR", "SQLCA", "KEY", "PROGRAM", "CALL",
+            "WAITFOR", "RELOAD", "DELAY_KEY_WRITE", "USER_DEFINED_TYPE_SCHEMA", "RLIKE", "EDITPROC", "GROUP",
+            "DATETIME_INTERVAL_PRECISION", "ASSOCIATE", "RESTORE", "OFFSET", "TEMPORARY", "STANDARD", "OPENDATASOURCE",
+            "STATISTICS", "COBOL", "SECOND_MICROSECOND", "NULLABLE", "COMMITTED", "DELAYED", "PERCENT", " ONLINE", "DB2SQL",
+            "TO", "CONSTRUCTOR", "DB2GNRL", "UNION", "FREEZE", "SCOPE", "CLASS", "VIEW", "LINES", "ASSERTION", "PACKAGE",
+            "TRIGGER_NAME", "CONSTRAINTS", "LABEL", "CURRENT_TIME", "DEFERRED", "REPLACE", "KEY_MEMBER", "INTEGER",
+            "OVERRIDING", "UNIQUE", " MAXEXTENTS", "TRAILING", "COVAR_SAMP", "FINAL", " NOAUDIT", "FULL", "NAME", "YEARS",
+            "ROW_COUNT", "NOCREATEROLE", "CEILING", "LAST", "MAXVALUE", "QUOTE", "TOAST", "LOCALTIME", "CONTAINS", "GENERAL",
+            "DELIMITER", "STDIN", "REGEXP", "REGR_COUNT", "NOTIFY", "NEXT", "GLOBAL", "LEAVE", "SHOW", "SHUTDOWN", "VERBOSE",
+            "NORMALIZE", "CURRENT_TIMEZONE", "MOD", "EXISTS", "TIME", "MYISAM", "INHERITS", "DATETIME", "HOURS",
+            "NOMINVALUE", "BOOL", "ERRLVL", "NESTING", "FALSE", "MINUTES", "SECTION", "NOCHECK", "NOTNULL",
+            "PERCENTILE_CONT", "SYMMETRIC", "VALID", "PLAN", "SHARE", "TRAN", "STDDEV_SAMP", "WHEN",
+            "TRANSACTIONS_COMMITTED", "BREAK", "LOCAL", "CONSTRAINT_CATALOG", "DICTIONARY", "LOGIN", "CLUSTER", "GRANTS",
+            "DAY_MINUTE", "LONGBLOB", "CYCLE", "CAST", "INSTANCE", "VARCHAR2", "FUNCTION", "LEADING", "MODIFIES", "NOWAIT",
+            "CASE", "OUT", "OPTIMIZE", "REGR_SXX", "REGR_SXY", "OVERLAPS", "GET", "DENSE_RANK", "PUBLIC", "COUNT", "TREAT",
+            "NAMES", " NOCOMPRESS", "IDENTITY_INSERT", "NONCLUSTERED", "LENGTH", "UNSIGNED", "CHAR", "BEGIN", "MAX_ROWS",
+            "WRITE", "ORDER", "ISOLATION", "REPLICATION", "SQL_CALC_FOUND_ROWS", "REGR_SYY", "LANCOMPILER", " CLUSTER",
+            "CHARACTER_SET_NAME", "SIGNAL", "SUBMULTISET", "COLLATE", "MODIFY", "INSTANTIABLE", "UNCOMMITTED", "RESIGNAL",
+            "MORE", "PROC", "REPEATABLE", "COMPLETION", "KEY_TYPE", "KILL", "TRANSFORMS", "VOLATILE", "INPUT", "SUBSTRING",
+            "ZONE", "VCAT", "DEREF", "AUXILIARY", "REGR_AVGY", "REGR_AVGX", "TEMPLATE", "INCLUDING", "INSENSITIVE", "BOTH",
+            "CHARACTER_SET_CATALOG", "ENABLE", "EXCEPT", "HOSTS", "SCHEMA_NAME", "PREFIX", "SCROLL", "METHOD", "DAY_SECOND",
+            "DESTRUCTOR", "OIDS", "INT", "PASCAL", "COLLID", "PART", "ALSO", "CARDINALITY", "ACCESS", "OPENQUERY", "CLOB",
+            "COMMIT", "DISPATCH", "STRUCTURE", "DETERMINISTIC", "SAVEPOINT", "UNTIL", "USER", "TEMP", "MEDIUMBLOB", "MOVE",
+            "CROSS", "SMALLINT", "UESCAPE", "USER_DEFINED_TYPE_CATALOG", "RESULT", "SQLID", "PATH", "RESULT_SET_LOCATOR",
+            "PURGE", "TRIM", "ROWGUIDCOL", "RAW", "RANK", "VAR_POP", "MUMPS", "TRANSLATION", "MINUS", "EXPLAIN",
+            "PARAMETER_SPECIFIC_CATALOG", " INITIAL", "MESSAGE_LENGTH", "HOUR_MINUTE", "LISTEN", "WIDTH_BUCKET", "STORAGE",
+            "CURRENT_DEFAULT_TRANSFORM_GROUP", "STDOUT", "CUBE", "IMMUTABLE", "REGR_R2", "SQL_LOG_UPDATE", "XOR",
+            "FREETEXTTABLE", "ALTER", "MONTHNAME", "FUSION", "DESTROY", "PARAMETER_SPECIFIC_NAME", "TEXTSIZE", "SPACE",
+            "UPPER", "ABS", "CREATEUSER", "INTEGRITY", "OCTET_LENGTH", "TINYINT", "INTERVAL", "COLLATION_SCHEMA",
+            "CATALOG_NAME", "UNLISTEN", "MASTER_SSL_VERIFY_SERVER_CERT", "POWER", "CONNECTION", "PAD", "REF", "LOCALE",
+            "OPERATION", "SIMPLE", "VARBINARY", "VARIABLES", "ADA", "VIRTUAL", " FILE", "SYSTEM", "ADD", "SCOPE_CATALOG",
+            "SQLERROR", "CHECKED", "VARIANT", "OLD_TABLE", "INFIX", "TRUSTED", "INDEX", "FOUND", "HOLD", "EXTRACT",
+            "OFFSETS", "ATTRIBUTE", "PERCENTILE_DISC", "ITERATE", "CURRENT_SERVER", "CACHE", " LOCK", "CURRENT", " NOWAIT",
+            "RETURNED_SQLSTATE", "SYSPROC", "CONNECTION_NAME", "END", "PRESERVE", "LOAD", "TERMINATED", "BINARY", "FORWARD",
+            "SOME", "LAST_INSERT_ID", "OUTER", "INFILE", "RENAME", "EXCLUSIVE", "FILTER", "IDENTIFIED", "NORMALIZED",
+            " COLUMN", "INITIALLY", "OVER", "CURRENT_ROLE", "GRANT", "OTHERS", "SONAME", "CHAR_LENGTH", "NOMAXVALUE",
+            "ROWID", "DEFAULT", "SQRT", "JOIN", "LOCK", "TEXT", "UNNEST", "AVG_ROW_LENGTH", "SESSION_USER", "AGGREGATE",
+            "MULTISET", "ELSE", "TRANSACTION_ACTIVE", "LANGUAGE", "PERCENT_RANK", "ENUM", "NATIONAL", "SETOF",
+            "RETURNED_CARDINALITY", "SYNONYM", "CURRENT_TRANSFORM_GROUP_FOR_TYPE", "SPECIFICTYPE", "TOP", "FORTRAN",
+            "DEGREE", "ASYMMETRIC", "GRAPHIC", "ALWAYS", "MEDIUMTEXT", "SYSTEM_USER", "ROUTINE_CATALOG", "CURSOR_NAME",
+            "RIGHT", "STABLE", "FILE", "CREATEDB", "DISTRIBUTED", "FILLFACTOR", "FETCH", "NUMERIC", "STARTING", "REVOKE",
+            "SQLEXCEPTION", "DYNAMIC", "CHAIN", "CALLED", "INCREMENT", "ELEMENT", "MAXEXTENTS", "ROUTINE_SCHEMA",
+            "IO_AFTER_GTIDS", "TRIGGER_SCHEMA", "ALL", "NEW", "THAN", "ALIAS", "HOST", "VALUE", "LOGS", "SERIALIZABLE",
+            "X509", "AUTO_INCREMENT", "BACKUP", "MINUTE_MICROSECOND", "ALLOCATE", "HOLDLOCK", "MINUTE", "SCALE", "TINYTEXT",
+            "DESCRIBE", "NOCREATEDB", " INTERSECT", " PCTFREE", " PRIOR", "NULL", "TRUE", "PCTFREE", "EXISTING",
+            "PARAMETERS", "OBJECT", "TABLESPACE", "UTC_TIME", " LEVEL", "MODULE", "PASSWORD", "EXCLUDE", "SQL_WARNINGS",
+            "AND", "SQLCODE", "ROW", "CURRENT_DATE", "MESSAGE_TEXT", "DISK", "RANGE", "VACUUM", "MLSLABEL", "STORED", "HOUR",
+            "CONCAT", "APPLICATION", "INITIAL", "ANY", "PLI", "HEAP", " AUDIT", "NATURAL", "NOINHERIT", "STORES", "UNNAMED",
+            "KEYS", "RESTART", "READS", "NUMPARTS", "CSV", "IMPLEMENTATION", "ORDERING", "TRANSLATE", "REINDEX", "JAR",
+            "EXP", "MATCH", "PRINT", "NOCREATEUSER", "CHECKSUM", "ELSEIF", "MONTH", "ROWCOUNT", "AFTER", "CLOSE", "RRN",
+            "MONTHS", "OWNER", "DENY", "END-EXEC", "INCLUDE", "OCTETS", "UPDATETEXT", "PRIOR", "SYSIBM", " DATE",
+            "SCRATCHPAD", "NODENAME", "IDENTITY", "ARE", "FULLTEXT", "SOURCE", "CONDITION", "THEN", "PROCEDURAL", "UNLOCK",
+            "HIERARCHY", "ORDINALITY", "INTO", "MICROSECONDS", "REPEAT", "MICROSECOND", "EXCEPTION", "INDICATOR", "FREE",
+            "RETURNED_OCTET_LENGTH", "NOCOMPRESS", "ASC", "DELETE", "COVAR_POP", "VARIABLE", " INDEX", "PREPARED",
+            "GENERATED", "SIMILAR", "LONG", "RESOURCE", "INT1", "INT2", "PROCEDURE", "INT3", "STDDEV_POP", "INT4", "SECONDS",
+            "COLLECT", "ANALYZE", "RUN", "UNDER", "INT8", "OPEN", "DERIVED", "NO_WRITE_TO_BINLOG", "REFERENCING", "STRING",
+            "PSID", "BREADTH", "STAY", "LOCATOR", "NOCACHE", "LOOP", "HIGH_PRIORITY", "IMMEDIATE", "DESC", "FREETEXT",
+            "NUMBER", "AUX", "OUTPUT", "LONGTEXT", "DATABASES", "BOOLEAN", "AVG", "NOT", "PLACING", "INTERSECTION", "LOWER",
+            "SPECIFIC", "MINUTE_SECOND", "FLOAT8", "HAVING", "FIELDPROC", "FLOAT4", "SQLSTATE", "RECONFIGURE", "LOCKMAX",
+            "BACKWARD", "BUFFERPOOL", "VALIDPROC", " MINUS", "COMMAND_FUNCTION", "DROP", "RETURN", "FOREIGN",
+            "PARAMETER_NAME", "TSEQUAL", "SQL_SMALL_RESULT", "RULE", "SERVER_NAME", "DAYOFMONTH", "IO_BEFORE_GTIDS",
+            "PARTIAL", "MEDIUMINT", "TRANSACTIONS_ROLLED_BACK", "OPENXML", " DROP", "ESCAPE", "SCOPE_NAME", "ISAM", "LINEAR",
+            "PARAMETER_ORDINAL_POSITION", " OFFLINE", "ROWNUM", "DATETIME_INTERVAL_CODE", "DEFINED", "LOCALTIMESTAMP",
+            " CONNECT", "ISOBID", "TABLE", "ANALYSE", "DEFINER", "SCOPE_SCHEMA", "COLLATION_CATALOG", "NONE", "PROCESSLIST",
+            "TYPE", "USER_DEFINED_TYPE_CODE", "DESCRIPTOR", "PIECESIZE", "OPTION", "WHENEVER", "ENCLOSED", "LEVEL",
+            "COUNT_BIG", "ASENSITIVE", "LOCKSIZE", "TINYBLOB", "PREPARE", "CHECK", "WITHOUT", "WORK", "HANDLER", "CUME_DIST",
+            "WRITETEXT", "INITIALIZE", "DAY_HOUR", "ILIKE", "CONNECT", "TABLESAMPLE", "INSERT_ID", "MIDDLEINT", "RELATIVE",
+            "LARGE", "ACCESSIBLE", "VALUES", "DOUBLE", "ASUTIME", "DEFAULTS", "NOLOGIN", "TIMEZONE_HOUR", "COMPUTE", "COPY",
+            "SELF", "SESSION", "NOCYCLE", "DUMMY", "WINDOW", "EXECUTE", "PRECEDING", "PACK_KEYS", "NOORDER", "CHECKPOINT",
+            " LONG", "DAY", "AUTHORIZATION", "CCSID", "COLLECTION", "BLOB", "PRIQTY", "RECURSIVE", "ONLY", "FROM",
+            "SQL_BIG_TABLES", "LATERAL", "TRANSFORM", "HOUR_MICROSECOND", "SENSITIVE", "SUBCLASS_ORIGIN", "CONVERSION",
+            "DAY_MICROSECOND", "SEPARATOR", "OPTIMIZER_COSTS", "NOSUPERUSER", "DATE", "ROLLUP", "TOP_LEVEL_COUNT", "CORR",
+            "UNENCRYPTED", "UTC_TIMESTAMP", "LIKE", "ZEROFILL", "DATA", "SUCCESSFUL", "INSERT", "YEAR_MONTH", "OFFLINE",
+            "INOUT", "VAR_SAMP", "BROWSE", "SCHEMAS", "CONSTRAINT_NAME", "PARAMETER_MODE", "LIMIT", "LINKTYPE", "NULLS",
+            "DEC", "CASCADED", "ENCRYPTED", "CONTAINSTABLE", "DYNAMIC_FUNCTION", "CONDITION_NUMBER", "BEFORE", "DB2GENERAL",
+            "DECLARE", "SUPERUSER", "WHILE"};
 
         RESERVED_WORDS = new HashSet<>(words.length);
         Collections.addAll(RESERVED_WORDS, words);

+ 87 - 87
mybatis-plus-core/src/main/java/com/baomidou/mybatisplus/core/injector/AutoSqlInjector.java

@@ -143,7 +143,7 @@ public class AutoSqlInjector implements ISqlInjector {
             this.injectSelectByIdSql(true, mapperClass, modelClass, table);
         } else {
             // 表不包含主键时 给予警告
-            logger.warn(String.format("%s ,Not found @TableId annotation, Cannot use Mybatis-Plus 'xxById' Method." ,
+            logger.warn(String.format("%s ,Not found @TableId annotation, Cannot use Mybatis-Plus 'xxById' Method.",
                 modelClass.toString()));
         }
         /**
@@ -229,8 +229,8 @@ public class AutoSqlInjector implements ISqlInjector {
         StringBuilder placeholderBuilder = new StringBuilder();
         SqlMethod sqlMethod = selective ? SqlMethod.INSERT_ONE : SqlMethod.INSERT_ONE_ALL_COLUMN;
 
-        fieldBuilder.append("\n<trim prefix=\"(\" suffix=\")\" suffixOverrides=\",\">\n" );
-        placeholderBuilder.append("\n<trim prefix=\"(\" suffix=\")\" suffixOverrides=\",\">\n" );
+        fieldBuilder.append("\n<trim prefix=\"(\" suffix=\")\" suffixOverrides=\",\">\n");
+        placeholderBuilder.append("\n<trim prefix=\"(\" suffix=\")\" suffixOverrides=\",\">\n");
         String keyProperty = null;
         String keyColumn = null;
 
@@ -246,13 +246,13 @@ public class AutoSqlInjector implements ISqlInjector {
                     keyGenerator = TableInfoHelper.genKeyGenerator(table, builderAssistant, sqlMethod.getMethod(), languageDriver);
                     keyProperty = table.getKeyProperty();
                     keyColumn = table.getKeyColumn();
-                    fieldBuilder.append(table.getKeyColumn()).append("," );
-                    placeholderBuilder.append("#{" ).append(table.getKeyProperty()).append("}," );
+                    fieldBuilder.append(table.getKeyColumn()).append(",");
+                    placeholderBuilder.append("#{").append(table.getKeyProperty()).append("},");
                 } else {
                     /** 用户输入自定义ID */
-                    fieldBuilder.append(table.getKeyColumn()).append("," );
+                    fieldBuilder.append(table.getKeyColumn()).append(",");
                     // 正常自定义主键策略
-                    placeholderBuilder.append("#{" ).append(table.getKeyProperty()).append("}," );
+                    placeholderBuilder.append("#{").append(table.getKeyProperty()).append("},");
                 }
             }
         }
@@ -266,18 +266,18 @@ public class AutoSqlInjector implements ISqlInjector {
                 || FieldFill.INSERT_UPDATE == fieldInfo.getFieldFill());
             if (selective && ifTag) {
                 fieldBuilder.append(convertIfTagIgnored(fieldInfo, false));
-                fieldBuilder.append(fieldInfo.getColumn()).append("," );
+                fieldBuilder.append(fieldInfo.getColumn()).append(",");
                 fieldBuilder.append(convertIfTagIgnored(fieldInfo, true));
                 placeholderBuilder.append(convertIfTagIgnored(fieldInfo, false));
-                placeholderBuilder.append("#{" ).append(fieldInfo.getEl()).append("}," );
+                placeholderBuilder.append("#{").append(fieldInfo.getEl()).append("},");
                 placeholderBuilder.append(convertIfTagIgnored(fieldInfo, true));
             } else {
-                fieldBuilder.append(fieldInfo.getColumn()).append("," );
-                placeholderBuilder.append("#{" ).append(fieldInfo.getEl()).append("}," );
+                fieldBuilder.append(fieldInfo.getColumn()).append(",");
+                placeholderBuilder.append("#{").append(fieldInfo.getEl()).append("},");
             }
         }
-        fieldBuilder.append("\n</trim>" );
-        placeholderBuilder.append("\n</trim>" );
+        fieldBuilder.append("\n</trim>");
+        placeholderBuilder.append("\n</trim>");
         String sql = String.format(sqlMethod.getSql(), table.getTableName(), fieldBuilder.toString(),
             placeholderBuilder.toString());
         SqlSource sqlSource = languageDriver.createSqlSource(configuration, sql, modelClass);
@@ -333,9 +333,9 @@ public class AutoSqlInjector implements ISqlInjector {
         if (batch) {
             sqlMethod = SqlMethod.DELETE_BATCH_BY_IDS;
             StringBuilder ids = new StringBuilder();
-            ids.append("\n<foreach item=\"item\" index=\"index\" collection=\"coll\" separator=\",\">" );
-            ids.append("#{item}" );
-            ids.append("\n</foreach>" );
+            ids.append("\n<foreach item=\"item\" index=\"index\" collection=\"coll\" separator=\",\">");
+            ids.append("#{item}");
+            ids.append("\n</foreach>");
             idStr = ids.toString();
         }
         String sql = String.format(sqlMethod.getSql(), table.getTableName(), table.getKeyColumn(), idStr);
@@ -354,7 +354,7 @@ public class AutoSqlInjector implements ISqlInjector {
      */
     protected void injectUpdateByIdSql(boolean selective, Class<?> mapperClass, Class<?> modelClass, TableInfo table) {
         SqlMethod sqlMethod = selective ? SqlMethod.UPDATE_BY_ID : SqlMethod.UPDATE_ALL_COLUMN_BY_ID;
-        String sql = String.format(sqlMethod.getSql(), table.getTableName(), sqlSet(selective, table, "et." ), table.getKeyColumn(),
+        String sql = String.format(sqlMethod.getSql(), table.getTableName(), sqlSet(selective, table, "et."), table.getKeyColumn(),
             "et." + table.getKeyProperty(),
             "<if test=\"et instanceof java.util.Map\">"
                 + "<if test=\"et.MP_OPTLOCK_VERSION_ORIGINAL!=null\">"
@@ -377,7 +377,7 @@ public class AutoSqlInjector implements ISqlInjector {
      */
     protected void injectUpdateSql(Class<?> mapperClass, Class<?> modelClass, TableInfo table) {
         SqlMethod sqlMethod = SqlMethod.UPDATE;
-        String sql = String.format(sqlMethod.getSql(), table.getTableName(), sqlSet(true, table, "et." ), sqlWhereEntityWrapper(table));
+        String sql = String.format(sqlMethod.getSql(), table.getTableName(), sqlSet(true, table, "et."), sqlWhereEntityWrapper(table));
         SqlSource sqlSource = languageDriver.createSqlSource(configuration, sql, modelClass);
         this.addUpdateMappedStatement(mapperClass, modelClass, sqlMethod.getMethod(), sqlSource);
     }
@@ -398,9 +398,9 @@ public class AutoSqlInjector implements ISqlInjector {
         if (batch) {
             sqlMethod = SqlMethod.SELECT_BATCH_BY_IDS;
             StringBuilder ids = new StringBuilder();
-            ids.append("\n<foreach item=\"item\" index=\"index\" collection=\"coll\" separator=\",\">" );
-            ids.append("#{item}" );
-            ids.append("\n</foreach>" );
+            ids.append("\n<foreach item=\"item\" index=\"index\" collection=\"coll\" separator=\",\">");
+            ids.append("#{item}");
+            ids.append("\n</foreach>");
             sqlSource = languageDriver.createSqlSource(configuration, String.format(sqlMethod.getSql(),
                 sqlSelectColumns(table, false), table.getTableName(), table.getKeyColumn(), ids.toString()), modelClass);
         } else {
@@ -528,26 +528,26 @@ public class AutoSqlInjector implements ISqlInjector {
      */
     protected String sqlWhereEntityWrapper(TableInfo table) {
         StringBuilder where = new StringBuilder(128);
-        where.append("\n<where>" );
-        where.append("\n<if test=\"ew!=null\">" );
-        where.append("\n<if test=\"ew.entity!=null\">" );
+        where.append("\n<where>");
+        where.append("\n<if test=\"ew!=null\">");
+        where.append("\n<if test=\"ew.entity!=null\">");
         if (StringUtils.isNotEmpty(table.getKeyProperty())) {
-            where.append("\n<if test=\"ew.entity." ).append(table.getKeyProperty()).append("!=null\">\n" );
-            where.append(table.getKeyColumn()).append("=#{ew.entity." ).append(table.getKeyProperty()).append("}" );
-            where.append("\n</if>" );
+            where.append("\n<if test=\"ew.entity.").append(table.getKeyProperty()).append("!=null\">\n");
+            where.append(table.getKeyColumn()).append("=#{ew.entity.").append(table.getKeyProperty()).append("}");
+            where.append("\n</if>");
         }
         List<TableFieldInfo> fieldList = table.getFieldList();
         for (TableFieldInfo fieldInfo : fieldList) {
-            where.append(convertIfTag(fieldInfo, "ew.entity." , false));
-            where.append(" AND " ).append(this.sqlCondition(fieldInfo.getCondition(),
+            where.append(convertIfTag(fieldInfo, "ew.entity.", false));
+            where.append(" AND ").append(this.sqlCondition(fieldInfo.getCondition(),
                 fieldInfo.getColumn(), "ew.entity." + fieldInfo.getEl()));
             where.append(convertIfTag(fieldInfo, true));
         }
-        where.append("\n</if>" );
-        where.append("\n<if test=\"ew!=null and ew.sqlSegment!=null and ew.notEmptyOfWhere\">\n${ew.sqlSegment}\n</if>" );
-        where.append("\n</if>" );
-        where.append("\n</where>" );
-        where.append("\n<if test=\"ew!=null and ew.sqlSegment!=null and ew.emptyOfWhere\">\n${ew.sqlSegment}\n</if>" );
+        where.append("\n</if>");
+        where.append("\n<if test=\"ew!=null and ew.sqlSegment!=null and ew.notEmptyOfWhere\">\n${ew.sqlSegment}\n</if>");
+        where.append("\n</if>");
+        where.append("\n</where>");
+        where.append("\n<if test=\"ew!=null and ew.sqlSegment!=null and ew.emptyOfWhere\">\n${ew.sqlSegment}\n</if>");
         return where.toString();
     }
 
@@ -563,7 +563,7 @@ public class AutoSqlInjector implements ISqlInjector {
      */
     protected String sqlSet(boolean selective, TableInfo table, String prefix) {
         StringBuilder set = new StringBuilder();
-        set.append("<trim prefix=\"SET\" suffixOverrides=\",\">" );
+        set.append("<trim prefix=\"SET\" suffixOverrides=\",\">");
 
         // 是否 IF 标签判断
         boolean ifTag;
@@ -574,27 +574,27 @@ public class AutoSqlInjector implements ISqlInjector {
                 || FieldFill.INSERT_UPDATE == fieldInfo.getFieldFill());
             if (selective && ifTag) {
                 if (StringUtils.isNotEmpty(fieldInfo.getUpdate())) {
-                    set.append(fieldInfo.getColumn()).append("=" );
-                    set.append(String.format(fieldInfo.getUpdate(), fieldInfo.getColumn())).append("," );
+                    set.append(fieldInfo.getColumn()).append("=");
+                    set.append(String.format(fieldInfo.getUpdate(), fieldInfo.getColumn())).append(",");
                 } else {
                     set.append(convertIfTag(true, fieldInfo, prefix, false));
-                    set.append(fieldInfo.getColumn()).append("=#{" );
+                    set.append(fieldInfo.getColumn()).append("=#{");
                     if (null != prefix) {
                         set.append(prefix);
                     }
-                    set.append(fieldInfo.getEl()).append("}," );
+                    set.append(fieldInfo.getEl()).append("},");
                     set.append(convertIfTag(true, fieldInfo, null, true));
                 }
             } else if (FieldFill.INSERT != fieldInfo.getFieldFill()) {
                 // 排除填充注解字段
-                set.append(fieldInfo.getColumn()).append("=#{" );
+                set.append(fieldInfo.getColumn()).append("=#{");
                 if (null != prefix) {
                     set.append(prefix);
                 }
-                set.append(fieldInfo.getEl()).append("}," );
+                set.append(fieldInfo.getEl()).append("},");
             }
         }
-        set.append("\n</trim>" );
+        set.append("\n</trim>");
         return set.toString();
     }
 
@@ -630,18 +630,18 @@ public class AutoSqlInjector implements ISqlInjector {
              * 存在 resultMap 映射返回
              */
             if (entityWrapper) {
-                columns.append("<choose><when test=\"ew != null and ew.sqlSelect != null\">${ew.sqlSelect}</when><otherwise>" );
+                columns.append("<choose><when test=\"ew != null and ew.sqlSelect != null\">${ew.sqlSelect}</when><otherwise>");
             }
-            columns.append("*" );
+            columns.append("*");
             if (entityWrapper) {
-                columns.append("</otherwise></choose>" );
+                columns.append("</otherwise></choose>");
             }
         } else {
             /*
              * 普通查询
              */
             if (entityWrapper) {
-                columns.append("<choose><when test=\"ew != null and ew.sqlSelect != null\">${ew.sqlSelect}</when><otherwise>" );
+                columns.append("<choose><when test=\"ew != null and ew.sqlSelect != null\">${ew.sqlSelect}</when><otherwise>");
             }
             List<TableFieldInfo> fieldList = table.getFieldList();
             int size = 0;
@@ -652,13 +652,13 @@ public class AutoSqlInjector implements ISqlInjector {
             // 主键处理
             if (StringUtils.isNotEmpty(table.getKeyProperty())) {
                 if (table.isKeyRelated()) {
-                    columns.append(table.getKeyColumn()).append(" AS " ).append(sqlWordConvert(table.getKeyProperty()));
+                    columns.append(table.getKeyColumn()).append(" AS ").append(sqlWordConvert(table.getKeyProperty()));
                 } else {
                     columns.append(sqlWordConvert(table.getKeyProperty()));
                 }
                 if (size >= 1) {
                     // 判断其余字段是否存在
-                    columns.append("," );
+                    columns.append(",");
                 }
             }
 
@@ -675,16 +675,16 @@ public class AutoSqlInjector implements ISqlInjector {
                     } else {
                         // 字段属性不一致
                         columns.append(fieldInfo.getColumn());
-                        columns.append(" AS " ).append(wordConvert);
+                        columns.append(" AS ").append(wordConvert);
                     }
                     if (i + 1 < size) {
-                        columns.append("," );
+                        columns.append(",");
                     }
                     i++;
                 }
             }
             if (entityWrapper) {
-                columns.append("</otherwise></choose>" );
+                columns.append("</otherwise></choose>");
             }
         }
 
@@ -707,11 +707,11 @@ public class AutoSqlInjector implements ISqlInjector {
         /*
          * 普通查询
          */
-        columns.append("<choose><when test=\"ew != null and ew.sqlSelect != null\">${ew.sqlSelect}</when><otherwise>" );
+        columns.append("<choose><when test=\"ew != null and ew.sqlSelect != null\">${ew.sqlSelect}</when><otherwise>");
         // 主键处理
         if (StringUtils.isNotEmpty(table.getKeyProperty())) {
             if (table.isKeyRelated()) {
-                columns.append(table.getKeyColumn()).append(" AS " ).append(sqlWordConvert(table.getKeyProperty()));
+                columns.append(table.getKeyColumn()).append(" AS ").append(sqlWordConvert(table.getKeyProperty()));
             } else {
                 columns.append(sqlWordConvert(table.getKeyProperty()));
             }
@@ -727,11 +727,11 @@ public class AutoSqlInjector implements ISqlInjector {
                 } else {
                     // 字段属性不一致
                     columns.append(fieldInfo.getColumn());
-                    columns.append(" AS " ).append(wordConvert);
+                    columns.append(" AS ").append(wordConvert);
                 }
             }
         }
-        columns.append("</otherwise></choose>" );
+        columns.append("</otherwise></choose>");
         return columns.toString();
     }
 
@@ -742,20 +742,20 @@ public class AutoSqlInjector implements ISqlInjector {
      */
     protected String sqlWhere(TableInfo table) {
         StringBuilder where = new StringBuilder();
-        where.append("\n<where>" );
+        where.append("\n<where>");
         if (StringUtils.isNotEmpty(table.getKeyProperty())) {
-            where.append("\n<if test=\"ew." ).append(table.getKeyProperty()).append("!=null\">\n" );
-            where.append(table.getKeyColumn()).append("=#{ew." ).append(table.getKeyProperty()).append("}" );
-            where.append("\n</if>" );
+            where.append("\n<if test=\"ew.").append(table.getKeyProperty()).append("!=null\">\n");
+            where.append(table.getKeyColumn()).append("=#{ew.").append(table.getKeyProperty()).append("}");
+            where.append("\n</if>");
         }
         List<TableFieldInfo> fieldList = table.getFieldList();
         for (TableFieldInfo fieldInfo : fieldList) {
-            where.append(convertIfTag(fieldInfo, "ew." , false));
-            where.append(" AND " ).append(this.sqlCondition(fieldInfo.getCondition(),
+            where.append(convertIfTag(fieldInfo, "ew.", false));
+            where.append(" AND ").append(this.sqlCondition(fieldInfo.getCondition(),
                 fieldInfo.getColumn(), "ew." + fieldInfo.getEl()));
             where.append(convertIfTag(fieldInfo, true));
         }
-        where.append("\n</where>" );
+        where.append("\n</where>");
         return where.toString();
     }
 
@@ -766,17 +766,17 @@ public class AutoSqlInjector implements ISqlInjector {
      */
     protected String sqlWhereByMap(TableInfo table) {
         StringBuilder where = new StringBuilder();
-        where.append("\n<if test=\"cm!=null and !cm.isEmpty\">" );
-        where.append("\n<where>" );
-        where.append("\n<foreach collection=\"cm.keys\" item=\"k\" separator=\"AND\">" );
-        where.append("\n<if test=\"cm[k] != null\">" );
+        where.append("\n<if test=\"cm!=null and !cm.isEmpty\">");
+        where.append("\n<where>");
+        where.append("\n<foreach collection=\"cm.keys\" item=\"k\" separator=\"AND\">");
+        where.append("\n<if test=\"cm[k] != null\">");
         //TODO: 3.0
-        where.append("\n" ).append(this.getGlobalConfig().getReservedWordsHandler().convert(getGlobalConfig(), "${k}" )).append(" = #{cm[${k}]}" );
+        where.append("\n").append(this.getGlobalConfig().getReservedWordsHandler().convert(getGlobalConfig(), "${k}")).append(" = #{cm[${k}]}");
 //        where.append("\n").append(SqlReservedWords.convert(getGlobalConfig(), "${k}")).append(" = #{cm[${k}]}");
-        where.append("\n</if>" );
-        where.append("\n</foreach>" );
-        where.append("\n</where>" );
-        where.append("\n</if>" );
+        where.append("\n</if>");
+        where.append("\n</foreach>");
+        where.append("\n</where>");
+        where.append("\n</if>");
         return where.toString();
     }
 
@@ -796,7 +796,7 @@ public class AutoSqlInjector implements ISqlInjector {
         FieldStrategy fieldStrategy = fieldInfo.getFieldStrategy();
         if (fieldStrategy == FieldStrategy.IGNORED) {
             if (ignored) {
-                return "" ;
+                return "";
             }
             // 查询策略,使用全局策略
             fieldStrategy = this.getGlobalConfig().getFieldStrategy();
@@ -804,7 +804,7 @@ public class AutoSqlInjector implements ISqlInjector {
 
         // 关闭标签
         if (close) {
-            return "</if>" ;
+            return "</if>";
         }
 
         /** 前缀处理 */
@@ -817,13 +817,13 @@ public class AutoSqlInjector implements ISqlInjector {
         // 验证逻辑
         if (fieldStrategy == FieldStrategy.NOT_EMPTY) {
             if (StringUtils.isCharSequence(propertyType)) {
-                return String.format("\n\t<if test=\"%s!=null and %s!=''\">" , property, property);
+                return String.format("\n\t<if test=\"%s!=null and %s!=''\">", property, property);
             } else {
-                return String.format("\n\t<if test=\"%s!=null \">" , property);
+                return String.format("\n\t<if test=\"%s!=null \">", property);
             }
         } else {
             // FieldStrategy.NOT_NULL
-            return String.format("\n\t<if test=\"%s!=null\">" , property);
+            return String.format("\n\t<if test=\"%s!=null\">", property);
         }
     }
 
@@ -889,7 +889,7 @@ public class AutoSqlInjector implements ISqlInjector {
         String statementName = mapperClass.getName() + "." + id;
         if (hasMappedStatement(statementName)) {
             System.err.println("{" + statementName
-                + "} Has been loaded by XML or SqlProvider, ignoring the injection of the SQL." );
+                + "} Has been loaded by XML or SqlProvider, ignoring the injection of the SQL.");
             return null;
         }
         /** 缓存逻辑处理 */
@@ -933,12 +933,12 @@ public class AutoSqlInjector implements ISqlInjector {
      * @param sqlSource       执行的sqlSource
      * @param resultType      返回的结果类型
      */
-    @SuppressWarnings("serial" )
+    @SuppressWarnings("serial")
     private void createSelectMappedStatement(String mappedStatement, SqlSource sqlSource, final Class<?> resultType) {
         MappedStatement ms = new MappedStatement.Builder(configuration, mappedStatement, sqlSource, SqlCommandType.SELECT)
             .resultMaps(new ArrayList<ResultMap>() {
                 {
-                    add(new ResultMap.Builder(configuration, "defaultResultMap" , resultType, new ArrayList<ResultMapping>(0))
+                    add(new ResultMap.Builder(configuration, "defaultResultMap", resultType, new ArrayList<ResultMapping>(0))
                         .build());
                 }
             }).build();
@@ -953,12 +953,12 @@ public class AutoSqlInjector implements ISqlInjector {
      * @param sqlSource       执行的sqlSource
      * @param sqlCommandType  执行的sqlCommandType
      */
-    @SuppressWarnings("serial" )
+    @SuppressWarnings("serial")
     private void createUpdateMappedStatement(String mappedStatement, SqlSource sqlSource, SqlCommandType sqlCommandType) {
         MappedStatement ms = new MappedStatement.Builder(configuration, mappedStatement, sqlSource, sqlCommandType).resultMaps(
             new ArrayList<ResultMap>() {
                 {
-                    add(new ResultMap.Builder(configuration, "defaultResultMap" , int.class, new ArrayList<ResultMapping>(0))
+                    add(new ResultMap.Builder(configuration, "defaultResultMap", int.class, new ArrayList<ResultMapping>(0))
                         .build());
                 }
             }).build();
@@ -971,7 +971,7 @@ public class AutoSqlInjector implements ISqlInjector {
      */
     private void initSelectList() {
         if (hasMappedStatement(ISqlRunner.SELECT_LIST)) {
-            logger.warn("MappedStatement 'SqlRunner.SelectList' Already Exists" );
+            logger.warn("MappedStatement 'SqlRunner.SelectList' Already Exists");
             return;
         }
         SqlSource sqlSource = languageDriver.createSqlSource(configuration, ISqlRunner.SQLScript, Map.class);
@@ -983,7 +983,7 @@ public class AutoSqlInjector implements ISqlInjector {
      */
     private void initSelectObjs() {
         if (hasMappedStatement(ISqlRunner.SELECT_OBJS)) {
-            logger.warn("MappedStatement 'SqlRunner.SelectObjs' Already Exists" );
+            logger.warn("MappedStatement 'SqlRunner.SelectObjs' Already Exists");
             return;
         }
         SqlSource sqlSource = languageDriver.createSqlSource(configuration, ISqlRunner.SQLScript, Object.class);
@@ -995,7 +995,7 @@ public class AutoSqlInjector implements ISqlInjector {
      */
     private void initCount() {
         if (hasMappedStatement(ISqlRunner.COUNT)) {
-            logger.warn("MappedStatement 'SqlRunner.Count' Already Exists" );
+            logger.warn("MappedStatement 'SqlRunner.Count' Already Exists");
             return;
         }
         SqlSource sqlSource = languageDriver.createSqlSource(configuration, ISqlRunner.SQLScript, Map.class);
@@ -1007,7 +1007,7 @@ public class AutoSqlInjector implements ISqlInjector {
      */
     private void initInsert() {
         if (hasMappedStatement(ISqlRunner.INSERT)) {
-            logger.warn("MappedStatement 'SqlRunner.Insert' Already Exists" );
+            logger.warn("MappedStatement 'SqlRunner.Insert' Already Exists");
             return;
         }
         SqlSource sqlSource = languageDriver.createSqlSource(configuration, ISqlRunner.SQLScript, Map.class);
@@ -1019,7 +1019,7 @@ public class AutoSqlInjector implements ISqlInjector {
      */
     private void initUpdate() {
         if (hasMappedStatement(ISqlRunner.UPDATE)) {
-            logger.warn("MappedStatement 'SqlRunner.Update' Already Exists" );
+            logger.warn("MappedStatement 'SqlRunner.Update' Already Exists");
             return;
         }
         SqlSource sqlSource = languageDriver.createSqlSource(configuration, ISqlRunner.SQLScript, Map.class);
@@ -1031,7 +1031,7 @@ public class AutoSqlInjector implements ISqlInjector {
      */
     private void initDelete() {
         if (hasMappedStatement(ISqlRunner.DELETE)) {
-            logger.warn("MappedStatement 'SqlRunner.Delete' Already Exists" );
+            logger.warn("MappedStatement 'SqlRunner.Delete' Already Exists");
             return;
         }
         SqlSource sqlSource = languageDriver.createSqlSource(configuration, ISqlRunner.SQLScript, Map.class);

+ 16 - 16
mybatis-plus-core/src/main/java/com/baomidou/mybatisplus/core/mapper/BaseMapper.java

@@ -76,7 +76,7 @@ public interface BaseMapper<T> {
      * @param columnMap 表字段 map 对象
      * @return int
      */
-    Integer deleteByMap(@Param("cm" ) Map<String, Object> columnMap);
+    Integer deleteByMap(@Param("cm") Map<String, Object> columnMap);
 
     /**
      * <p>
@@ -86,7 +86,7 @@ public interface BaseMapper<T> {
      * @param wrapper 实体对象封装操作类(可以为 null)
      * @return int
      */
-    Integer delete(@Param("ew" ) Wrapper<T> wrapper);
+    Integer delete(@Param("ew") Wrapper<T> wrapper);
 
     /**
      * <p>
@@ -96,7 +96,7 @@ public interface BaseMapper<T> {
      * @param idList 主键ID列表
      * @return int
      */
-    Integer deleteBatchIds(@Param("coll" ) Collection<? extends Serializable> idList);
+    Integer deleteBatchIds(@Param("coll") Collection<? extends Serializable> idList);
 
     /**
      * <p>
@@ -106,7 +106,7 @@ public interface BaseMapper<T> {
      * @param entity 实体对象
      * @return int
      */
-    Integer updateById(@Param("et" ) T entity);
+    Integer updateById(@Param("et") T entity);
 
     /**
      * <p>
@@ -116,7 +116,7 @@ public interface BaseMapper<T> {
      * @param entity 实体对象
      * @return int
      */
-    Integer updateAllColumnById(@Param("et" ) T entity);
+    Integer updateAllColumnById(@Param("et") T entity);
 
     /**
      * <p>
@@ -127,7 +127,7 @@ public interface BaseMapper<T> {
      * @param wrapper 实体对象封装操作类(可以为 null)
      * @return
      */
-    Integer update(@Param("et" ) T entity, @Param("ew" ) Wrapper<T> wrapper);
+    Integer update(@Param("et") T entity, @Param("ew") Wrapper<T> wrapper);
 
     /**
      * <p>
@@ -147,7 +147,7 @@ public interface BaseMapper<T> {
      * @param idList 主键ID列表
      * @return List<T>
      */
-    List<T> selectBatchIds(@Param("coll" ) Collection<? extends Serializable> idList);
+    List<T> selectBatchIds(@Param("coll") Collection<? extends Serializable> idList);
 
     /**
      * <p>
@@ -157,7 +157,7 @@ public interface BaseMapper<T> {
      * @param columnMap 表字段 map 对象
      * @return List<T>
      */
-    List<T> selectByMap(@Param("cm" ) Map<String, Object> columnMap);
+    List<T> selectByMap(@Param("cm") Map<String, Object> columnMap);
 
     /**
      * <p>
@@ -167,7 +167,7 @@ public interface BaseMapper<T> {
      * @param entity 实体对象
      * @return T
      */
-    T selectOne(@Param("ew" ) T entity);
+    T selectOne(@Param("ew") T entity);
 
     /**
      * <p>
@@ -177,7 +177,7 @@ public interface BaseMapper<T> {
      * @param wrapper 实体对象
      * @return int
      */
-    Integer selectCount(@Param("ew" ) Wrapper<T> wrapper);
+    Integer selectCount(@Param("ew") Wrapper<T> wrapper);
 
     /**
      * <p>
@@ -187,7 +187,7 @@ public interface BaseMapper<T> {
      * @param wrapper 实体对象封装操作类(可以为 null)
      * @return List<T>
      */
-    List<T> selectList(@Param("ew" ) Wrapper<T> wrapper);
+    List<T> selectList(@Param("ew") Wrapper<T> wrapper);
 
     /**
      * <p>
@@ -197,7 +197,7 @@ public interface BaseMapper<T> {
      * @param wrapper 实体对象封装操作类(可以为 null)
      * @return List<T>
      */
-    List<Map<String, Object>> selectMaps(@Param("ew" ) Wrapper<T> wrapper);
+    List<Map<String, Object>> selectMaps(@Param("ew") Wrapper<T> wrapper);
 
     /**
      * <p>
@@ -208,7 +208,7 @@ public interface BaseMapper<T> {
      * @param wrapper 实体对象封装操作类(可以为 null)
      * @return List<Object>
      */
-    List<Object> selectObjs(@Param("ew" ) Wrapper<T> wrapper);
+    List<Object> selectObjs(@Param("ew") Wrapper<T> wrapper);
 
     /**
      * <p>
@@ -219,7 +219,7 @@ public interface BaseMapper<T> {
      * @param wrapper   实体对象封装操作类(可以为 null)
      * @return List<T>
      */
-    List<T> selectPage(RowBounds rowBounds, @Param("ew" ) Wrapper<T> wrapper);
+    List<T> selectPage(RowBounds rowBounds, @Param("ew") Wrapper<T> wrapper);
 
     /**
      * <p>
@@ -228,8 +228,8 @@ public interface BaseMapper<T> {
      *
      * @param rowBounds 分页查询条件(可以为 RowBounds.DEFAULT)
      * @param wrapper   实体对象封装操作类
-     * @return List<Map < String ,   Object>>
+     * @return List<Map   <   String   ,       Object>>
      */
-    List<Map<String, Object>> selectMapsPage(RowBounds rowBounds, @Param("ew" ) Wrapper<T> wrapper);
+    List<Map<String, Object>> selectMapsPage(RowBounds rowBounds, @Param("ew") Wrapper<T> wrapper);
 
 }

+ 1 - 1
mybatis-plus-core/src/main/java/com/baomidou/mybatisplus/core/metadata/Column.java

@@ -33,7 +33,7 @@ public class Column implements Serializable {
 
     private static final long serialVersionUID = 1L;
 
-    private static final String AS = " AS " ;
+    private static final String AS = " AS ";
 
     /**
      * 获取实例

+ 1 - 1
mybatis-plus-core/src/main/java/com/baomidou/mybatisplus/core/metadata/GlobalConfiguration.java

@@ -270,7 +270,7 @@ public class GlobalConfiguration implements Serializable {
             if (reservedWordsHandler == null) {
                 reservedWordsHandler = SqlReservedWordsHandler.getInstance();
             }
-            reservedWordsHandler.addAll(StringUtils.splitWorker(sqlKeywords.toUpperCase(), "," , -1, false));
+            reservedWordsHandler.addAll(StringUtils.splitWorker(sqlKeywords.toUpperCase(), ",", -1, false));
         }
     }
 

+ 2 - 2
mybatis-plus-core/src/main/java/com/baomidou/mybatisplus/core/metadata/TableInfo.java

@@ -100,7 +100,7 @@ public class TableInfo {
     public String getSqlStatement(String sqlMethod) {
         StringBuilder statement = new StringBuilder();
         statement.append(currentNamespace);
-        statement.append("." );
+        statement.append(".");
         statement.append(sqlMethod);
         return statement.toString();
     }
@@ -194,7 +194,7 @@ public class TableInfo {
 
     public void setConfigMark(Configuration configuration) {
         if (configuration == null) {
-            throw new MybatisPlusException("Error: You need Initialize MybatisConfiguration !" );
+            throw new MybatisPlusException("Error: You need Initialize MybatisConfiguration !");
         }
         this.configMark = configuration.toString();
     }

+ 4 - 4
mybatis-plus-core/src/main/java/com/baomidou/mybatisplus/core/pagination/Page.java

@@ -83,13 +83,13 @@ public class Page<T> extends Pagination {
     @Override
     public String toString() {
         StringBuilder pg = new StringBuilder();
-        pg.append(" Page:{ [" ).append(super.toString()).append("], " );
+        pg.append(" Page:{ [").append(super.toString()).append("], ");
         if (records != null) {
-            pg.append("records-size:" ).append(records.size());
+            pg.append("records-size:").append(records.size());
         } else {
-            pg.append("records is null" );
+            pg.append("records is null");
         }
-        return pg.append(" }" ).toString();
+        return pg.append(" }").toString();
     }
 
 }

+ 1 - 1
mybatis-plus-core/src/main/java/com/baomidou/mybatisplus/core/pagination/PageHelper.java

@@ -43,7 +43,7 @@ public class PageHelper {
         if (isPageable()) {
             return LOCAL_PAGE.get().getTotal();
         } else {
-            throw new MybatisPlusException("The current thread does not start paging. Please call before PageHelper.startPage" );
+            throw new MybatisPlusException("The current thread does not start paging. Please call before PageHelper.startPage");
         }
     }
 

+ 1 - 1
mybatis-plus-core/src/main/java/com/baomidou/mybatisplus/core/pagination/Pagination.java

@@ -302,7 +302,7 @@ public class Pagination extends RowBounds implements Serializable {
 
     @Override
     public String toString() {
-        return "Pagination { total=" + total + " ,size=" + size + " ,pages=" + pages + " ,current=" + current + " }" ;
+        return "Pagination { total=" + total + " ,size=" + size + " ,pages=" + pages + " ,current=" + current + " }";
     }
 
 }

+ 2 - 2
mybatis-plus-core/src/main/java/com/baomidou/mybatisplus/core/parser/SqlParserHelper.java

@@ -11,7 +11,7 @@ import com.baomidou.mybatisplus.annotation.SqlParser;
 
 public class SqlParserHelper {
 
-    public static final String DELEGATE_MAPPED_STATEMENT = "delegate.mappedStatement" ;
+    public static final String DELEGATE_MAPPED_STATEMENT = "delegate.mappedStatement";
     /**
      * SQL 解析缓存
      */
@@ -31,7 +31,7 @@ public class SqlParserHelper {
             SqlParser sqlParser = method.getAnnotation(SqlParser.class);
             if (null != sqlParser) {
                 StringBuilder sid = new StringBuilder();
-                sid.append(mapperClass.getName()).append("." ).append(method.getName());
+                sid.append(mapperClass.getName()).append(".").append(method.getName());
                 sqlParserInfoCache.put(sid.toString(), new SqlParserInfo(sqlParser));
             }
         }

+ 5 - 5
mybatis-plus-core/src/main/java/com/baomidou/mybatisplus/core/toolkit/ClassUtils.java

@@ -21,10 +21,10 @@ public class ClassUtils {
         if (clazz != null) {
             for (Class<?> cls : clazz.getInterfaces()) {
                 String interfaceName = cls.getName();
-                if (interfaceName.equals("net.sf.cglib.proxy.Factory" ) //cglib
-                    || interfaceName.equals("org.springframework.cglib.proxy.Factory" )
-                    || interfaceName.equals("javassist.util.proxy.ProxyObject" ) //javassist
-                    || interfaceName.equals("org.apache.ibatis.javassist.util.proxy.ProxyObject" )) {
+                if (interfaceName.equals("net.sf.cglib.proxy.Factory") //cglib
+                    || interfaceName.equals("org.springframework.cglib.proxy.Factory")
+                    || interfaceName.equals("javassist.util.proxy.ProxyObject") //javassist
+                    || interfaceName.equals("org.apache.ibatis.javassist.util.proxy.ProxyObject")) {
                     return true;
                 }
             }
@@ -50,7 +50,7 @@ public class ClassUtils {
      */
     public static Class<?> getUserClass(Object object) {
         if (object == null) {
-            throw new MybatisPlusException("Error: Instance must not be null" );
+            throw new MybatisPlusException("Error: Instance must not be null");
         }
         return getUserClass(object.getClass());
     }

+ 3 - 3
mybatis-plus-core/src/main/java/com/baomidou/mybatisplus/core/toolkit/GlobalConfigUtils.java

@@ -84,7 +84,7 @@ public class GlobalConfigUtils {
      */
     public static void setGlobalConfig(Configuration configuration, GlobalConfiguration mybatisGlobalConfig) {
         if (configuration == null || mybatisGlobalConfig == null) {
-            throw new MybatisPlusException("Error: Could not setGlobalConfig" );
+            throw new MybatisPlusException("Error: Could not setGlobalConfig");
         }
         // 设置全局设置
         GLOBAL_CONFIG.put(configuration.toString(), mybatisGlobalConfig);
@@ -100,7 +100,7 @@ public class GlobalConfigUtils {
      */
     public static GlobalConfiguration getGlobalConfig(Configuration configuration) {
         if (configuration == null) {
-            throw new MybatisPlusException("Error: You need Initialize MybatisConfiguration !" );
+            throw new MybatisPlusException("Error: You need Initialize MybatisConfiguration !");
         }
         return getGlobalConfig(configuration.toString());
     }
@@ -117,7 +117,7 @@ public class GlobalConfigUtils {
         GlobalConfiguration cache = GLOBAL_CONFIG.get(configMark);
         if (cache == null) {
             // 没有获取全局配置初始全局配置
-            logger.debug("DeBug: MyBatis Plus Global configuration Initializing !" );
+            logger.debug("DeBug: MyBatis Plus Global configuration Initializing !");
             GLOBAL_CONFIG.put(configMark, DEFAULT);
             return DEFAULT;
         }

+ 7 - 7
mybatis-plus-core/src/main/java/com/baomidou/mybatisplus/core/toolkit/IOUtils.java

@@ -216,7 +216,7 @@ public class IOUtils {
                 closeable.close();
             }
         } catch (final IOException ioe) {
-            logger.error("error close io" , ioe);
+            logger.error("error close io", ioe);
         }
     }
 
@@ -300,7 +300,7 @@ public class IOUtils {
             try {
                 sock.close();
             } catch (final IOException ioe) {
-                logger.error("error close io" , ioe);
+                logger.error("error close io", ioe);
             }
         }
     }
@@ -334,7 +334,7 @@ public class IOUtils {
             try {
                 selector.close();
             } catch (final IOException ioe) {
-                logger.error("error close io" , ioe);
+                logger.error("error close io", ioe);
             }
         }
     }
@@ -368,7 +368,7 @@ public class IOUtils {
             try {
                 sock.close();
             } catch (final IOException ioe) {
-                logger.error("error close io" , ioe);
+                logger.error("error close io", ioe);
             }
         }
     }
@@ -402,7 +402,7 @@ public class IOUtils {
             try {
                 conn.close();
             } catch (Exception e) {
-                logger.error("error close conn" , e);
+                logger.error("error close conn", e);
             }
         }
     }
@@ -436,7 +436,7 @@ public class IOUtils {
             try {
                 resultSet.close();
             } catch (Exception e) {
-                logger.error("error close resultSet" , e);
+                logger.error("error close resultSet", e);
             }
         }
     }
@@ -470,7 +470,7 @@ public class IOUtils {
             try {
                 statement.close();
             } catch (Exception e) {
-                logger.error("error close statement" , e);
+                logger.error("error close statement", e);
             }
         }
     }

+ 1 - 1
mybatis-plus-core/src/main/java/com/baomidou/mybatisplus/core/toolkit/IdWorker.java

@@ -48,7 +48,7 @@ public class IdWorker {
      * </p>
      */
     public static synchronized String get32UUID() {
-        return UUID.randomUUID().toString().replace("-" , "" );
+        return UUID.randomUUID().toString().replace("-", "");
     }
 
 }

+ 2 - 2
mybatis-plus-core/src/main/java/com/baomidou/mybatisplus/core/toolkit/PluginUtils.java

@@ -31,7 +31,7 @@ import org.apache.ibatis.reflection.SystemMetaObject;
  */
 public abstract class PluginUtils {
 
-    public static final String DELEGATE_BOUNDSQL_SQL = "delegate.boundSql.sql" ;
+    public static final String DELEGATE_BOUNDSQL_SQL = "delegate.boundSql.sql";
 
 
     private PluginUtils() {
@@ -47,7 +47,7 @@ public abstract class PluginUtils {
     public static Object realTarget(Object target) {
         if (Proxy.isProxyClass(target.getClass())) {
             MetaObject metaObject = SystemMetaObject.forObject(target);
-            return realTarget(metaObject.getValue("h.target" ));
+            return realTarget(metaObject.getValue("h.target"));
         }
         return target;
     }

+ 8 - 8
mybatis-plus-core/src/main/java/com/baomidou/mybatisplus/core/toolkit/ReflectionKit.java

@@ -58,7 +58,7 @@ public class ReflectionKit {
     public static String getMethodCapitalize(Field field, final String str) {
         Class<?> fieldType = field.getType();
         // fix #176
-        return StringUtils.concatCapitalize(boolean.class.equals(fieldType) ? "is" : "get" , str);
+        return StringUtils.concatCapitalize(boolean.class.equals(fieldType) ? "is" : "get", str);
     }
 
     /**
@@ -76,14 +76,14 @@ public class ReflectionKit {
         try {
             if (MapUtils.isEmpty(fieldMaps)) {
                 throw new MybatisPlusException(
-                    String.format("Error: NoSuchField in %s for %s.  Cause:" , cls.getSimpleName(), str));
+                    String.format("Error: NoSuchField in %s for %s.  Cause:", cls.getSimpleName(), str));
             }
             Method method = cls.getMethod(getMethodCapitalize(fieldMaps.get(str), str));
             return method.invoke(entity);
         } catch (NoSuchMethodException e) {
-            throw new MybatisPlusException(String.format("Error: NoSuchMethod in %s.  Cause:" , cls.getSimpleName()) + e);
+            throw new MybatisPlusException(String.format("Error: NoSuchMethod in %s.  Cause:", cls.getSimpleName()) + e);
         } catch (IllegalAccessException e) {
-            throw new MybatisPlusException(String.format("Error: Cannot execute a private method. in %s.  Cause:" ,
+            throw new MybatisPlusException(String.format("Error: Cannot execute a private method. in %s.  Cause:",
                 cls.getSimpleName())
                 + e);
         } catch (InvocationTargetException e) {
@@ -116,21 +116,21 @@ public class ReflectionKit {
      * @param index 泛型所在位置
      * @return Class
      */
-    @SuppressWarnings("rawtypes" )
+    @SuppressWarnings("rawtypes")
     public static Class getSuperClassGenricType(final Class clazz, final int index) {
         Type genType = clazz.getGenericSuperclass();
         if (!(genType instanceof ParameterizedType)) {
-            logger.warn(String.format("Warn: %s's superclass not ParameterizedType" , clazz.getSimpleName()));
+            logger.warn(String.format("Warn: %s's superclass not ParameterizedType", clazz.getSimpleName()));
             return Object.class;
         }
         Type[] params = ((ParameterizedType) genType).getActualTypeArguments();
         if (index >= params.length || index < 0) {
-            logger.warn(String.format("Warn: Index: %s, Size of %s's Parameterized Type: %s ." , index, clazz.getSimpleName(),
+            logger.warn(String.format("Warn: Index: %s, Size of %s's Parameterized Type: %s .", index, clazz.getSimpleName(),
                 params.length));
             return Object.class;
         }
         if (!(params[index] instanceof Class)) {
-            logger.warn(String.format("Warn: %s not set the actual class on superclass generic parameter" , clazz.getSimpleName()));
+            logger.warn(String.format("Warn: %s not set the actual class on superclass generic parameter", clazz.getSimpleName()));
             return Object.class;
         }
         return (Class) params[index];

+ 5 - 5
mybatis-plus-core/src/main/java/com/baomidou/mybatisplus/core/toolkit/Sequence.java

@@ -69,11 +69,11 @@ public class Sequence {
      */
     public Sequence(long workerId, long datacenterId) {
         if (workerId > maxWorkerId || workerId < 0) {
-            throw new MybatisPlusException(String.format("worker Id can't be greater than %d or less than 0" , maxWorkerId));
+            throw new MybatisPlusException(String.format("worker Id can't be greater than %d or less than 0", maxWorkerId));
         }
         if (datacenterId > maxDatacenterId || datacenterId < 0) {
             throw new MybatisPlusException(
-                String.format("datacenter Id can't be greater than %d or less than 0" , maxDatacenterId));
+                String.format("datacenter Id can't be greater than %d or less than 0", maxDatacenterId));
         }
         this.workerId = workerId;
         this.datacenterId = datacenterId;
@@ -92,7 +92,7 @@ public class Sequence {
             /*
              * GET jvmPid
              */
-            mpid.append(name.split("@" )[0]);
+            mpid.append(name.split("@")[0]);
         }
         /*
          * MAC + PID 的 hashcode 获取16个低位
@@ -139,13 +139,13 @@ public class Sequence {
                     wait(offset << 1);
                     timestamp = timeGen();
                     if (timestamp < lastTimestamp) {
-                        throw new RuntimeException(String.format("Clock moved backwards.  Refusing to generate id for %d milliseconds" , offset));
+                        throw new RuntimeException(String.format("Clock moved backwards.  Refusing to generate id for %d milliseconds", offset));
                     }
                 } catch (Exception e) {
                     throw new RuntimeException(e);
                 }
             } else {
-                throw new RuntimeException(String.format("Clock moved backwards.  Refusing to generate id for %d milliseconds" , offset));
+                throw new RuntimeException(String.format("Clock moved backwards.  Refusing to generate id for %d milliseconds", offset));
             }
         }
 

+ 15 - 15
mybatis-plus-core/src/main/java/com/baomidou/mybatisplus/core/toolkit/StringUtils.java

@@ -40,16 +40,16 @@ public class StringUtils {
     /**
      * UTF-8 编码格式
      */
-    public static final String UTF8 = "UTF-8" ;
+    public static final String UTF8 = "UTF-8";
 
     /**
      * 空字符
      */
-    public static final String EMPTY = "" ;
+    public static final String EMPTY = "";
     /**
      * 字符串 is
      */
-    public static final String IS = "is" ;
+    public static final String IS = "is";
 
     /**
      * 下划线字符
@@ -59,7 +59,7 @@ public class StringUtils {
     /**
      * 占位符
      */
-    public static final String PLACE_HOLDER = "{%s}" ;
+    public static final String PLACE_HOLDER = "{%s}";
 
     private static boolean separatorBeforeDigit = false;
     private static boolean separatorAfterDigit = true;
@@ -83,7 +83,7 @@ public class StringUtils {
                 byte[] returnValue = blob.getBytes(1, (int) blob.length());
                 return new String(returnValue, UTF8);
             } catch (Exception e) {
-                throw new MybatisPlusException("Blob Convert To String Error!" );
+                throw new MybatisPlusException("Blob Convert To String Error!");
             }
         }
         return null;
@@ -201,7 +201,7 @@ public class StringUtils {
      * @return
      */
     public static boolean isUpperCase(String str) {
-        return match("^[A-Z]+$" , str);
+        return match("^[A-Z]+$", str);
     }
 
     /**
@@ -288,7 +288,7 @@ public class StringUtils {
      */
     public static String quotaMarkList(Collection<?> coll) {
         StringBuilder sqlBuild = new StringBuilder();
-        sqlBuild.append("(" );
+        sqlBuild.append("(");
         int size = coll.size();
         int i = 0;
         Iterator<?> iterator = coll.iterator();
@@ -296,11 +296,11 @@ public class StringUtils {
             String tempVal = StringUtils.quotaMark(iterator.next());
             sqlBuild.append(tempVal);
             if (i + 1 < size) {
-                sqlBuild.append("," );
+                sqlBuild.append(",");
             }
             i++;
         }
-        sqlBuild.append(")" );
+        sqlBuild.append(")");
         return sqlBuild.toString();
     }
 
@@ -401,7 +401,7 @@ public class StringUtils {
      * @return
      */
     public static boolean isCapitalMode(String word) {
-        return null != word && word.matches("^[0-9A-Z/_]+$" );
+        return null != word && word.matches("^[0-9A-Z/_]+$");
     }
 
     /**
@@ -413,7 +413,7 @@ public class StringUtils {
      * @return
      */
     public static boolean isMixedMode(String word) {
-        return Pattern.compile(".*[A-Z]+.*" ).matcher(word).matches() && Pattern.compile(".*[/_]+.*" ).matcher(word).matches();
+        return Pattern.compile(".*[A-Z]+.*").matcher(word).matches() && Pattern.compile(".*[/_]+.*").matcher(word).matches();
     }
 
     /**
@@ -773,7 +773,7 @@ public class StringUtils {
             boolean isNotUnderscore = c != '_';
             if ((lastOneIsNotUnderscore) && ((isUpperCaseAndPreviousIsLowerCase) || (previousIsWhitespace) || ((betweenUpperCases)
                 && (containsLowerCase) && (isUpperCaseAndPreviousIsUpperCase)))) {
-                buf.append("_" );
+                buf.append("_");
             } else if (((separatorAfterDigit) && (Character.isDigit(previousChar))
                 && (Character.isLetter(c))) || ((separatorBeforeDigit) && (Character
                 .isDigit(c)) && (Character.isLetter(previousChar)))) {
@@ -787,7 +787,7 @@ public class StringUtils {
             previousChar = c;
         }
         if (Character.isWhitespace(previousChar)) {
-            buf.append("_" );
+            buf.append("_");
         }
         return buf.toString();
     }
@@ -812,7 +812,7 @@ public class StringUtils {
             if ((Character.isWhitespace(lastChar)) && (!Character.isWhitespace(c))
                 && ('-' != c) && (buf.length() > 0)
                 && (buf.charAt(buf.length() - 1) != '-')) {
-                buf.append("-" );
+                buf.append("-");
             }
             if ('_' == c) {
                 buf.append('-');
@@ -824,7 +824,7 @@ public class StringUtils {
             lastChar = c;
         }
         if (Character.isWhitespace(lastChar)) {
-            buf.append("-" );
+            buf.append("-");
         }
         return buf.toString();
     }

+ 1 - 1
mybatis-plus-core/src/main/java/com/baomidou/mybatisplus/core/toolkit/SystemClock.java

@@ -67,7 +67,7 @@ public class SystemClock {
 
             @Override
             public Thread newThread(Runnable runnable) {
-                Thread thread = new Thread(runnable, "System Clock" );
+                Thread thread = new Thread(runnable, "System Clock");
                 thread.setDaemon(true);
                 return thread;
             }

+ 7 - 7
mybatis-plus-core/src/main/java/com/baomidou/mybatisplus/core/toolkit/TableInfoHelper.java

@@ -66,7 +66,7 @@ public class TableInfoHelper {
     /**
      * 默认表主键
      */
-    private static final String DEFAULT_ID_NAME = "id" ;
+    private static final String DEFAULT_ID_NAME = "id";
 
     /**
      * <p>
@@ -185,7 +185,7 @@ public class TableInfoHelper {
          * 未发现主键注解,提示警告信息
          */
         if (StringUtils.isEmpty(tableInfo.getKeyColumn())) {
-            logger.warn(String.format("Warn: Could not find @TableId in Class: %s." , clazz.getName()));
+            logger.warn(String.format("Warn: Could not find @TableId in Class: %s.", clazz.getName()));
         }
         /*
          * 注入
@@ -299,7 +299,7 @@ public class TableInfoHelper {
      */
     private static void throwExceptionId(Class<?> clazz) {
         StringBuilder errorMsg = new StringBuilder();
-        errorMsg.append("There must be only one, Discover multiple @TableId annotation in " );
+        errorMsg.append("There must be only one, Discover multiple @TableId annotation in ");
         errorMsg.append(clazz.getName());
         throw new MybatisPlusException(errorMsg.toString());
     }
@@ -331,14 +331,14 @@ public class TableInfoHelper {
             if (StringUtils.isNotEmpty(tableField.el())) {
                 el = tableField.el();
             }
-            String[] columns = columnName.split(";" );
-            String[] els = el.split(";" );
+            String[] columns = columnName.split(";");
+            String[] els = el.split(";");
             if (columns.length == els.length) {
                 for (int i = 0; i < columns.length; i++) {
                     fieldList.add(new TableFieldInfo(globalConfig, tableInfo, columns[i], els[i], field, tableField));
                 }
             } else {
-                String errorMsg = "Class: %s, Field: %s, 'value' 'el' Length must be consistent." ;
+                String errorMsg = "Class: %s, Field: %s, 'value' 'el' Length must be consistent.";
                 throw new MybatisPlusException(String.format(errorMsg, clazz.getName(), field.getName()));
             }
             return true;
@@ -397,7 +397,7 @@ public class TableInfoHelper {
                                                String baseStatementId, LanguageDriver languageDriver) {
         IKeyGenerator keyGenerator = GlobalConfigUtils.getKeyGenerator(builderAssistant.getConfiguration());
         if (null == keyGenerator) {
-            throw new IllegalArgumentException("not configure IKeyGenerator implementation class." );
+            throw new IllegalArgumentException("not configure IKeyGenerator implementation class.");
         }
         String id = baseStatementId + SelectKeyGenerator.SELECT_KEY_SUFFIX;
         Class<?> resultTypeClass = tableInfo.getKeySequence().clazz();

+ 41 - 41
mybatis-plus-core/src/main/java/com/baomidou/mybatisplus/core/toolkit/sql/SqlFormatter.java

@@ -25,52 +25,52 @@ import com.baomidou.mybatisplus.core.toolkit.StringUtils;
  */
 public class SqlFormatter {
 
-    public static final String WHITESPACE = " \n\r\f\t" ;
+    public static final String WHITESPACE = " \n\r\f\t";
     private static final Set<String> BEGIN_CLAUSES = new HashSet<>();
     private static final Set<String> END_CLAUSES = new HashSet<>();
     private static final Set<String> LOGICAL = new HashSet<>();
     private static final Set<String> QUANTIFIERS = new HashSet<>();
     private static final Set<String> DML = new HashSet<>();
     private static final Set<String> MISC = new HashSet<>();
-    private static final String INDENT_STRING = "    " ;
-    private static final String INITIAL = "\n    " ;
+    private static final String INDENT_STRING = "    ";
+    private static final String INITIAL = "\n    ";
 
     static {
-        BEGIN_CLAUSES.add("left" );
-        BEGIN_CLAUSES.add("right" );
-        BEGIN_CLAUSES.add("inner" );
-        BEGIN_CLAUSES.add("outer" );
-        BEGIN_CLAUSES.add("group" );
-        BEGIN_CLAUSES.add("order" );
-
-        END_CLAUSES.add("where" );
-        END_CLAUSES.add("set" );
-        END_CLAUSES.add("having" );
-        END_CLAUSES.add("join" );
-        END_CLAUSES.add("from" );
-        END_CLAUSES.add("by" );
-        END_CLAUSES.add("join" );
-        END_CLAUSES.add("into" );
-        END_CLAUSES.add("union" );
-
-        LOGICAL.add("and" );
-        LOGICAL.add("or" );
-        LOGICAL.add("when" );
-        LOGICAL.add("else" );
-        LOGICAL.add("end" );
-
-        QUANTIFIERS.add("in" );
-        QUANTIFIERS.add("all" );
-        QUANTIFIERS.add("exists" );
-        QUANTIFIERS.add("some" );
-        QUANTIFIERS.add("any" );
-
-        DML.add("insert" );
-        DML.add("update" );
-        DML.add("delete" );
-
-        MISC.add("select" );
-        MISC.add("on" );
+        BEGIN_CLAUSES.add("left");
+        BEGIN_CLAUSES.add("right");
+        BEGIN_CLAUSES.add("inner");
+        BEGIN_CLAUSES.add("outer");
+        BEGIN_CLAUSES.add("group");
+        BEGIN_CLAUSES.add("order");
+
+        END_CLAUSES.add("where");
+        END_CLAUSES.add("set");
+        END_CLAUSES.add("having");
+        END_CLAUSES.add("join");
+        END_CLAUSES.add("from");
+        END_CLAUSES.add("by");
+        END_CLAUSES.add("join");
+        END_CLAUSES.add("into");
+        END_CLAUSES.add("union");
+
+        LOGICAL.add("and");
+        LOGICAL.add("or");
+        LOGICAL.add("when");
+        LOGICAL.add("else");
+        LOGICAL.add("end");
+
+        QUANTIFIERS.add("in");
+        QUANTIFIERS.add("all");
+        QUANTIFIERS.add("exists");
+        QUANTIFIERS.add("some");
+        QUANTIFIERS.add("any");
+
+        DML.add("insert");
+        DML.add("update");
+        DML.add("delete");
+
+        MISC.add("select");
+        MISC.add("on");
     }
 
     public String format(String source) {
@@ -155,7 +155,7 @@ public class SqlFormatter {
                     values();
                 } else if ("on".equals(lcToken)) {
                     on();
-                } else if (afterBetween && lcToken.equals("and" )) {
+                } else if (afterBetween && lcToken.equals("and")) {
                     misc();
                     afterBetween = false;
                 } else if (LOGICAL.contains(lcToken)) {
@@ -222,7 +222,7 @@ public class SqlFormatter {
 
         private void white() {
             if (!beginLine) {
-                result.append(" " );
+                result.append(" ");
             }
         }
 
@@ -349,7 +349,7 @@ public class SqlFormatter {
         }
 
         private void newline() {
-            result.append("\n" );
+            result.append("\n");
             for (int i = 0; i < indent; i++) {
                 result.append(INDENT_STRING);
             }

+ 2 - 2
mybatis-plus-core/src/main/java/com/baomidou/mybatisplus/core/toolkit/sql/SqlHelper.java

@@ -117,7 +117,7 @@ public class SqlHelper {
     public static TableInfo table(Class<?> clazz) {
         TableInfo tableInfo = TableInfoHelper.getTableInfo(clazz);
         if (null == tableInfo) {
-            throw new MybatisPlusException("Error: Cannot execute table Method, ClassGenricType not found ." );
+            throw new MybatisPlusException("Error: Cannot execute table Method, ClassGenricType not found .");
         }
         return tableInfo;
     }
@@ -171,7 +171,7 @@ public class SqlHelper {
         if (CollectionUtils.isNotEmpty(list)) {
             int size = list.size();
             if (size > 1) {
-                logger.warn(String.format("Warn: execute Method There are  %s results." , size));
+                logger.warn(String.format("Warn: execute Method There are  %s results.", size));
             }
             return list.get(0);
         }

+ 13 - 13
mybatis-plus-core/src/main/java/com/baomidou/mybatisplus/core/toolkit/sql/SqlUtils.java

@@ -42,7 +42,7 @@ public class SqlUtils {
     static {
         try {
             //TODO: 3.0
-            DEFAULT_CLASS = (Class<ISqlParser>) Class.forName("com.baomidou.mybatisplus.extension.plugins.pagination.optimize.JsqlParserCountOptimize" );
+            DEFAULT_CLASS = (Class<ISqlParser>) Class.forName("com.baomidou.mybatisplus.extension.plugins.pagination.optimize.JsqlParserCountOptimize");
         } catch (ClassNotFoundException e) {
             //skip
         }
@@ -57,7 +57,7 @@ public class SqlUtils {
      * @return
      */
     public static String getOriginalCountSql(String originalSql) {
-        return String.format("SELECT COUNT(1) FROM ( %s ) TOTAL" , originalSql);
+        return String.format("SELECT COUNT(1) FROM ( %s ) TOTAL", originalSql);
     }
 
 
@@ -107,13 +107,13 @@ public class SqlUtils {
     public static String concatOrderBy(String originalSql, Pagination page, boolean orderBy) {
         if (orderBy && page.isOpenSort()) {
             StringBuilder buildSql = new StringBuilder(originalSql);
-            String ascStr = concatOrderBuilder(page.getAscs(), " ASC" );
-            String descStr = concatOrderBuilder(page.getDescs(), " DESC" );
+            String ascStr = concatOrderBuilder(page.getAscs(), " ASC");
+            String descStr = concatOrderBuilder(page.getDescs(), " DESC");
             if (StringUtils.isNotEmpty(ascStr) && StringUtils.isNotEmpty(descStr)) {
-                ascStr += ", " ;
+                ascStr += ", ";
             }
             if (StringUtils.isNotEmpty(ascStr) || StringUtils.isNotEmpty(descStr)) {
-                buildSql.append(" ORDER BY " ).append(ascStr).append(descStr);
+                buildSql.append(" ORDER BY ").append(ascStr).append(descStr);
             }
             return buildSql.toString();
         }
@@ -135,7 +135,7 @@ public class SqlUtils {
                     builder.append(cs).append(orderWord);
                 }
                 if (++i != columns.size() && StringUtils.isNotEmpty(cs)) {
-                    builder.append(", " );
+                    builder.append(", ");
                 }
             }
             return builder.toString();
@@ -154,7 +154,7 @@ public class SqlUtils {
         if (format) {
             return sqlFormatter.format(boundSql);
         } else {
-            return boundSql.replaceAll("[\\s]+" , " " );
+            return boundSql.replaceAll("[\\s]+", " ");
         }
     }
 
@@ -170,16 +170,16 @@ public class SqlUtils {
         StringBuilder builder = new StringBuilder(str.length() + 3);
         switch (type) {
             case LEFT:
-                builder.append("%" ).append(str);
+                builder.append("%").append(str);
                 break;
             case RIGHT:
-                builder.append(str).append("%" );
+                builder.append(str).append("%");
                 break;
             case CUSTOM:
                 builder.append(str);
                 break;
             default:
-                builder.append("%" ).append(str).append("%" );
+                builder.append("%").append(str).append("%");
         }
         return builder.toString();
     }
@@ -195,8 +195,8 @@ public class SqlUtils {
      */
     public static String stripSqlInjection(String sql) {
         if (null == sql) {
-            throw new MybatisPlusException("strip sql is null." );
+            throw new MybatisPlusException("strip sql is null.");
         }
-        return sql.replaceAll("('.+--)|(--)|(\\|)|(%7C)" , "" );
+        return sql.replaceAll("('.+--)|(--)|(\\|)|(%7C)", "");
     }
 }

+ 2 - 2
mybatis-plus-core/src/main/java/com/baomidou/mybatisplus/core/toolkit/sql/StringEscape.java

@@ -67,7 +67,7 @@ public class StringEscape {
      * @return
      */
     public static String escapeString(String escapeStr) {
-        if (escapeStr.matches("\'(.+)\'" )) {
+        if (escapeStr.matches("\'(.+)\'")) {
             escapeStr = escapeStr.substring(1, escapeStr.length() - 1);
         }
         String parameterAsString = escapeStr;
@@ -129,7 +129,7 @@ public class StringEscape {
             }
             parameterAsString = buf.toString();
         }
-        return "\'" + parameterAsString + "\'" ;
+        return "\'" + parameterAsString + "\'";
     }
 
 }

+ 2 - 1
mybatis-plus-core/src/test/java/com/baomidou/mybatisplus/core/test/Main.java

@@ -1,11 +1,12 @@
 package com.baomidou.mybatisplus.core.test;
 
 public class Main {
+
     public static void main(String[] args) {
         Query query = new Query(User.class)
             .select(User::getId, User::getName)
             .eq(User::getId, 1)
-            .eq(User::getName,"张三")
+            .eq(User::getName, "张三")
             .orderBy(User::getName);
         System.out.println(query);
     }

+ 12 - 9
mybatis-plus-core/src/test/java/com/baomidou/mybatisplus/core/test/Query.java

@@ -9,6 +9,7 @@ import java.util.List;
 import java.util.Map;
 import java.util.function.Function;
 import java.util.stream.Collectors;
+
 import org.apache.ibatis.jdbc.SQL;
 
 public class Query {
@@ -17,32 +18,33 @@ public class Query {
 
     private Class<?> clazz;
 
-    private Map<Method,String> introspector;
+    private Map<Method, String> introspector;
 
     public Query(Class<?> clazz) {
         this.clazz = clazz;
-        introspector=QueryHelper.introspector(clazz);
+        introspector = QueryHelper.introspector(clazz);
         sql.FROM(clazz.getSimpleName().toUpperCase());
     }
 
-    public Query select(){
+    public Query select() {
         sql.SELECT("*");
         return this;
     }
-    public <T>  Query select(Property<T, ?>... fun){
-       String[] args = Arrays.asList(fun).stream().map(x -> introspector.get( method(x))).collect(Collectors.toList()).toArray(new String[]{});
+
+    public <T> Query select(Property<T, ?>... fun) {
+        String[] args = Arrays.asList(fun).stream().map(x -> introspector.get(method(x))).collect(Collectors.toList()).toArray(new String[]{});
         sql.SELECT(args);
         return this;
     }
 
-    public <T> Query eq(Property<T, ?> fun,Object param) {
-        String name = introspector.get( method(fun));
-        sql.WHERE(name+"="+param);
+    public <T> Query eq(Property<T, ?> fun, Object param) {
+        String name = introspector.get(method(fun));
+        sql.WHERE(name + "=" + param);
         return this;
     }
 
     public <T> Query orderBy(Property<T, ?> fun) {
-        String name = introspector.get( method(fun));
+        String name = introspector.get(method(fun));
         sql.ORDER_BY(name);
         return this;
     }
@@ -53,6 +55,7 @@ public class Query {
     }
 
     public interface Property<T, R> extends Function<T, R>, Serializable {
+
     }
 
 }

+ 10 - 9
mybatis-plus-core/src/test/java/com/baomidou/mybatisplus/core/test/QueryHelper.java

@@ -6,6 +6,7 @@ import com.trigersoft.jaque.expression.Expression;
 import com.trigersoft.jaque.expression.InvocationExpression;
 import com.trigersoft.jaque.expression.LambdaExpression;
 import com.trigersoft.jaque.expression.MemberExpression;
+
 import java.beans.BeanInfo;
 import java.beans.IntrospectionException;
 import java.beans.Introspector;
@@ -23,8 +24,8 @@ public class QueryHelper {
         return (Method) ((MemberExpression) ((InvocationExpression) body).getTarget()).getMember();
     }
 
-    public static Map<Method,String> introspector(Class clazz) {
-        Map<Method,String>  map = new LinkedHashMap<>();
+    public static Map<Method, String> introspector(Class clazz) {
+        Map<Method, String> map = new LinkedHashMap<>();
         BeanInfo beanInfo = null;
         try {
             beanInfo = Introspector.getBeanInfo(clazz, Object.class);
@@ -36,14 +37,14 @@ public class QueryHelper {
             for (PropertyDescriptor propertyDescriptor : propertyDescriptors) {
                 if (propertyDescriptor.getName().equals(field.getName())) {
                     TableField tableField = field.getDeclaredAnnotation(TableField.class);
-                    if(tableField==null){
-                    map.put(propertyDescriptor.getReadMethod(),field.getName());
-                    }else {
+                    if (tableField == null) {
+                        map.put(propertyDescriptor.getReadMethod(), field.getName());
+                    } else {
                         String value = tableField.value();
-                        if(value==null||value.isEmpty()){
-                            map.put(propertyDescriptor.getReadMethod(),field.getName());
-                        }else{
-                        map.put(propertyDescriptor.getReadMethod(), value);
+                        if (value == null || value.isEmpty()) {
+                            map.put(propertyDescriptor.getReadMethod(), field.getName());
+                        } else {
+                            map.put(propertyDescriptor.getReadMethod(), value);
                         }
                     }
                 }

+ 2 - 0
mybatis-plus-core/src/test/java/com/baomidou/mybatisplus/core/test/Role.java

@@ -1,10 +1,12 @@
 package com.baomidou.mybatisplus.core.test;
 
 import com.baomidou.mybatisplus.annotation.TableField;
+
 import lombok.Data;
 
 @Data
 public class Role {
+
     private Integer id;
 
     @TableField("roleName")

+ 1 - 0
mybatis-plus-core/src/test/java/com/baomidou/mybatisplus/core/test/User.java

@@ -2,6 +2,7 @@ package com.baomidou.mybatisplus.core.test;
 
 import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableName;
+
 import lombok.Data;
 
 @TableName("sys_user")

+ 7 - 7
mybatis-plus-extension/src/main/java/com/baomidou/mybatisplus/extension/MybatisSqlSessionTemplate.java

@@ -93,8 +93,8 @@ public class MybatisSqlSessionTemplate implements SqlSession, DisposableBean {
     public MybatisSqlSessionTemplate(SqlSessionFactory sqlSessionFactory, ExecutorType executorType,
                                      PersistenceExceptionTranslator exceptionTranslator) {
 
-        Assert.notNull(sqlSessionFactory, "Property 'sqlSessionFactory' is required" );
-        Assert.notNull(executorType, "Property 'executorType' is required" );
+        Assert.notNull(sqlSessionFactory, "Property 'sqlSessionFactory' is required");
+        Assert.notNull(executorType, "Property 'executorType' is required");
 
         this.sqlSessionFactory = sqlSessionFactory;
         this.executorType = executorType;
@@ -288,7 +288,7 @@ public class MybatisSqlSessionTemplate implements SqlSession, DisposableBean {
      */
     @Override
     public void commit() {
-        throw new UnsupportedOperationException("Manual commit is not allowed over a Spring managed SqlSession" );
+        throw new UnsupportedOperationException("Manual commit is not allowed over a Spring managed SqlSession");
     }
 
     /**
@@ -296,7 +296,7 @@ public class MybatisSqlSessionTemplate implements SqlSession, DisposableBean {
      */
     @Override
     public void commit(boolean force) {
-        throw new UnsupportedOperationException("Manual commit is not allowed over a Spring managed SqlSession" );
+        throw new UnsupportedOperationException("Manual commit is not allowed over a Spring managed SqlSession");
     }
 
     /**
@@ -304,7 +304,7 @@ public class MybatisSqlSessionTemplate implements SqlSession, DisposableBean {
      */
     @Override
     public void rollback() {
-        throw new UnsupportedOperationException("Manual rollback is not allowed over a Spring managed SqlSession" );
+        throw new UnsupportedOperationException("Manual rollback is not allowed over a Spring managed SqlSession");
     }
 
     /**
@@ -312,7 +312,7 @@ public class MybatisSqlSessionTemplate implements SqlSession, DisposableBean {
      */
     @Override
     public void rollback(boolean force) {
-        throw new UnsupportedOperationException("Manual rollback is not allowed over a Spring managed SqlSession" );
+        throw new UnsupportedOperationException("Manual rollback is not allowed over a Spring managed SqlSession");
     }
 
     /**
@@ -320,7 +320,7 @@ public class MybatisSqlSessionTemplate implements SqlSession, DisposableBean {
      */
     @Override
     public void close() {
-        throw new UnsupportedOperationException("Manual close is not allowed over a Spring managed SqlSession" );
+        throw new UnsupportedOperationException("Manual close is not allowed over a Spring managed SqlSession");
     }
 
     /**

+ 13 - 13
mybatis-plus-extension/src/main/java/com/baomidou/mybatisplus/extension/activerecord/Model.java

@@ -105,7 +105,7 @@ public abstract class Model<T extends Model> implements Serializable {
     @Transactional(rollbackFor = Exception.class)
     public boolean deleteById() {
         if (StringUtils.checkValNull(pkVal())) {
-            throw new MybatisPlusException("deleteById primaryKey is null." );
+            throw new MybatisPlusException("deleteById primaryKey is null.");
         }
         return deleteById(this.pkVal());
     }
@@ -135,7 +135,7 @@ public abstract class Model<T extends Model> implements Serializable {
     @Transactional(rollbackFor = Exception.class)
     public boolean delete(Wrapper wrapper) {
         Map<String, Object> map = new HashMap<>();
-        map.put("ew" , wrapper);
+        map.put("ew", wrapper);
         return SqlHelper.delBool(sqlSession().delete(sqlStatement(SqlMethod.DELETE), map));
     }
 
@@ -147,11 +147,11 @@ public abstract class Model<T extends Model> implements Serializable {
     @Transactional(rollbackFor = Exception.class)
     public boolean updateById() {
         if (StringUtils.checkValNull(pkVal())) {
-            throw new MybatisPlusException("updateById primaryKey is null." );
+            throw new MybatisPlusException("updateById primaryKey is null.");
         }
         // updateById
         Map<String, Object> map = new HashMap<>();
-        map.put("et" , this);
+        map.put("et", this);
         return SqlHelper.retBool(sqlSession().update(sqlStatement(SqlMethod.UPDATE_BY_ID), map));
     }
 
@@ -163,11 +163,11 @@ public abstract class Model<T extends Model> implements Serializable {
     @Transactional(rollbackFor = Exception.class)
     public boolean updateAllColumnById() {
         if (StringUtils.checkValNull(pkVal())) {
-            throw new MybatisPlusException("updateAllColumnById primaryKey is null." );
+            throw new MybatisPlusException("updateAllColumnById primaryKey is null.");
         }
         // updateAllColumnById
         Map<String, Object> map = new HashMap<>();
-        map.put("et" , this);
+        map.put("et", this);
         return SqlHelper.retBool(sqlSession().update(sqlStatement(SqlMethod.UPDATE_ALL_COLUMN_BY_ID), map));
     }
 
@@ -197,8 +197,8 @@ public abstract class Model<T extends Model> implements Serializable {
     @Transactional(rollbackFor = Exception.class)
     public boolean update(Wrapper wrapper) {
         Map<String, Object> map = new HashMap<>();
-        map.put("et" , this);
-        map.put("ew" , wrapper);
+        map.put("et", this);
+        map.put("ew", wrapper);
         // update
         return SqlHelper.retBool(sqlSession().update(sqlStatement(SqlMethod.UPDATE), map));
     }
@@ -235,7 +235,7 @@ public abstract class Model<T extends Model> implements Serializable {
      */
     public T selectById() {
         if (StringUtils.checkValNull(pkVal())) {
-            throw new MybatisPlusException("selectById primaryKey is null." );
+            throw new MybatisPlusException("selectById primaryKey is null.");
         }
         return selectById(this.pkVal());
     }
@@ -251,7 +251,7 @@ public abstract class Model<T extends Model> implements Serializable {
 
     public List<T> selectList(Wrapper wrapper) {
         Map<String, Object> map = new HashMap<>();
-        map.put("ew" , wrapper);
+        map.put("ew", wrapper);
         return sqlSession().selectList(sqlStatement(SqlMethod.SELECT_LIST), map);
     }
 
@@ -305,7 +305,7 @@ public abstract class Model<T extends Model> implements Serializable {
     public Page<T> selectPage(Page<T> page, Wrapper<T> wrapper) {
         Map<String, Object> map = new HashMap<>();
         wrapper = (Wrapper<T>) SqlHelper.fillWrapper(page, wrapper);
-        map.put("ew" , wrapper);
+        map.put("ew", wrapper);
         List<T> tl = sqlSession().selectList(sqlStatement(SqlMethod.SELECT_PAGE), map, page);
         page.setRecords(tl);
         return page;
@@ -321,7 +321,7 @@ public abstract class Model<T extends Model> implements Serializable {
      * @param args
      * @return
      */
-    @SuppressWarnings("unchecked" )
+    @SuppressWarnings("unchecked")
     public Page<T> selectPage(Page<T> page, String whereClause, Object... args) {
         return selectPage(page, Wrapper.<T>getInstance().where(whereClause, args));
     }
@@ -349,7 +349,7 @@ public abstract class Model<T extends Model> implements Serializable {
      */
     public int selectCount(Wrapper wrapper) {
         Map<String, Object> map = new HashMap<>();
-        map.put("ew" , wrapper);
+        map.put("ew", wrapper);
         return SqlHelper.retCount(sqlSession().<Integer>selectOne(sqlStatement(SqlMethod.SELECT_COUNT), map));
     }
 

+ 11 - 11
mybatis-plus-extension/src/main/java/com/baomidou/mybatisplus/extension/enums/DBType.java

@@ -31,43 +31,43 @@ public enum DBType implements IDBType {
     /**
      * MYSQL
      */
-    MYSQL("mysql" , "`%s`" , "MySql数据库" ),
+    MYSQL("mysql", "`%s`", "MySql数据库"),
     /**
      * ORACLE
      */
-    ORACLE("oracle" , null, "Oracle数据库" ),
+    ORACLE("oracle", null, "Oracle数据库"),
     /**
      * DB2
      */
-    DB2("db2" , null, "DB2数据库" ),
+    DB2("db2", null, "DB2数据库"),
     /**
      * H2
      */
-    H2("h2" , null, "H2数据库" ),
+    H2("h2", null, "H2数据库"),
     /**
      * HSQL
      */
-    HSQL("hsql" , null, "HSQL数据库" ),
+    HSQL("hsql", null, "HSQL数据库"),
     /**
      * SQLITE
      */
-    SQLITE("sqlite" , "`%s`" , "SQLite数据库" ),
+    SQLITE("sqlite", "`%s`", "SQLite数据库"),
     /**
      * POSTGRE
      */
-    POSTGRE("postgresql" , "\"%s\"" , "Postgre数据库" ),
+    POSTGRE("postgresql", "\"%s\"", "Postgre数据库"),
     /**
      * SQLSERVER2005
      */
-    SQLSERVER2005("sqlserver2005" , null, "SQLServer2005数据库" ),
+    SQLSERVER2005("sqlserver2005", null, "SQLServer2005数据库"),
     /**
      * SQLSERVER
      */
-    SQLSERVER("sqlserver" , null, "SQLServer数据库" ),
+    SQLSERVER("sqlserver", null, "SQLServer数据库"),
     /**
      * UNKONWN DB
      */
-    OTHER("other" , null, "其他数据库" );
+    OTHER("other", null, "其他数据库");
 
     private final String db;
 
@@ -96,7 +96,7 @@ public enum DBType implements IDBType {
                 return dt;
             }
         }
-        throw new MybatisPlusException("Error: Unknown database type, or do not support changing database!\n" );
+        throw new MybatisPlusException("Error: Unknown database type, or do not support changing database!\n");
     }
 
     public String getDb() {

+ 1 - 1
mybatis-plus-extension/src/main/java/com/baomidou/mybatisplus/extension/handlers/BlobTypeHandler.java

@@ -44,7 +44,7 @@ public class BlobTypeHandler extends BaseTypeHandler<String> {
             ps.setBinaryStream(i, new ByteArrayInputStream(parameter.getBytes(StringUtils.UTF8)),
                 parameter.length());
         } catch (UnsupportedEncodingException e) {
-            throw new MybatisPlusException("Blob Encoding Error!" );
+            throw new MybatisPlusException("Blob Encoding Error!");
         }
     }
 

+ 1 - 1
mybatis-plus-extension/src/main/java/com/baomidou/mybatisplus/extension/handlers/EnumTypeHandler.java

@@ -40,7 +40,7 @@ public class EnumTypeHandler<E extends Enum<?> & IEnum> extends BaseTypeHandler<
 
     public EnumTypeHandler(Class<E> type) {
         if (type == null) {
-            throw new IllegalArgumentException("Type argument cannot be null" );
+            throw new IllegalArgumentException("Type argument cannot be null");
         }
         this.type = type;
     }

+ 1 - 1
mybatis-plus-extension/src/main/java/com/baomidou/mybatisplus/extension/handlers/MybatisMapWrapper.java

@@ -25,7 +25,7 @@ public class MybatisMapWrapper extends MapWrapper {
     public String findProperty(String name, boolean useCamelCaseMapping) {
         if (useCamelCaseMapping
             && ((name.charAt(0) >= 'A' && name.charAt(0) <= 'Z')
-            || name.contains("_" ))) {
+            || name.contains("_"))) {
             return StringUtils.underlineToCamel(name);
         }
         return name;

+ 1 - 1
mybatis-plus-extension/src/main/java/com/baomidou/mybatisplus/extension/incrementer/DB2KeyGenerator.java

@@ -15,7 +15,7 @@ public class DB2KeyGenerator implements IKeyGenerator {
     @Override
     public String executeSql(String incrementerName) {
         StringBuilder sql = new StringBuilder();
-        sql.append("values nextval for " );
+        sql.append("values nextval for ");
         sql.append(incrementerName);
         return sql.toString();
     }

+ 2 - 2
mybatis-plus-extension/src/main/java/com/baomidou/mybatisplus/extension/incrementer/H2KeyGenerator.java

@@ -15,9 +15,9 @@ public class H2KeyGenerator implements IKeyGenerator {
     @Override
     public String executeSql(String incrementerName) {
         StringBuilder sql = new StringBuilder();
-        sql.append("select " );
+        sql.append("select ");
         sql.append(incrementerName);
-        sql.append(".nextval" );
+        sql.append(".nextval");
         return sql.toString();
     }
 }

+ 2 - 2
mybatis-plus-extension/src/main/java/com/baomidou/mybatisplus/extension/incrementer/OracleKeyGenerator.java

@@ -30,8 +30,8 @@ public class OracleKeyGenerator implements IKeyGenerator {
     @Override
     public String executeSql(String incrementerName) {
         StringBuilder sql = new StringBuilder();
-        sql.append("SELECT " ).append(incrementerName);
-        sql.append(".NEXTVAL FROM DUAL" );
+        sql.append("SELECT ").append(incrementerName);
+        sql.append(".NEXTVAL FROM DUAL");
         return sql.toString();
     }
 }

+ 2 - 2
mybatis-plus-extension/src/main/java/com/baomidou/mybatisplus/extension/incrementer/PostgreKeyGenerator.java

@@ -15,9 +15,9 @@ public class PostgreKeyGenerator implements IKeyGenerator {
     @Override
     public String executeSql(String incrementerName) {
         StringBuilder sql = new StringBuilder();
-        sql.append("select nextval('" );
+        sql.append("select nextval('");
         sql.append(incrementerName);
-        sql.append("')" );
+        sql.append("')");
         return sql.toString();
     }
 }

+ 49 - 49
mybatis-plus-extension/src/main/java/com/baomidou/mybatisplus/extension/injector/LogicSqlInjector.java

@@ -51,9 +51,9 @@ public class LogicSqlInjector extends AutoSqlInjector {
             if (batch) {
                 sqlMethod = SqlMethod.LOGIC_DELETE_BATCH_BY_IDS;
                 StringBuilder ids = new StringBuilder();
-                ids.append("\n<foreach item=\"item\" index=\"index\" collection=\"coll\" separator=\",\">" );
-                ids.append("#{item}" );
-                ids.append("\n</foreach>" );
+                ids.append("\n<foreach item=\"item\" index=\"index\" collection=\"coll\" separator=\",\">");
+                ids.append("#{item}");
+                ids.append("\n</foreach>");
                 idStr = ids.toString();
             }
             String sql = String.format(sqlMethod.getSql(), table.getTableName(), sqlLogicSet(table),
@@ -120,9 +120,9 @@ public class LogicSqlInjector extends AutoSqlInjector {
             if (batch) {
                 sqlMethod = SqlMethod.LOGIC_SELECT_BATCH_BY_IDS;
                 StringBuilder ids = new StringBuilder();
-                ids.append("\n<foreach item=\"item\" index=\"index\" collection=\"coll\" separator=\",\">" );
-                ids.append("#{item}" );
-                ids.append("\n</foreach>" );
+                ids.append("\n<foreach item=\"item\" index=\"index\" collection=\"coll\" separator=\",\">");
+                ids.append("#{item}");
+                ids.append("\n</foreach>");
                 sqlSource = languageDriver.createSqlSource(configuration, String.format(sqlMethod.getSql(), sqlSelectColumns(table, false),
                     table.getTableName(), table.getKeyColumn(), ids.toString(), getLogicDeleteSql(table)), modelClass);
             } else {
@@ -149,7 +149,7 @@ public class LogicSqlInjector extends AutoSqlInjector {
     protected void injectUpdateByIdSql(boolean selective, Class<?> mapperClass, Class<?> modelClass, TableInfo table) {
         if (table.isLogicDelete()) {
             SqlMethod sqlMethod = selective ? SqlMethod.LOGIC_UPDATE_BY_ID : SqlMethod.LOGIC_UPDATE_ALL_COLUMN_BY_ID;
-            String sql = String.format(sqlMethod.getSql(), table.getTableName(), sqlSet(selective, table, "et." ),
+            String sql = String.format(sqlMethod.getSql(), table.getTableName(), sqlSet(selective, table, "et."),
                 table.getKeyColumn(),
                 "et." + table.getKeyProperty(),
                 "<if test=\"et instanceof java.util.Map\">" +
@@ -179,11 +179,11 @@ public class LogicSqlInjector extends AutoSqlInjector {
         List<TableFieldInfo> fieldList = table.getFieldList();
         for (TableFieldInfo fieldInfo : fieldList) {
             if (fieldInfo.isLogicDelete()) {
-                sql.append(" AND " ).append(fieldInfo.getColumn());
+                sql.append(" AND ").append(fieldInfo.getColumn());
                 if (StringUtils.isCharSequence(fieldInfo.getPropertyType())) {
-                    sql.append("='" ).append(fieldInfo.getLogicNotDeleteValue()).append("'" );
+                    sql.append("='").append(fieldInfo.getLogicNotDeleteValue()).append("'");
                 } else {
-                    sql.append("=" ).append(fieldInfo.getLogicNotDeleteValue());
+                    sql.append("=").append(fieldInfo.getLogicNotDeleteValue());
                 }
             }
         }
@@ -200,16 +200,16 @@ public class LogicSqlInjector extends AutoSqlInjector {
      */
     protected String sqlLogicSet(TableInfo table) {
         List<TableFieldInfo> fieldList = table.getFieldList();
-        StringBuilder set = new StringBuilder("SET " );
+        StringBuilder set = new StringBuilder("SET ");
         int i = 0;
         for (TableFieldInfo fieldInfo : fieldList) {
             if (fieldInfo.isLogicDelete()) {
                 if (++i > 1) {
-                    set.append("," );
+                    set.append(",");
                 }
-                set.append(fieldInfo.getColumn()).append("=" );
+                set.append(fieldInfo.getColumn()).append("=");
                 if (StringUtils.isCharSequence(fieldInfo.getPropertyType())) {
-                    set.append("'" ).append(fieldInfo.getLogicDeleteValue()).append("'" );
+                    set.append("'").append(fieldInfo.getLogicDeleteValue()).append("'");
                 } else {
                     set.append(fieldInfo.getLogicDeleteValue());
                 }
@@ -223,25 +223,25 @@ public class LogicSqlInjector extends AutoSqlInjector {
     @Override
     protected String sqlWhere(TableInfo table) {
         if (table.isLogicDelete()) {
-            StringBuilder where = new StringBuilder("\n<where>" );
+            StringBuilder where = new StringBuilder("\n<where>");
             // 过滤逻辑
             List<TableFieldInfo> fieldList = table.getFieldList();
             // EW 逻辑
             if (StringUtils.isNotEmpty(table.getKeyProperty())) {
-                where.append("\n<if test=\"ew." ).append(table.getKeyProperty()).append("!=null\">" );
-                where.append(" AND " ).append(table.getKeyColumn()).append("=#{ew." );
-                where.append(table.getKeyProperty()).append("}" );
-                where.append("</if>" );
+                where.append("\n<if test=\"ew.").append(table.getKeyProperty()).append("!=null\">");
+                where.append(" AND ").append(table.getKeyColumn()).append("=#{ew.");
+                where.append(table.getKeyProperty()).append("}");
+                where.append("</if>");
             }
             for (TableFieldInfo fieldInfo : fieldList) {
-                where.append(convertIfTag(fieldInfo, "ew." , false));
-                where.append(" AND " ).append(this.sqlCondition(fieldInfo.getCondition(),
+                where.append(convertIfTag(fieldInfo, "ew.", false));
+                where.append(" AND ").append(this.sqlCondition(fieldInfo.getCondition(),
                     fieldInfo.getColumn(), "ew." + fieldInfo.getEl()));
                 where.append(convertIfTag(fieldInfo, true));
             }
             // 过滤逻辑
-            where.append("\n" ).append(getLogicDeleteSql(table));
-            where.append("\n</where>" );
+            where.append("\n").append(getLogicDeleteSql(table));
+            where.append("\n</where>");
             return where.toString();
         }
         // 正常逻辑
@@ -252,29 +252,29 @@ public class LogicSqlInjector extends AutoSqlInjector {
     protected String sqlWhereEntityWrapper(TableInfo table) {
         if (table.isLogicDelete()) {
             StringBuilder where = new StringBuilder(128);
-            where.append("\n<where>" );
-            where.append("\n<choose><when test=\"ew!=null\">" );
-            where.append("\n<if test=\"ew.entity!=null\">" );
+            where.append("\n<where>");
+            where.append("\n<choose><when test=\"ew!=null\">");
+            where.append("\n<if test=\"ew.entity!=null\">");
             if (StringUtils.isNotEmpty(table.getKeyProperty())) {
-                where.append("\n<if test=\"ew.entity." ).append(table.getKeyProperty()).append("!=null\">" );
-                where.append(" AND " ).append(table.getKeyColumn()).append("=#{ew.entity." );
-                where.append(table.getKeyProperty()).append("}" );
-                where.append("</if>" );
+                where.append("\n<if test=\"ew.entity.").append(table.getKeyProperty()).append("!=null\">");
+                where.append(" AND ").append(table.getKeyColumn()).append("=#{ew.entity.");
+                where.append(table.getKeyProperty()).append("}");
+                where.append("</if>");
             }
             List<TableFieldInfo> fieldList = table.getFieldList();
             for (TableFieldInfo fieldInfo : fieldList) {
-                where.append(convertIfTag(fieldInfo, "ew.entity." , false));
-                where.append(" AND " ).append(this.sqlCondition(fieldInfo.getCondition(),
+                where.append(convertIfTag(fieldInfo, "ew.entity.", false));
+                where.append(" AND ").append(this.sqlCondition(fieldInfo.getCondition(),
                     fieldInfo.getColumn(), "ew.entity." + fieldInfo.getEl()));
                 where.append(convertIfTag(fieldInfo, true));
             }
-            where.append("\n</if>" );
-            where.append("\n" ).append(getLogicDeleteSql(table));
-            where.append("\n<if test=\"ew.sqlSegment!=null\">${ew.sqlSegment}\n</if>" );
-            where.append("\n</when><otherwise>" );
-            where.append("\n" ).append(getLogicDeleteSql(table));
-            where.append("\n</otherwise></choose>" );
-            where.append("\n</where>" );
+            where.append("\n</if>");
+            where.append("\n").append(getLogicDeleteSql(table));
+            where.append("\n<if test=\"ew.sqlSegment!=null\">${ew.sqlSegment}\n</if>");
+            where.append("\n</when><otherwise>");
+            where.append("\n").append(getLogicDeleteSql(table));
+            where.append("\n</otherwise></choose>");
+            where.append("\n</where>");
             return where.toString();
         }
         // 正常逻辑
@@ -285,20 +285,20 @@ public class LogicSqlInjector extends AutoSqlInjector {
     protected String sqlWhereByMap(TableInfo table) {
         if (table.isLogicDelete()) {
             StringBuilder where = new StringBuilder();
-            where.append("\n<where>" );
+            where.append("\n<where>");
             // MAP 逻辑
-            where.append("\n<if test=\"cm!=null and !cm.isEmpty\">" );
-            where.append("\n<foreach collection=\"cm.keys\" item=\"k\" separator=\"AND\">" );
-            where.append("\n<if test=\"cm[k] != null\">" );
+            where.append("\n<if test=\"cm!=null and !cm.isEmpty\">");
+            where.append("\n<foreach collection=\"cm.keys\" item=\"k\" separator=\"AND\">");
+            where.append("\n<if test=\"cm[k] != null\">");
 //            where.append(SqlReservedWords.convert(getGlobalConfig(), "\n${k}")).append(" = #{cm[${k}]}");
             //TODO: 3.0
-            where.append(getGlobalConfig().getReservedWordsHandler().convert(getGlobalConfig(), "\n${k}" )).append(" = #{cm[${k}]}" );
-            where.append("</if>" );
-            where.append("\n</foreach>" );
-            where.append("\n</if>" );
+            where.append(getGlobalConfig().getReservedWordsHandler().convert(getGlobalConfig(), "\n${k}")).append(" = #{cm[${k}]}");
+            where.append("</if>");
+            where.append("\n</foreach>");
+            where.append("\n</if>");
             // 过滤逻辑
-            where.append("\n" ).append(getLogicDeleteSql(table));
-            where.append("\n</where>" );
+            where.append("\n").append(getLogicDeleteSql(table));
+            where.append("\n</where>");
             return where.toString();
         }
         // 正常逻辑

+ 2 - 2
mybatis-plus-extension/src/main/java/com/baomidou/mybatisplus/extension/plugins/CachePaginationInterceptor.java

@@ -43,8 +43,8 @@ import com.baomidou.mybatisplus.core.toolkit.sql.SqlUtils;
  * @author hubin
  * @Date 2016-01-23
  */
-@Intercepts({@Signature(type = Executor.class, method = "query" , args = {MappedStatement.class, Object.class, RowBounds.class, ResultHandler.class}),
-    @Signature(type = StatementHandler.class, method = "prepare" , args = {Connection.class, Integer.class})})
+@Intercepts({@Signature(type = Executor.class, method = "query", args = {MappedStatement.class, Object.class, RowBounds.class, ResultHandler.class}),
+    @Signature(type = StatementHandler.class, method = "prepare", args = {Connection.class, Integer.class})})
 public class CachePaginationInterceptor extends PaginationInterceptor implements Interceptor {
 
     /**

+ 9 - 9
mybatis-plus-extension/src/main/java/com/baomidou/mybatisplus/extension/plugins/OptimisticLockerInterceptor.java

@@ -50,21 +50,21 @@ import com.baomidou.mybatisplus.core.toolkit.TableInfoHelper;
  * @author yuxiaobin
  * @date 2017/5/24
  */
-@Intercepts({@Signature(type = Executor.class, method = "update" , args = {MappedStatement.class, Object.class})})
+@Intercepts({@Signature(type = Executor.class, method = "update", args = {MappedStatement.class, Object.class})})
 public class OptimisticLockerInterceptor implements Interceptor {
 
     private final Map<Class<?>, EntityField> versionFieldCache = new ConcurrentHashMap<>();
     private final Map<Class<?>, List<EntityField>> entityFieldsCache = new ConcurrentHashMap<>();
 
-    private static final String MP_OPTLOCK_VERSION_ORIGINAL = "MP_OPTLOCK_VERSION_ORIGINAL" ;
-    private static final String MP_OPTLOCK_VERSION_COLUMN = "MP_OPTLOCK_VERSION_COLUMN" ;
-    public static final String MP_OPTLOCK_ET_ORIGINAL = "MP_OPTLOCK_ET_ORIGINAL" ;
-    private static final String NAME_ENTITY = "et" ;
-    private static final String NAME_ENTITY_WRAPPER = "ew" ;
-    private static final String PARAM_UPDATE_METHOD_NAME = "update" ;
+    private static final String MP_OPTLOCK_VERSION_ORIGINAL = "MP_OPTLOCK_VERSION_ORIGINAL";
+    private static final String MP_OPTLOCK_VERSION_COLUMN = "MP_OPTLOCK_VERSION_COLUMN";
+    public static final String MP_OPTLOCK_ET_ORIGINAL = "MP_OPTLOCK_ET_ORIGINAL";
+    private static final String NAME_ENTITY = "et";
+    private static final String NAME_ENTITY_WRAPPER = "ew";
+    private static final String PARAM_UPDATE_METHOD_NAME = "update";
 
     @Override
-    @SuppressWarnings("unchecked" )
+    @SuppressWarnings("unchecked")
     public Object intercept(Invocation invocation) throws Throwable {
         Object[] args = invocation.getArgs();
         MappedStatement ms = (MappedStatement) args[0];
@@ -103,7 +103,7 @@ public class OptimisticLockerInterceptor implements Interceptor {
                 }
             } else if (et != null) {
                 String methodId = ms.getId();
-                String updateMethodName = methodId.substring(ms.getId().lastIndexOf("." ) + 1);
+                String updateMethodName = methodId.substring(ms.getId().lastIndexOf(".") + 1);
                 if (PARAM_UPDATE_METHOD_NAME.equals(updateMethodName)) {//update(entityClass, null) -->> update all. ignore version
                     return invocation.proceed();
                 }

+ 11 - 11
mybatis-plus-extension/src/main/java/com/baomidou/mybatisplus/extension/plugins/PaginationInterceptor.java

@@ -58,7 +58,7 @@ import com.baomidou.mybatisplus.extension.toolkit.JdbcUtils;
  * @author hubin
  * @Date 2016-01-23
  */
-@Intercepts({@Signature(type = StatementHandler.class, method = "prepare" , args = {Connection.class, Integer.class})})
+@Intercepts({@Signature(type = StatementHandler.class, method = "prepare", args = {Connection.class, Integer.class})})
 public class PaginationInterceptor extends SqlParserHandler implements Interceptor {
 
     /**
@@ -95,11 +95,11 @@ public class PaginationInterceptor extends SqlParserHandler implements Intercept
         MetaObject metaObject = SystemMetaObject.forObject(statementHandler);
         this.sqlParser(metaObject);
         // 先判断是不是SELECT操作
-        MappedStatement mappedStatement = (MappedStatement) metaObject.getValue("delegate.mappedStatement" );
+        MappedStatement mappedStatement = (MappedStatement) metaObject.getValue("delegate.mappedStatement");
         if (!SqlCommandType.SELECT.equals(mappedStatement.getSqlCommandType())) {
             return invocation.proceed();
         }
-        RowBounds rowBounds = (RowBounds) metaObject.getValue("delegate.rowBounds" );
+        RowBounds rowBounds = (RowBounds) metaObject.getValue("delegate.rowBounds");
         /* 不需要分页的场合 */
         if (rowBounds == null || rowBounds == RowBounds.DEFAULT) {
             // 本地线程分页
@@ -115,7 +115,7 @@ public class PaginationInterceptor extends SqlParserHandler implements Intercept
             }
         }
         // 针对定义了rowBounds,做为mapper接口方法的参数
-        BoundSql boundSql = (BoundSql) metaObject.getValue("delegate.boundSql" );
+        BoundSql boundSql = (BoundSql) metaObject.getValue("delegate.boundSql");
         String originalSql = boundSql.getSql();
         Connection connection = (Connection) invocation.getArgs()[0];
         //TODO: 3.0
@@ -142,9 +142,9 @@ public class PaginationInterceptor extends SqlParserHandler implements Intercept
          * <p> 禁用内存分页 </p>
          * <p> 内存分页会查询所有结果出来处理(这个很吓人的),如果结果变化频繁这个数据还会不准。</p>
          */
-        metaObject.setValue("delegate.boundSql.sql" , originalSql);
-        metaObject.setValue("delegate.rowBounds.offset" , RowBounds.NO_ROW_OFFSET);
-        metaObject.setValue("delegate.rowBounds.limit" , RowBounds.NO_ROW_LIMIT);
+        metaObject.setValue("delegate.boundSql.sql", originalSql);
+        metaObject.setValue("delegate.rowBounds.offset", RowBounds.NO_ROW_OFFSET);
+        metaObject.setValue("delegate.rowBounds.limit", RowBounds.NO_ROW_LIMIT);
         return invocation.proceed();
     }
 
@@ -176,7 +176,7 @@ public class PaginationInterceptor extends SqlParserHandler implements Intercept
                 page.setCurrent(1);
             }
         } catch (Exception e) {
-            logger.error("Error: Method queryTotal execution error !" , e);
+            logger.error("Error: Method queryTotal execution error !", e);
         }
     }
 
@@ -190,9 +190,9 @@ public class PaginationInterceptor extends SqlParserHandler implements Intercept
 
     @Override
     public void setProperties(Properties prop) {
-        String dialectType = prop.getProperty("dialectType" );
-        String dialectClazz = prop.getProperty("dialectClazz" );
-        String localPage = prop.getProperty("localPage" );
+        String dialectType = prop.getProperty("dialectType");
+        String dialectClazz = prop.getProperty("dialectClazz");
+        String localPage = prop.getProperty("localPage");
 
         if (StringUtils.isNotEmpty(dialectType)) {
             this.dialectType = dialectType;

+ 19 - 19
mybatis-plus-extension/src/main/java/com/baomidou/mybatisplus/extension/plugins/PerformanceInterceptor.java

@@ -48,16 +48,16 @@ import com.baomidou.mybatisplus.core.toolkit.sql.SqlUtils;
  * @author hubin nieqiurong TaoYu
  * @Date 2016-07-07
  */
-@Intercepts({@Signature(type = StatementHandler.class, method = "query" , args = {Statement.class, ResultHandler.class}),
-    @Signature(type = StatementHandler.class, method = "update" , args = {Statement.class}),
-    @Signature(type = StatementHandler.class, method = "batch" , args = {Statement.class})})
+@Intercepts({@Signature(type = StatementHandler.class, method = "query", args = {Statement.class, ResultHandler.class}),
+    @Signature(type = StatementHandler.class, method = "update", args = {Statement.class}),
+    @Signature(type = StatementHandler.class, method = "batch", args = {Statement.class})})
 public class PerformanceInterceptor implements Interceptor {
 
     private static final Log logger = LogFactory.getLog(PerformanceInterceptor.class);
-    private static final String DruidPooledPreparedStatement = "com.alibaba.druid.pool.DruidPooledPreparedStatement" ;
-    private static final String T4CPreparedStatement = "oracle.jdbc.driver.T4CPreparedStatement" ;
-    private static final String OraclePreparedStatementWrapper = "oracle.jdbc.driver.OraclePreparedStatementWrapper" ;
-    private static final String HikariPreparedStatementWrapper = "com.zaxxer.hikari.pool.HikariProxyPreparedStatement" ;
+    private static final String DruidPooledPreparedStatement = "com.alibaba.druid.pool.DruidPooledPreparedStatement";
+    private static final String T4CPreparedStatement = "oracle.jdbc.driver.T4CPreparedStatement";
+    private static final String OraclePreparedStatementWrapper = "oracle.jdbc.driver.OraclePreparedStatementWrapper";
+    private static final String HikariPreparedStatementWrapper = "com.zaxxer.hikari.pool.HikariProxyPreparedStatement";
     /**
      * SQL 执行最大时长,超过自动停止运行,有助于发现问题。
      */
@@ -80,12 +80,12 @@ public class PerformanceInterceptor implements Interceptor {
         Statement statement;
         Object firstArg = invocation.getArgs()[0];
         if (Proxy.isProxyClass(firstArg.getClass())) {
-            statement = (Statement) SystemMetaObject.forObject(firstArg).getValue("h.statement" );
+            statement = (Statement) SystemMetaObject.forObject(firstArg).getValue("h.statement");
         } else {
             statement = (Statement) firstArg;
         }
         try {
-            statement = (Statement) SystemMetaObject.forObject(statement).getValue("stmt.statement" );
+            statement = (Statement) SystemMetaObject.forObject(statement).getValue("stmt.statement");
         } catch (Exception e) {
             // do nothing
         }
@@ -96,7 +96,7 @@ public class PerformanceInterceptor implements Interceptor {
             try {
                 if (druidGetSQLMethod == null) {
                     Class<?> clazz = Class.forName(DruidPooledPreparedStatement);
-                    druidGetSQLMethod = clazz.getMethod("getSql" );
+                    druidGetSQLMethod = clazz.getMethod("getSql");
                 }
                 Object stmtSql = druidGetSQLMethod.invoke(statement);
                 if (stmtSql != null && stmtSql instanceof String) {
@@ -114,7 +114,7 @@ public class PerformanceInterceptor implements Interceptor {
                     }
                 } else {
                     Class<?> clazz = Class.forName(stmtClassName);
-                    oracleGetOriginalSqlMethod = getMethodRegular(clazz, "getOriginalSql" );
+                    oracleGetOriginalSqlMethod = getMethodRegular(clazz, "getOriginalSql");
                     if (oracleGetOriginalSqlMethod != null) {
                         oracleGetOriginalSqlMethod.setAccessible(true);//OraclePreparedStatementWrapper is not a public class, need set this.
                         if (oracleGetOriginalSqlMethod != null) {
@@ -130,7 +130,7 @@ public class PerformanceInterceptor implements Interceptor {
             }
         } else if (HikariPreparedStatementWrapper.equals(stmtClassName)) {
             try {
-                Object sqlStatement = SystemMetaObject.forObject(statement).getValue("delegate.sqlStatement" );
+                Object sqlStatement = SystemMetaObject.forObject(statement).getValue("delegate.sqlStatement");
                 if (sqlStatement != null) {
                     originalSql = sqlStatement.toString();
                 }
@@ -155,11 +155,11 @@ public class PerformanceInterceptor implements Interceptor {
         // 格式化 SQL 打印执行结果
         Object target = PluginUtils.realTarget(invocation.getTarget());
         MetaObject metaObject = SystemMetaObject.forObject(target);
-        MappedStatement ms = (MappedStatement) metaObject.getValue("delegate.mappedStatement" );
+        MappedStatement ms = (MappedStatement) metaObject.getValue("delegate.mappedStatement");
         StringBuilder formatSql = new StringBuilder();
-        formatSql.append(" Time:" ).append(timing);
-        formatSql.append(" ms - ID:" ).append(ms.getId());
-        formatSql.append("\n Execute SQL:" ).append(SqlUtils.sqlFormat(originalSql, format)).append("\n" );
+        formatSql.append(" Time:").append(timing);
+        formatSql.append(" ms - ID:").append(ms.getId());
+        formatSql.append("\n Execute SQL:").append(SqlUtils.sqlFormat(originalSql, format)).append("\n");
         if (this.isWriteInLog()) {
             if (this.getMaxTime() >= 1 && timing > this.getMaxTime()) {
                 logger.error(formatSql.toString());
@@ -169,7 +169,7 @@ public class PerformanceInterceptor implements Interceptor {
         } else {
             System.err.println(formatSql.toString());
             if (this.getMaxTime() >= 1 && timing > this.getMaxTime()) {
-                throw new MybatisPlusException(" The SQL execution time is too large, please optimize ! " );
+                throw new MybatisPlusException(" The SQL execution time is too large, please optimize ! ");
             }
         }
         return result;
@@ -185,8 +185,8 @@ public class PerformanceInterceptor implements Interceptor {
 
     @Override
     public void setProperties(Properties prop) {
-        String maxTime = prop.getProperty("maxTime" );
-        String format = prop.getProperty("format" );
+        String maxTime = prop.getProperty("maxTime");
+        String format = prop.getProperty("format");
         if (StringUtils.isNotEmpty(maxTime)) {
             this.maxTime = Long.parseLong(maxTime);
         }

+ 7 - 7
mybatis-plus-extension/src/main/java/com/baomidou/mybatisplus/extension/plugins/SqlExplainInterceptor.java

@@ -49,14 +49,14 @@ import com.baomidou.mybatisplus.extension.toolkit.VersionUtils;
  * @author hubin
  * @Date 2016-08-16
  */
-@Intercepts({@Signature(type = Executor.class, method = "update" , args = {MappedStatement.class, Object.class})})
+@Intercepts({@Signature(type = Executor.class, method = "update", args = {MappedStatement.class, Object.class})})
 public class SqlExplainInterceptor implements Interceptor {
 
     private static final Log logger = LogFactory.getLog(SqlExplainInterceptor.class);
     /**
      * Mysql支持分析SQL的最小版本
      */
-    private final String minMySQLVersion = "5.6.3" ;
+    private final String minMySQLVersion = "5.6.3";
     /**
      * 发现执行全表 delete update 语句是否停止执行
      */
@@ -77,7 +77,7 @@ public class SqlExplainInterceptor implements Interceptor {
             String databaseVersion = connection.getMetaData().getDatabaseProductVersion();
             if (GlobalConfigUtils.getDbType(configuration).equals(DBType.MYSQL)
                 && VersionUtils.compare(minMySQLVersion, databaseVersion)) {
-                logger.warn("Warn: Your mysql version needs to be greater than '5.6.3' to execute of Sql Explain!" );
+                logger.warn("Warn: Your mysql version needs to be greater than '5.6.3' to execute of Sql Explain!");
                 return invocation.proceed();
             }
             /**
@@ -103,11 +103,11 @@ public class SqlExplainInterceptor implements Interceptor {
      */
     protected void sqlExplain(Configuration configuration, MappedStatement mappedStatement, BoundSql boundSql,
                               Connection connection, Object parameter) {
-        StringBuilder explain = new StringBuilder("EXPLAIN " );
+        StringBuilder explain = new StringBuilder("EXPLAIN ");
         explain.append(boundSql.getSql());
         String sqlExplain = explain.toString();
         StaticSqlSource sqlsource = new StaticSqlSource(configuration, sqlExplain, boundSql.getParameterMappings());
-        MappedStatement.Builder builder = new MappedStatement.Builder(configuration, "explain_sql" , sqlsource,
+        MappedStatement.Builder builder = new MappedStatement.Builder(configuration, "explain_sql", sqlsource,
             SqlCommandType.SELECT);
         builder.resultMaps(mappedStatement.getResultMaps()).resultSetType(mappedStatement.getResultSetType())
             .statementType(mappedStatement.getStatementType());
@@ -117,7 +117,7 @@ public class SqlExplainInterceptor implements Interceptor {
             handler.setParameters(stmt);
             try (ResultSet rs = stmt.executeQuery()) {
                 while (rs.next()) {
-                    if (!"Using where".equals(rs.getString("Extra" ))) {
+                    if (!"Using where".equals(rs.getString("Extra"))) {
                         if (this.isStopProceed()) {
                             throw new MybatisPlusException("Error: Full table operation is prohibited. SQL: " + boundSql.getSql());
                         }
@@ -142,7 +142,7 @@ public class SqlExplainInterceptor implements Interceptor {
 
     @Override
     public void setProperties(Properties prop) {
-        String stopProceed = prop.getProperty("stopProceed" );
+        String stopProceed = prop.getProperty("stopProceed");
         if (StringUtils.isNotEmpty(stopProceed)) {
             this.stopProceed = Boolean.valueOf(stopProceed);
         }

+ 2 - 2
mybatis-plus-extension/src/main/java/com/baomidou/mybatisplus/extension/plugins/pagination/DialectFactory.java

@@ -99,14 +99,14 @@ public class DialectFactory {
                     dialect = (IDialect) clazz.newInstance();
                 }
             } catch (ClassNotFoundException e) {
-                throw new MybatisPlusException("Class :" + dialectClazz + " is not found" );
+                throw new MybatisPlusException("Class :" + dialectClazz + " is not found");
             }
         } else if (null != dbType) {
             dialect = getDialectByDbType(dbType);
         }
         /* 未配置方言则抛出异常 */
         if (dialect == null) {
-            throw new MybatisPlusException("The value of the dialect property in mybatis configuration.xml is not defined." );
+            throw new MybatisPlusException("The value of the dialect property in mybatis configuration.xml is not defined.");
         }
         return dialect;
     }

+ 10 - 10
mybatis-plus-extension/src/main/java/com/baomidou/mybatisplus/extension/plugins/pagination/dialects/DB2Dialect.java

@@ -31,38 +31,38 @@ public class DB2Dialect implements IDialect {
     public static final DB2Dialect INSTANCE = new DB2Dialect();
 
     private static String getRowNumber(String originalSql) {
-        StringBuilder rownumber = new StringBuilder(50).append("rownumber() over(" );
-        int orderByIndex = originalSql.toLowerCase().indexOf("order by" );
+        StringBuilder rownumber = new StringBuilder(50).append("rownumber() over(");
+        int orderByIndex = originalSql.toLowerCase().indexOf("order by");
         if (orderByIndex > 0 && !hasDistinct(originalSql)) {
             rownumber.append(originalSql.substring(orderByIndex));
         }
-        rownumber.append(") as rownumber_," );
+        rownumber.append(") as rownumber_,");
         return rownumber.toString();
     }
 
     private static boolean hasDistinct(String originalSql) {
-        return originalSql.toLowerCase().contains("select distinct" );
+        return originalSql.toLowerCase().contains("select distinct");
     }
 
     @Override
     public String buildPaginationSql(String originalSql, int offset, int limit) {
-        int startOfSelect = originalSql.toLowerCase().indexOf("select" );
+        int startOfSelect = originalSql.toLowerCase().indexOf("select");
         StringBuilder pagingSelect = new StringBuilder(originalSql.length() + 100)
-            .append(originalSql.substring(0, startOfSelect)).append("select * from ( select " )
+            .append(originalSql.substring(0, startOfSelect)).append("select * from ( select ")
             .append(getRowNumber(originalSql));
         if (hasDistinct(originalSql)) {
-            pagingSelect.append(" row_.* from ( " ).append(originalSql.substring(startOfSelect)).append(" ) as row_" );
+            pagingSelect.append(" row_.* from ( ").append(originalSql.substring(startOfSelect)).append(" ) as row_");
         } else {
             pagingSelect.append(originalSql.substring(startOfSelect + 6));
         }
-        pagingSelect.append(" ) as temp_ where rownumber_ " );
+        pagingSelect.append(" ) as temp_ where rownumber_ ");
 
         // add the restriction to the outer select
         if (offset > 0) {
             String endString = offset + "+" + limit;
-            pagingSelect.append("between " ).append(offset).append("+1 and " ).append(endString);
+            pagingSelect.append("between ").append(offset).append("+1 and ").append(endString);
         } else {
-            pagingSelect.append("<= " ).append(limit);
+            pagingSelect.append("<= ").append(limit);
         }
         return pagingSelect.toString();
     }

+ 2 - 2
mybatis-plus-extension/src/main/java/com/baomidou/mybatisplus/extension/plugins/pagination/dialects/H2Dialect.java

@@ -33,9 +33,9 @@ public class H2Dialect implements IDialect {
     @Override
     public String buildPaginationSql(String originalSql, int offset, int limit) {
         StringBuilder sql = new StringBuilder(originalSql);
-        sql.append(" limit " ).append(limit);
+        sql.append(" limit ").append(limit);
         if (offset > 0) {
-            sql.append(" offset " ).append(offset);
+            sql.append(" offset ").append(offset);
         }
         return sql.toString();
     }

+ 1 - 1
mybatis-plus-extension/src/main/java/com/baomidou/mybatisplus/extension/plugins/pagination/dialects/HSQLDialect.java

@@ -33,7 +33,7 @@ public class HSQLDialect implements IDialect {
     @Override
     public String buildPaginationSql(String originalSql, int offset, int limit) {
         StringBuilder sql = new StringBuilder(originalSql);
-        sql.append(" limit " ).append(offset).append("," ).append(limit);
+        sql.append(" limit ").append(offset).append(",").append(limit);
         return sql.toString();
     }
 }

+ 1 - 1
mybatis-plus-extension/src/main/java/com/baomidou/mybatisplus/extension/plugins/pagination/dialects/MySqlDialect.java

@@ -33,7 +33,7 @@ public class MySqlDialect implements IDialect {
     @Override
     public String buildPaginationSql(String originalSql, int offset, int limit) {
         StringBuilder sql = new StringBuilder(originalSql);
-        sql.append(" LIMIT " ).append(offset).append("," ).append(limit);
+        sql.append(" LIMIT ").append(offset).append(",").append(limit);
         return sql.toString();
     }
 }

+ 3 - 3
mybatis-plus-extension/src/main/java/com/baomidou/mybatisplus/extension/plugins/pagination/dialects/OracleDialect.java

@@ -33,9 +33,9 @@ public class OracleDialect implements IDialect {
     @Override
     public String buildPaginationSql(String originalSql, int offset, int limit) {
         StringBuilder sql = new StringBuilder();
-        sql.append("SELECT * FROM ( SELECT TMP.*, ROWNUM ROW_ID FROM ( " );
-        sql.append(originalSql).append(" ) TMP WHERE ROWNUM <=" ).append((offset >= 1) ? (offset + limit) : limit);
-        sql.append(") WHERE ROW_ID > " ).append(offset);
+        sql.append("SELECT * FROM ( SELECT TMP.*, ROWNUM ROW_ID FROM ( ");
+        sql.append(originalSql).append(" ) TMP WHERE ROWNUM <=").append((offset >= 1) ? (offset + limit) : limit);
+        sql.append(") WHERE ROW_ID > ").append(offset);
         return sql.toString();
     }
 }

+ 1 - 1
mybatis-plus-extension/src/main/java/com/baomidou/mybatisplus/extension/plugins/pagination/dialects/PostgreDialect.java

@@ -33,7 +33,7 @@ public class PostgreDialect implements IDialect {
     @Override
     public String buildPaginationSql(String originalSql, int offset, int limit) {
         StringBuilder sql = new StringBuilder(originalSql);
-        sql.append(" limit " ).append(limit).append(" offset " ).append(offset);
+        sql.append(" limit ").append(limit).append(" offset ").append(offset);
         return sql.toString();
     }
 }

+ 12 - 12
mybatis-plus-extension/src/main/java/com/baomidou/mybatisplus/extension/plugins/pagination/dialects/SQLServer2005Dialect.java

@@ -33,11 +33,11 @@ public class SQLServer2005Dialect implements IDialect {
 
     private static String getOrderByPart(String sql) {
         String loweredString = sql.toLowerCase();
-        int orderByIndex = loweredString.indexOf("order by" );
+        int orderByIndex = loweredString.indexOf("order by");
         if (orderByIndex != -1) {
             return sql.substring(orderByIndex);
         } else {
-            return "" ;
+            return "";
         }
     }
 
@@ -45,14 +45,14 @@ public class SQLServer2005Dialect implements IDialect {
     public String buildPaginationSql(String originalSql, int offset, int limit) {
         StringBuilder pagingBuilder = new StringBuilder();
         String orderby = getOrderByPart(originalSql);
-        String distinctStr = "" ;
+        String distinctStr = "";
 
         String loweredString = originalSql.toLowerCase();
         String sqlPartString = originalSql;
-        if (loweredString.trim().startsWith("select" )) {
+        if (loweredString.trim().startsWith("select")) {
             int index = 6;
-            if (loweredString.startsWith("select distinct" )) {
-                distinctStr = "DISTINCT " ;
+            if (loweredString.startsWith("select distinct")) {
+                distinctStr = "DISTINCT ";
                 index = 15;
             }
             sqlPartString = sqlPartString.substring(index);
@@ -61,17 +61,17 @@ public class SQLServer2005Dialect implements IDialect {
 
         // if no ORDER BY is specified use fake ORDER BY field to avoid errors
         if (StringUtils.isEmpty(orderby)) {
-            orderby = "ORDER BY CURRENT_TIMESTAMP" ;
+            orderby = "ORDER BY CURRENT_TIMESTAMP";
         }
 
         StringBuilder sql = new StringBuilder();
-        sql.append("WITH query AS (SELECT " ).append(distinctStr).append("TOP 100 PERCENT " )
-            .append(" ROW_NUMBER() OVER (" ).append(orderby).append(") as __row_number__, " ).append(pagingBuilder)
-            .append(") SELECT * FROM query WHERE __row_number__ BETWEEN " )
+        sql.append("WITH query AS (SELECT ").append(distinctStr).append("TOP 100 PERCENT ")
+            .append(" ROW_NUMBER() OVER (").append(orderby).append(") as __row_number__, ").append(pagingBuilder)
+            .append(") SELECT * FROM query WHERE __row_number__ BETWEEN ")
             //FIX#299:原因:mysql中limit 10(offset,size) 是从第10开始(不包含10),;而这里用的BETWEEN是两边都包含,所以改为offset+1
             .append(offset + 1)
-            .append(" AND " )
-            .append(offset + limit).append(" ORDER BY __row_number__" );
+            .append(" AND ")
+            .append(offset + limit).append(" ORDER BY __row_number__");
         return sql.toString();
     }
 }

+ 2 - 2
mybatis-plus-extension/src/main/java/com/baomidou/mybatisplus/extension/plugins/pagination/dialects/SQLServerDialect.java

@@ -33,8 +33,8 @@ public class SQLServerDialect implements IDialect {
     @Override
     public String buildPaginationSql(String originalSql, int offset, int limit) {
         StringBuilder sql = new StringBuilder(originalSql);
-        sql.append(" OFFSET " ).append(offset).append(" ROWS FETCH NEXT " );
-        sql.append(limit).append(" ROWS ONLY" );
+        sql.append(" OFFSET ").append(offset).append(" ROWS FETCH NEXT ");
+        sql.append(limit).append(" ROWS ONLY");
         return sql.toString();
     }
 }

+ 1 - 1
mybatis-plus-extension/src/main/java/com/baomidou/mybatisplus/extension/plugins/pagination/dialects/SQLiteDialect.java

@@ -33,7 +33,7 @@ public class SQLiteDialect implements IDialect {
     @Override
     public String buildPaginationSql(String originalSql, int offset, int limit) {
         StringBuilder sql = new StringBuilder(originalSql);
-        sql.append(" limit " ).append(limit).append(" offset " ).append(offset);
+        sql.append(" limit ").append(limit).append(" offset ").append(offset);
         return sql.toString();
     }
 }

+ 2 - 2
mybatis-plus-extension/src/main/java/com/baomidou/mybatisplus/extension/plugins/pagination/optimize/JsqlParserCountOptimize.java

@@ -75,7 +75,7 @@ public class JsqlParserCountOptimize implements ISqlParser {
             }
             //#95 Github, selectItems contains #{} ${}, which will be translated to ?, and it may be in a function: power(#{myInt},2)
             for (SelectItem item : plainSelect.getSelectItems()) {
-                if (item.toString().contains("?" )) {
+                if (item.toString().contains("?")) {
                     sqlInfo.setSql(SqlUtils.getOriginalCountSql(selectStatement.toString()));
                     return sqlInfo;
                 }
@@ -104,7 +104,7 @@ public class JsqlParserCountOptimize implements ISqlParser {
      */
     private static List<SelectItem> countSelectItem() {
         Function function = new Function();
-        function.setName("COUNT" );
+        function.setName("COUNT");
         List<Expression> expressions = new ArrayList<>();
         LongValue longValue = new LongValue(1);
         ExpressionList expressionList = new ExpressionList();

+ 4 - 4
mybatis-plus-extension/src/main/java/com/baomidou/mybatisplus/extension/plugins/tenant/TenantSqlParser.java

@@ -94,7 +94,7 @@ public class TenantSqlParser extends AbstractJsqlParser {
         } else if (insert.getItemsList() != null) {
             ((ExpressionList) insert.getItemsList()).getExpressions().add(tenantHandler.getTenantId());
         } else {
-            throw new MybatisPlusException("Failed to process multiple-table update, please exclude the tableName or statementId" );
+            throw new MybatisPlusException("Failed to process multiple-table update, please exclude the tableName or statementId");
         }
     }
 
@@ -107,7 +107,7 @@ public class TenantSqlParser extends AbstractJsqlParser {
     public void processUpdate(Update update) {
         List<Table> tableList = update.getTables();
         if (null == tableList || tableList.size() >= 2) {
-            throw new MybatisPlusException("Failed to process multiple-table update, please exclude the statementId" );
+            throw new MybatisPlusException("Failed to process multiple-table update, please exclude the statementId");
         }
         Table table = tableList.get(0);
         if (this.tenantHandler.doTableFilter(table.getName())) {
@@ -208,7 +208,7 @@ public class TenantSqlParser extends AbstractJsqlParser {
                 processSelectBody(subSelect.getSelectBody());
             }
         } else if (fromItem instanceof ValuesList) {
-            logger.debug("Perform a subquery, if you do not give us feedback" );
+            logger.debug("Perform a subquery, if you do not give us feedback");
         } else if (fromItem instanceof LateralSubSelect) {
             LateralSubSelect lateralSubSelect = (LateralSubSelect) fromItem;
             if (lateralSubSelect.getSubSelect() != null) {
@@ -273,7 +273,7 @@ public class TenantSqlParser extends AbstractJsqlParser {
         }
         StringBuilder column = new StringBuilder();
         column.append(table.getAlias().getName());
-        column.append("." );
+        column.append(".");
         column.append(this.tenantHandler.getTenantIdColumn());
         return new Column(column.toString());
     }

+ 2 - 2
mybatis-plus-extension/src/main/java/com/baomidou/mybatisplus/extension/service/IService.java

@@ -291,7 +291,7 @@ public interface IService<T> {
      * </p>
      *
      * @param wrapper {@link Wrapper}
-     * @return Map<String , Object>
+     * @return Map<String   ,   Object>
      */
     Map<String, Object> selectMap(Wrapper<T> wrapper);
 
@@ -364,7 +364,7 @@ public interface IService<T> {
      * @param wrapper {@link Wrapper}
      * @return
      */
-    @SuppressWarnings("rawtypes" )
+    @SuppressWarnings("rawtypes")
     Page<Map<String, Object>> selectMapsPage(Page page, Wrapper<T> wrapper);
 
     /**

+ 11 - 11
mybatis-plus-extension/src/main/java/com/baomidou/mybatisplus/extension/service/impl/ServiceImpl.java

@@ -67,7 +67,7 @@ public class ServiceImpl<M extends BaseMapper<T>, T> implements IService<T> {
         return SqlHelper.retBool(result);
     }
 
-    @SuppressWarnings("unchecked" )
+    @SuppressWarnings("unchecked")
     protected Class<T> currentModelClass() {
         return ReflectionKit.getSuperClassGenricType(getClass(), 1);
     }
@@ -120,7 +120,7 @@ public class ServiceImpl<M extends BaseMapper<T>, T> implements IService<T> {
     @Override
     public boolean insertBatch(List<T> entityList, int batchSize) {
         if (CollectionUtils.isEmpty(entityList)) {
-            throw new IllegalArgumentException("Error: entityList must not be empty" );
+            throw new IllegalArgumentException("Error: entityList must not be empty");
         }
         try (SqlSession batchSqlSession = sqlSessionBatch()) {
             int size = entityList.size();
@@ -133,7 +133,7 @@ public class ServiceImpl<M extends BaseMapper<T>, T> implements IService<T> {
             }
             batchSqlSession.flushStatements();
         } catch (Throwable e) {
-            throw new MybatisPlusException("Error: Cannot execute insertBatch Method. Cause" , e);
+            throw new MybatisPlusException("Error: Cannot execute insertBatch Method. Cause", e);
         }
         return true;
     }
@@ -163,7 +163,7 @@ public class ServiceImpl<M extends BaseMapper<T>, T> implements IService<T> {
                     return updateById(entity) || insert(entity);
                 }
             } else {
-                throw new MybatisPlusException("Error:  Can not execute. Could not find @TableId." );
+                throw new MybatisPlusException("Error:  Can not execute. Could not find @TableId.");
             }
         }
         return false;
@@ -186,7 +186,7 @@ public class ServiceImpl<M extends BaseMapper<T>, T> implements IService<T> {
                     return updateAllColumnById(entity) || insertAllColumn(entity);
                 }
             } else {
-                throw new MybatisPlusException("Error:  Can not execute. Could not find @TableId." );
+                throw new MybatisPlusException("Error:  Can not execute. Could not find @TableId.");
             }
         }
         return false;
@@ -226,7 +226,7 @@ public class ServiceImpl<M extends BaseMapper<T>, T> implements IService<T> {
      */
     private boolean insertOrUpdateBatch(List<T> entityList, int batchSize, boolean selective) {
         if (CollectionUtils.isEmpty(entityList)) {
-            throw new IllegalArgumentException("Error: entityList must not be empty" );
+            throw new IllegalArgumentException("Error: entityList must not be empty");
         }
         try (SqlSession batchSqlSession = sqlSessionBatch()) {
             int size = entityList.size();
@@ -242,7 +242,7 @@ public class ServiceImpl<M extends BaseMapper<T>, T> implements IService<T> {
             }
             batchSqlSession.flushStatements();
         } catch (Throwable e) {
-            throw new MybatisPlusException("Error: Cannot execute insertOrUpdateBatch Method. Cause" , e);
+            throw new MybatisPlusException("Error: Cannot execute insertOrUpdateBatch Method. Cause", e);
         }
         return true;
     }
@@ -257,7 +257,7 @@ public class ServiceImpl<M extends BaseMapper<T>, T> implements IService<T> {
     @Override
     public boolean deleteByMap(Map<String, Object> columnMap) {
         if (MapUtils.isEmpty(columnMap)) {
-            throw new MybatisPlusException("deleteByMap columnMap is empty." );
+            throw new MybatisPlusException("deleteByMap columnMap is empty.");
         }
         return SqlHelper.delBool(baseMapper.deleteByMap(columnMap));
     }
@@ -326,7 +326,7 @@ public class ServiceImpl<M extends BaseMapper<T>, T> implements IService<T> {
      */
     private boolean updateBatchById(List<T> entityList, int batchSize, boolean selective) {
         if (CollectionUtils.isEmpty(entityList)) {
-            throw new IllegalArgumentException("Error: entityList must not be empty" );
+            throw new IllegalArgumentException("Error: entityList must not be empty");
         }
         try (SqlSession batchSqlSession = sqlSessionBatch()) {
             int size = entityList.size();
@@ -334,7 +334,7 @@ public class ServiceImpl<M extends BaseMapper<T>, T> implements IService<T> {
             String sqlStatement = sqlStatement(sqlMethod);
             for (int i = 0; i < size; i++) {
                 MapperMethod.ParamMap<T> param = new MapperMethod.ParamMap<>();
-                param.put("et" , entityList.get(i));
+                param.put("et", entityList.get(i));
                 batchSqlSession.update(sqlStatement, param);
                 if (i >= 1 && i % batchSize == 0) {
                     batchSqlSession.flushStatements();
@@ -342,7 +342,7 @@ public class ServiceImpl<M extends BaseMapper<T>, T> implements IService<T> {
             }
             batchSqlSession.flushStatements();
         } catch (Throwable e) {
-            throw new MybatisPlusException("Error: Cannot execute updateBatchById Method. Cause" , e);
+            throw new MybatisPlusException("Error: Cannot execute updateBatchById Method. Cause", e);
         }
         return true;
     }

+ 19 - 19
mybatis-plus-extension/src/main/java/com/baomidou/mybatisplus/extension/spring/MybatisMapperRefresh.java

@@ -178,7 +178,7 @@ public class MybatisMapperRefresh implements Runnable {
 
                     } while (true);
                 }
-            }, "mybatis-plus MapperRefresh" ).start();
+            }, "mybatis-plus MapperRefresh").start();
         }
     }
 
@@ -187,34 +187,34 @@ public class MybatisMapperRefresh implements Runnable {
      *
      * @throws Exception
      */
-    @SuppressWarnings("rawtypes" )
+    @SuppressWarnings("rawtypes")
     private void refresh(Resource resource) throws ClassNotFoundException, NoSuchFieldException, IllegalAccessException {
         this.configuration = sqlSessionFactory.getConfiguration();
         boolean isSupper = configuration.getClass().getSuperclass() == Configuration.class;
         try {
-            Field loadedResourcesField = isSupper ? configuration.getClass().getSuperclass().getDeclaredField("loadedResources" )
-                : configuration.getClass().getDeclaredField("loadedResources" );
+            Field loadedResourcesField = isSupper ? configuration.getClass().getSuperclass().getDeclaredField("loadedResources")
+                : configuration.getClass().getDeclaredField("loadedResources");
             loadedResourcesField.setAccessible(true);
             Set loadedResourcesSet = ((Set) loadedResourcesField.get(configuration));
             XPathParser xPathParser = new XPathParser(resource.getInputStream(), true, configuration.getVariables(),
                 new XMLMapperEntityResolver());
-            XNode context = xPathParser.evalNode("/mapper" );
-            String namespace = context.getStringAttribute("namespace" );
-            Field field = MapperRegistry.class.getDeclaredField("knownMappers" );
+            XNode context = xPathParser.evalNode("/mapper");
+            String namespace = context.getStringAttribute("namespace");
+            Field field = MapperRegistry.class.getDeclaredField("knownMappers");
             field.setAccessible(true);
             Map mapConfig = (Map) field.get(configuration.getMapperRegistry());
             mapConfig.remove(Resources.classForName(namespace));
             loadedResourcesSet.remove(resource.toString());
             configuration.getCacheNames().remove(namespace);
-            cleanParameterMap(context.evalNodes("/mapper/parameterMap" ), namespace);
-            cleanResultMap(context.evalNodes("/mapper/resultMap" ), namespace);
-            cleanKeyGenerators(context.evalNodes("insert|update" ), namespace);
-            cleanSqlElement(context.evalNodes("/mapper/sql" ), namespace);
+            cleanParameterMap(context.evalNodes("/mapper/parameterMap"), namespace);
+            cleanResultMap(context.evalNodes("/mapper/resultMap"), namespace);
+            cleanKeyGenerators(context.evalNodes("insert|update"), namespace);
+            cleanSqlElement(context.evalNodes("/mapper/sql"), namespace);
             XMLMapperBuilder xmlMapperBuilder = new XMLMapperBuilder(resource.getInputStream(),
                 sqlSessionFactory.getConfiguration(),
                 resource.toString(), sqlSessionFactory.getConfiguration().getSqlFragments());
             xmlMapperBuilder.parse();
-            logger.debug("refresh: '" + resource + "', success!" );
+            logger.debug("refresh: '" + resource + "', success!");
         } catch (IOException e) {
             logger.error("Refresh IOException :" + e.getMessage());
         } finally {
@@ -230,7 +230,7 @@ public class MybatisMapperRefresh implements Runnable {
      */
     private void cleanParameterMap(List<XNode> list, String namespace) {
         for (XNode parameterMapNode : list) {
-            String id = parameterMapNode.getStringAttribute("id" );
+            String id = parameterMapNode.getStringAttribute("id");
             configuration.getParameterMaps().remove(namespace + "." + id);
         }
     }
@@ -243,7 +243,7 @@ public class MybatisMapperRefresh implements Runnable {
      */
     private void cleanResultMap(List<XNode> list, String namespace) {
         for (XNode resultMapNode : list) {
-            String id = resultMapNode.getStringAttribute("id" , resultMapNode.getValueBasedIdentifier());
+            String id = resultMapNode.getStringAttribute("id", resultMapNode.getValueBasedIdentifier());
             configuration.getResultMapNames().remove(id);
             configuration.getResultMapNames().remove(namespace + "." + id);
             clearResultMap(resultMapNode, namespace);
@@ -254,11 +254,11 @@ public class MybatisMapperRefresh implements Runnable {
         for (XNode resultChild : xNode.getChildren()) {
             if ("association".equals(resultChild.getName()) || "collection".equals(resultChild.getName())
                 || "case".equals(resultChild.getName())) {
-                if (resultChild.getStringAttribute("select" ) == null) {
+                if (resultChild.getStringAttribute("select") == null) {
                     configuration.getResultMapNames().remove(
-                        resultChild.getStringAttribute("id" , resultChild.getValueBasedIdentifier()));
+                        resultChild.getStringAttribute("id", resultChild.getValueBasedIdentifier()));
                     configuration.getResultMapNames().remove(
-                        namespace + "." + resultChild.getStringAttribute("id" , resultChild.getValueBasedIdentifier()));
+                        namespace + "." + resultChild.getStringAttribute("id", resultChild.getValueBasedIdentifier()));
                     if (resultChild.getChildren() != null && !resultChild.getChildren().isEmpty()) {
                         clearResultMap(resultChild, namespace);
                     }
@@ -275,7 +275,7 @@ public class MybatisMapperRefresh implements Runnable {
      */
     private void cleanKeyGenerators(List<XNode> list, String namespace) {
         for (XNode context : list) {
-            String id = context.getStringAttribute("id" );
+            String id = context.getStringAttribute("id");
             configuration.getKeyGeneratorNames().remove(id + SelectKeyGenerator.SELECT_KEY_SUFFIX);
             configuration.getKeyGeneratorNames().remove(namespace + "." + id + SelectKeyGenerator.SELECT_KEY_SUFFIX);
         }
@@ -289,7 +289,7 @@ public class MybatisMapperRefresh implements Runnable {
      */
     private void cleanSqlElement(List<XNode> list, String namespace) {
         for (XNode context : list) {
-            String id = context.getStringAttribute("id" );
+            String id = context.getStringAttribute("id");
             configuration.getSqlFragments().remove(id);
             configuration.getSqlFragments().remove(namespace + "." + id);
         }

+ 18 - 18
mybatis-plus-extension/src/main/java/com/baomidou/mybatisplus/extension/spring/MybatisSqlSessionFactoryBean.java

@@ -379,10 +379,10 @@ public class MybatisSqlSessionFactoryBean implements FactoryBean<SqlSessionFacto
      */
     @Override
     public void afterPropertiesSet() throws Exception {
-        notNull(dataSource, "Property 'dataSource' is required" );
-        notNull(sqlSessionFactoryBuilder, "Property 'sqlSessionFactoryBuilder' is required" );
+        notNull(dataSource, "Property 'dataSource' is required");
+        notNull(sqlSessionFactoryBuilder, "Property 'sqlSessionFactoryBuilder' is required");
         state((configuration == null && configLocation == null) || !(configuration != null && configLocation != null),
-            "Property 'configuration' and 'configLocation' can not specified with together" );
+            "Property 'configuration' and 'configLocation' can not specified with together");
 
         this.sqlSessionFactory = buildSqlSessionFactory();
         //TODO: 3.0 注入到globalConfig
@@ -416,7 +416,7 @@ public class MybatisSqlSessionFactoryBean implements FactoryBean<SqlSessionFacto
             configuration = xmlConfigBuilder.getConfiguration();
         } else {
             if (LOGGER.isDebugEnabled()) {
-                LOGGER.debug("Property 'configuration' or 'configLocation' not specified, using default MyBatis Configuration" );
+                LOGGER.debug("Property 'configuration' or 'configLocation' not specified, using default MyBatis Configuration");
             }
             // TODO 使用自定义配置
             configuration = new MybatisConfiguration();
@@ -440,8 +440,8 @@ public class MybatisSqlSessionFactoryBean implements FactoryBean<SqlSessionFacto
         if (hasLength(this.typeAliasesPackage)) {
             // TODO 支持自定义通配符
             String[] typeAliasPackageArray;
-            if (typeAliasesPackage.contains("*" ) && !typeAliasesPackage.contains("," )
-                && !typeAliasesPackage.contains(";" )) {
+            if (typeAliasesPackage.contains("*") && !typeAliasesPackage.contains(",")
+                && !typeAliasesPackage.contains(";")) {
                 typeAliasPackageArray = PackageHelper.convertTypeAliasesPackage(typeAliasesPackage);
             } else {
                 typeAliasPackageArray = tokenizeToStringArray(this.typeAliasesPackage,
@@ -454,7 +454,7 @@ public class MybatisSqlSessionFactoryBean implements FactoryBean<SqlSessionFacto
                 configuration.getTypeAliasRegistry().registerAliases(packageToScan,
                     typeAliasesSuperType == null ? Object.class : typeAliasesSuperType);
                 if (LOGGER.isDebugEnabled()) {
-                    LOGGER.debug("Scanned package: '" + packageToScan + "' for aliases" );
+                    LOGGER.debug("Scanned package: '" + packageToScan + "' for aliases");
                 }
             }
         }
@@ -462,8 +462,8 @@ public class MybatisSqlSessionFactoryBean implements FactoryBean<SqlSessionFacto
         // TODO 自定义枚举类扫描处理
         if (hasLength(this.typeEnumsPackage)) {
             Set<Class> classes = null;
-            if (typeEnumsPackage.contains("*" ) && !typeEnumsPackage.contains("," )
-                && !typeEnumsPackage.contains(";" )) {
+            if (typeEnumsPackage.contains("*") && !typeEnumsPackage.contains(",")
+                && !typeEnumsPackage.contains(";")) {
                 classes = PackageHelper.scanTypePackage(typeEnumsPackage);
             } else {
                 String[] typeEnumsPackageArray = tokenizeToStringArray(this.typeEnumsPackage,
@@ -494,7 +494,7 @@ public class MybatisSqlSessionFactoryBean implements FactoryBean<SqlSessionFacto
             for (Class<?> typeAlias : this.typeAliases) {
                 configuration.getTypeAliasRegistry().registerAlias(typeAlias);
                 if (LOGGER.isDebugEnabled()) {
-                    LOGGER.debug("Registered type alias: '" + typeAlias + "'" );
+                    LOGGER.debug("Registered type alias: '" + typeAlias + "'");
                 }
             }
         }
@@ -503,7 +503,7 @@ public class MybatisSqlSessionFactoryBean implements FactoryBean<SqlSessionFacto
             for (Interceptor plugin : this.plugins) {
                 configuration.addInterceptor(plugin);
                 if (LOGGER.isDebugEnabled()) {
-                    LOGGER.debug("Registered plugin: '" + plugin + "'" );
+                    LOGGER.debug("Registered plugin: '" + plugin + "'");
                 }
             }
         }
@@ -514,7 +514,7 @@ public class MybatisSqlSessionFactoryBean implements FactoryBean<SqlSessionFacto
             for (String packageToScan : typeHandlersPackageArray) {
                 configuration.getTypeHandlerRegistry().register(packageToScan);
                 if (LOGGER.isDebugEnabled()) {
-                    LOGGER.debug("Scanned package: '" + packageToScan + "' for type handlers" );
+                    LOGGER.debug("Scanned package: '" + packageToScan + "' for type handlers");
                 }
             }
         }
@@ -523,7 +523,7 @@ public class MybatisSqlSessionFactoryBean implements FactoryBean<SqlSessionFacto
             for (TypeHandler<?> typeHandler : this.typeHandlers) {
                 configuration.getTypeHandlerRegistry().register(typeHandler);
                 if (LOGGER.isDebugEnabled()) {
-                    LOGGER.debug("Registered type handler: '" + typeHandler + "'" );
+                    LOGGER.debug("Registered type handler: '" + typeHandler + "'");
                 }
             }
         }
@@ -532,7 +532,7 @@ public class MybatisSqlSessionFactoryBean implements FactoryBean<SqlSessionFacto
             try {
                 configuration.setDatabaseId(this.databaseIdProvider.getDatabaseId(this.dataSource));
             } catch (SQLException e) {
-                throw new NestedIOException("Failed getting a databaseId" , e);
+                throw new NestedIOException("Failed getting a databaseId", e);
             }
         }
 
@@ -545,7 +545,7 @@ public class MybatisSqlSessionFactoryBean implements FactoryBean<SqlSessionFacto
                 xmlConfigBuilder.parse();
 
                 if (LOGGER.isDebugEnabled()) {
-                    LOGGER.debug("Parsed configuration file: '" + this.configLocation + "'" );
+                    LOGGER.debug("Parsed configuration file: '" + this.configLocation + "'");
                 }
             } catch (Exception ex) {
                 throw new NestedIOException("Failed to parse config resource: " + this.configLocation, ex);
@@ -592,18 +592,18 @@ public class MybatisSqlSessionFactoryBean implements FactoryBean<SqlSessionFacto
                         configuration, mapperLocation.toString(), configuration.getSqlFragments());
                     xmlMapperBuilder.parse();
                 } catch (Exception e) {
-                    throw new NestedIOException("Failed to parse mapping resource: '" + mapperLocation + "'" , e);
+                    throw new NestedIOException("Failed to parse mapping resource: '" + mapperLocation + "'", e);
                 } finally {
                     ErrorContext.instance().reset();
                 }
 
                 if (LOGGER.isDebugEnabled()) {
-                    LOGGER.debug("Parsed mapper file: '" + mapperLocation + "'" );
+                    LOGGER.debug("Parsed mapper file: '" + mapperLocation + "'");
                 }
             }
         } else {
             if (LOGGER.isDebugEnabled()) {
-                LOGGER.debug("Property 'mapperLocations' was not specified or no matching resources found" );
+                LOGGER.debug("Property 'mapperLocations' was not specified or no matching resources found");
             }
         }
         return sqlSessionFactory;

+ 12 - 12
mybatis-plus-extension/src/main/java/com/baomidou/mybatisplus/extension/toolkit/JdbcUtils.java

@@ -45,29 +45,29 @@ public class JdbcUtils {
      */
     public static IDBType getDbType(String jdbcUrl) {
         if (StringUtils.isEmpty(jdbcUrl)) {
-            throw new MybatisPlusException("Error: The jdbcUrl is Null, Cannot read database type" );
+            throw new MybatisPlusException("Error: The jdbcUrl is Null, Cannot read database type");
         }
-        if (jdbcUrl.startsWith("jdbc:mysql:" ) || jdbcUrl.startsWith("jdbc:cobar:" )
-            || jdbcUrl.startsWith("jdbc:log4jdbc:mysql:" )) {
+        if (jdbcUrl.startsWith("jdbc:mysql:") || jdbcUrl.startsWith("jdbc:cobar:")
+            || jdbcUrl.startsWith("jdbc:log4jdbc:mysql:")) {
             return DBType.MYSQL;
-        } else if (jdbcUrl.startsWith("jdbc:oracle:" ) || jdbcUrl.startsWith("jdbc:log4jdbc:oracle:" )) {
+        } else if (jdbcUrl.startsWith("jdbc:oracle:") || jdbcUrl.startsWith("jdbc:log4jdbc:oracle:")) {
             return DBType.ORACLE;
-        } else if (jdbcUrl.startsWith("jdbc:sqlserver:" ) || jdbcUrl.startsWith("jdbc:microsoft:" )) {
+        } else if (jdbcUrl.startsWith("jdbc:sqlserver:") || jdbcUrl.startsWith("jdbc:microsoft:")) {
             return DBType.SQLSERVER2005;
-        } else if (jdbcUrl.startsWith("jdbc:sqlserver2012:" )) {
+        } else if (jdbcUrl.startsWith("jdbc:sqlserver2012:")) {
             return DBType.SQLSERVER;
-        } else if (jdbcUrl.startsWith("jdbc:postgresql:" ) || jdbcUrl.startsWith("jdbc:log4jdbc:postgresql:" )) {
+        } else if (jdbcUrl.startsWith("jdbc:postgresql:") || jdbcUrl.startsWith("jdbc:log4jdbc:postgresql:")) {
             return DBType.POSTGRE;
-        } else if (jdbcUrl.startsWith("jdbc:hsqldb:" ) || jdbcUrl.startsWith("jdbc:log4jdbc:hsqldb:" )) {
+        } else if (jdbcUrl.startsWith("jdbc:hsqldb:") || jdbcUrl.startsWith("jdbc:log4jdbc:hsqldb:")) {
             return DBType.HSQL;
-        } else if (jdbcUrl.startsWith("jdbc:db2:" )) {
+        } else if (jdbcUrl.startsWith("jdbc:db2:")) {
             return DBType.DB2;
-        } else if (jdbcUrl.startsWith("jdbc:sqlite:" )) {
+        } else if (jdbcUrl.startsWith("jdbc:sqlite:")) {
             return DBType.SQLITE;
-        } else if (jdbcUrl.startsWith("jdbc:h2:" ) || jdbcUrl.startsWith("jdbc:log4jdbc:h2:" )) {
+        } else if (jdbcUrl.startsWith("jdbc:h2:") || jdbcUrl.startsWith("jdbc:log4jdbc:h2:")) {
             return DBType.H2;
         } else {
-            logger.warn("The jdbcUrl is " + jdbcUrl + ", Mybatis Plus Cannot Read Database type or The Database's Not Supported!" );
+            logger.warn("The jdbcUrl is " + jdbcUrl + ", Mybatis Plus Cannot Read Database type or The Database's Not Supported!");
             return DBType.OTHER;
         }
     }

+ 2 - 2
mybatis-plus-extension/src/main/java/com/baomidou/mybatisplus/extension/toolkit/PackageHelper.java

@@ -53,7 +53,7 @@ public class PackageHelper {
         ResourcePatternResolver resolver = new PathMatchingResourcePatternResolver();
         MetadataReaderFactory metadataReaderFactory = new CachingMetadataReaderFactory(resolver);
         String pkg = ResourcePatternResolver.CLASSPATH_ALL_URL_PREFIX
-            + ClassUtils.convertClassNameToResourcePath(typeAliasesPackage) + "/*.class" ;
+            + ClassUtils.convertClassNameToResourcePath(typeAliasesPackage) + "/*.class";
         /*
          * 将加载多个绝对匹配的所有Resource
          * 将首先通过ClassLoader.getResource("META-INF")加载非模式路径部分,然后进行遍历模式匹配,排除重复包路径
@@ -93,7 +93,7 @@ public class PackageHelper {
         ResourcePatternResolver resolver = new PathMatchingResourcePatternResolver();
         MetadataReaderFactory metadataReaderFactory = new CachingMetadataReaderFactory(resolver);
         String pkg = ResourcePatternResolver.CLASSPATH_ALL_URL_PREFIX
-            + ClassUtils.convertClassNameToResourcePath(typePackage) + "/*.class" ;
+            + ClassUtils.convertClassNameToResourcePath(typePackage) + "/*.class";
         /*
          * 将加载多个绝对匹配的所有Resource
          * 将首先通过ClassLoader.getResource("META-INF")加载非模式路径部分,然后进行遍历模式匹配,排除重复包路径

+ 1 - 1
mybatis-plus-extension/src/main/java/com/baomidou/mybatisplus/extension/toolkit/SqlRunner.java

@@ -154,7 +154,7 @@ public class SqlRunner extends ISqlRunner {
         return SqlHelper.getObject(selectList(sql, args));
     }
 
-    @SuppressWarnings({"unchecked" , "rawtypes"})
+    @SuppressWarnings({"unchecked", "rawtypes"})
     public Page<Map<String, Object>> selectPage(Page page, String sql, Object... args) {
         if (null == page) {
             return null;

+ 3 - 3
mybatis-plus-extension/src/main/java/com/baomidou/mybatisplus/extension/toolkit/VersionUtils.java

@@ -22,11 +22,11 @@ public class VersionUtils {
      */
     public static int compareVersion(String version1, String version2) {
         if (StringUtils.isEmpty(version1) || StringUtils.isEmpty(version2)) {
-            throw new MybatisPlusException("Error: CompareVersion Error: Illegal Argument !" );
+            throw new MybatisPlusException("Error: CompareVersion Error: Illegal Argument !");
         }
         // 切割点 ".";
-        String[] versionArray1 = version1.split("\\." );
-        String[] versionArray2 = version2.split("\\." );
+        String[] versionArray1 = version1.split("\\.");
+        String[] versionArray2 = version2.split("\\.");
         int idx = 0;
         // 取最小长度值
         int minLength = Math.min(versionArray1.length, versionArray2.length);

+ 5 - 5
mybatis-plus-extension/src/test/java/com/baomidou/mybatisplus/extension/test/CrudTest.java

@@ -44,16 +44,16 @@ public class CrudTest {
     }
 
     public SqlSessionFactory sqlSessionFactory() {
-        return sqlSessionFactory("mysql-config.xml" );
+        return sqlSessionFactory("mysql-config.xml");
     }
 
     public SqlSessionFactory sqlSessionFactory(String configXml) {
         GlobalConfiguration global = this.globalConfiguration();
         BasicDataSource dataSource = new BasicDataSource();
-        dataSource.setDriverClassName("com.mysql.jdbc.Driver" );
-        dataSource.setUrl("jdbc:mysql://127.0.0.1:3306/mybatis-plus?characterEncoding=UTF-8" );
-        dataSource.setUsername("root" );
-        dataSource.setPassword("521" );
+        dataSource.setDriverClassName("com.mysql.jdbc.Driver");
+        dataSource.setUrl("jdbc:mysql://127.0.0.1:3306/mybatis-plus?characterEncoding=UTF-8");
+        dataSource.setUsername("root");
+        dataSource.setPassword("521");
         dataSource.setMaxTotal(1000);
         GlobalConfigUtils.setMetaData(dataSource, global);
         // 加载配置文件

+ 68 - 68
mybatis-plus-extension/src/test/java/com/baomidou/mybatisplus/extension/test/EntityWrapperTest.java

@@ -53,7 +53,7 @@ public class EntityWrapperTest {
         /*
          * 无条件测试
          */
-        Assert.assertEquals("" , ew.originalSql());
+        Assert.assertEquals("", ew.originalSql());
     }
 
     @Test
@@ -79,10 +79,10 @@ public class EntityWrapperTest {
          * 实体带where orderby
          */
         ew.setEntity(new User(1));
-        ew.where("name={0}" , "'123'" ).orderBy("id" , false);
+        ew.where("name={0}", "'123'").orderBy("id", false);
         String sqlSegment = ew.originalSql();
         System.err.println("test12 = " + sqlSegment);
-        Assert.assertEquals("AND (name=?)\nORDER BY id DESC" , sqlSegment);
+        Assert.assertEquals("AND (name=?)\nORDER BY id DESC", sqlSegment);
     }
 
     @Test
@@ -91,10 +91,10 @@ public class EntityWrapperTest {
          * 实体排序
          */
         ew.setEntity(new User(1));
-        ew.orderBy("id" , false);
+        ew.orderBy("id", false);
         String sqlSegment = ew.originalSql();
         System.err.println("test13 = " + sqlSegment);
-        Assert.assertEquals("ORDER BY id DESC" , sqlSegment);
+        Assert.assertEquals("ORDER BY id DESC", sqlSegment);
     }
 
     @Test
@@ -102,18 +102,18 @@ public class EntityWrapperTest {
         /*
          * 无实体 where ifneed orderby
          */
-        ew.where("name={0}" , "'123'" ).addFilterIfNeed(false, "id=1" ).orderBy("id" );
+        ew.where("name={0}", "'123'").addFilterIfNeed(false, "id=1").orderBy("id");
         String sqlSegment = ew.originalSql();
         System.err.println("test21 = " + sqlSegment);
-        Assert.assertEquals("AND (name=?)\nORDER BY id" , sqlSegment);
+        Assert.assertEquals("AND (name=?)\nORDER BY id", sqlSegment);
     }
 
     @Test
     public void test22() {
-        ew.where("name={0}" , "'123'" ).orderBy("id" , false);
+        ew.where("name={0}", "'123'").orderBy("id", false);
         String sqlSegment = ew.originalSql();
         System.err.println("test22 = " + sqlSegment);
-        Assert.assertEquals("AND (name=?)\nORDER BY id DESC" , sqlSegment);
+        Assert.assertEquals("AND (name=?)\nORDER BY id DESC", sqlSegment);
     }
 
     @Test
@@ -121,10 +121,10 @@ public class EntityWrapperTest {
         /*
          * 无实体查询,只排序
          */
-        ew.orderBy("id" , false);
+        ew.orderBy("id", false);
         String sqlSegment = ew.originalSql();
         System.err.println("test23 = " + sqlSegment);
-        Assert.assertEquals("ORDER BY id DESC" , sqlSegment);
+        Assert.assertEquals("ORDER BY id DESC", sqlSegment);
     }
 
     @Test
@@ -133,10 +133,10 @@ public class EntityWrapperTest {
          * 实体 filter orderby
          */
         ew.setEntity(new User(1));
-        ew.addFilter("name={0}" , "'123'" ).orderBy("id,name" );
+        ew.addFilter("name={0}", "'123'").orderBy("id,name");
         String sqlSegment = ew.originalSql();
         System.err.println("testNoTSQL = " + sqlSegment);
-        Assert.assertEquals("AND (name=?)\nORDER BY id,name" , sqlSegment);
+        Assert.assertEquals("AND (name=?)\nORDER BY id,name", sqlSegment);
     }
 
     @Test
@@ -144,10 +144,10 @@ public class EntityWrapperTest {
         /*
          * 非 T-SQL 无实体查询
          */
-        ew.addFilter("name={0}" , "'123'" ).addFilterIfNeed(false, "status=?" , "1" );
+        ew.addFilter("name={0}", "'123'").addFilterIfNeed(false, "status=?", "1");
         String sqlSegment = ew.originalSql();
         System.err.println("testNoTSQL1 = " + sqlSegment);
-        Assert.assertEquals("AND (name=?)" , sqlSegment);
+        Assert.assertEquals("AND (name=?)", sqlSegment);
     }
 
     @Test
@@ -156,27 +156,27 @@ public class EntityWrapperTest {
          * 实体带查询使用方法 输出看结果
          */
         ew.setEntity(new User(1));
-        ew.where("name=?" , "'zhangsan'" ).and("id=1" ).orNew("status=?" , "0" ).or("status=1" ).notLike("nlike" , "notvalue" )
-            .andNew("new=xx" ).like("hhh" , "ddd" ).andNew("pwd=11" ).isNotNull("n1,n2" ).isNull("n3" ).groupBy("x1" )
-            .groupBy("x2,x3" ).having("x1=11" ).having("x3=433" ).orderBy("dd" ).orderBy("d1,d2" );
+        ew.where("name=?", "'zhangsan'").and("id=1").orNew("status=?", "0").or("status=1").notLike("nlike", "notvalue")
+            .andNew("new=xx").like("hhh", "ddd").andNew("pwd=11").isNotNull("n1,n2").isNull("n3").groupBy("x1")
+            .groupBy("x2,x3").having("x1=11").having("x3=433").orderBy("dd").orderBy("d1,d2");
         System.out.println(ew.originalSql());
         Assert.assertEquals("AND (name=? AND id=1) \n" + "OR (status=? OR status=1 AND nlike NOT LIKE ?) \n"
             + "AND (new=xx AND hhh LIKE ?) \n" + "AND (pwd=11 AND n1 IS NOT NULL AND n2 IS NOT NULL AND n3 IS NULL)\n"
-            + "GROUP BY x1, x2,x3\n" + "HAVING (x1=11 AND x3=433)\n" + "ORDER BY dd, d1,d2" , ew.originalSql());
+            + "GROUP BY x1, x2,x3\n" + "HAVING (x1=11 AND x3=433)\n" + "ORDER BY dd, d1,d2", ew.originalSql());
     }
 
     @Test
     public void testNull() {
         ew.orderBy(null);
         String sqlPart = ew.originalSql();
-        Assert.assertEquals("" , sqlPart);
+        Assert.assertEquals("", sqlPart);
     }
 
     @Test
     public void testNull2() {
-        ew.like(null, null).where("aa={0}" , "'bb'" ).orderBy(null);
+        ew.like(null, null).where("aa={0}", "'bb'").orderBy(null);
         String sqlPart = ew.originalSql();
-        Assert.assertEquals("AND (aa=?)" , sqlPart);
+        Assert.assertEquals("AND (aa=?)", sqlPart);
     }
 
     /**
@@ -184,10 +184,10 @@ public class EntityWrapperTest {
      */
     @Test
     public void testNul14() {
-        ew.where("id={0}" , "'11'" ).and("name={0}" , 22);
+        ew.where("id={0}", "'11'").and("name={0}", 22);
         String sqlPart = ew.originalSql();
         System.out.println("sql ==> " + sqlPart);
-        Assert.assertEquals("AND (id=? AND name=?)" , sqlPart);
+        Assert.assertEquals("AND (id=? AND name=?)", sqlPart);
     }
 
     /**
@@ -195,10 +195,10 @@ public class EntityWrapperTest {
      */
     @Test
     public void testNul15() {
-        ew.where("id={0} and ids = {1}" , "11" , 22).and("name={0}" , 222222222);
+        ew.where("id={0} and ids = {1}", "11", 22).and("name={0}", 222222222);
         String sqlPart = ew.originalSql();
         System.out.println("sql ==> " + sqlPart);
-        Assert.assertEquals("AND (id=? and ids = ? AND name=?)" , sqlPart);
+        Assert.assertEquals("AND (id=? and ids = ? AND name=?)", sqlPart);
     }
 
     /**
@@ -206,10 +206,10 @@ public class EntityWrapperTest {
      */
     @Test
     public void testNul16() {
-        ew.notExists("(select * from user)" );
+        ew.notExists("(select * from user)");
         String sqlPart = ew.originalSql();
         System.out.println("sql ==> " + sqlPart);
-        Assert.assertEquals("AND ( NOT EXISTS ((select * from user)))" , sqlPart);
+        Assert.assertEquals("AND ( NOT EXISTS ((select * from user)))", sqlPart);
     }
 
     /**
@@ -218,13 +218,13 @@ public class EntityWrapperTest {
     @Test
     public void test17() {
         List<String> list = new ArrayList<>();
-        list.add("'1'" );
-        list.add("'2'" );
-        list.add("'3'" );
-        ew.notIn("test_type" , list);
+        list.add("'1'");
+        list.add("'2'");
+        list.add("'3'");
+        ew.notIn("test_type", list);
         String sqlPart = ew.originalSql();
         System.out.println("sql ==> " + sqlPart);
-        Assert.assertEquals("AND (test_type NOT IN (?,?,?))" , sqlPart);
+        Assert.assertEquals("AND (test_type NOT IN (?,?,?))", sqlPart);
     }
 
     /**
@@ -236,10 +236,10 @@ public class EntityWrapperTest {
         list.add(111111111L);
         list.add(222222222L);
         list.add(333333333L);
-        ew.in("test_type" , list);
+        ew.in("test_type", list);
         String sqlPart = ew.originalSql();
         System.out.println("sql ==> " + sqlPart);
-        Assert.assertEquals("AND (test_type IN (?,?,?))" , sqlPart);
+        Assert.assertEquals("AND (test_type IN (?,?,?))", sqlPart);
     }
 
     /**
@@ -251,10 +251,10 @@ public class EntityWrapperTest {
         list.add(111111111L);
         list.add(222222222L);
         list.add(333333333L);
-        ew.in("test_type" , list);
+        ew.in("test_type", list);
         String sqlPart = ew.originalSql();
         System.out.println("sql ==> " + sqlPart);
-        Assert.assertEquals("AND (test_type IN (?,?,?))" , sqlPart);
+        Assert.assertEquals("AND (test_type IN (?,?,?))", sqlPart);
     }
 
     /**
@@ -262,12 +262,12 @@ public class EntityWrapperTest {
      */
     @Test
     public void testNul19() {
-        String val1 = "11" ;
-        String val2 = "33" ;
-        ew.between("test_type" , val1, val2);
+        String val1 = "11";
+        String val2 = "33";
+        ew.between("test_type", val1, val2);
         String sqlPart = ew.originalSql();
         System.out.println("sql ==> " + sqlPart);
-        Assert.assertEquals("AND (test_type BETWEEN ? AND ?)" , sqlPart);
+        Assert.assertEquals("AND (test_type BETWEEN ? AND ?)", sqlPart);
     }
 
     /**
@@ -275,12 +275,12 @@ public class EntityWrapperTest {
      */
     @Test
     public void testEscape() {
-        String val1 = "'''" ;
-        String val2 = "\\" ;
-        ew.between("test_type" , val1, val2);
+        String val1 = "'''";
+        String val2 = "\\";
+        ew.between("test_type", val1, val2);
         String sqlPart = ew.originalSql();
         System.out.println("sql ==> " + sqlPart);
-        Assert.assertEquals("AND (test_type BETWEEN ? AND ?)" , sqlPart);
+        Assert.assertEquals("AND (test_type BETWEEN ? AND ?)", sqlPart);
     }
 
     /**
@@ -288,8 +288,8 @@ public class EntityWrapperTest {
      */
     @Test
     public void testInstance() {
-        String val1 = "'''" ;
-        String val2 = "\\" ;
+        String val1 = "'''";
+        String val2 = "\\";
         //TODO: 3.0
 //        String sqlPart = Condition.create().between("test_type", val1, val2).originalSql();
 //        System.out.println("sql ==> " + sqlPart);
@@ -300,12 +300,12 @@ public class EntityWrapperTest {
      * 测试Qbc
      */
     @Test
-    @SuppressWarnings("unchecked" )
+    @SuppressWarnings("unchecked")
     public void testQbc() {
         Map<String, Object> map = new TreeMap<>();
-        map.put("allEq1" , "22" );
-        map.put("allEq2" , 3333);
-        map.put("allEq3" , 66.99);
+        map.put("allEq1", "22");
+        map.put("allEq2", 3333);
+        map.put("allEq3", 66.99);
         //TODO: 3.0
 //        String sqlPart = Condition.create().gt("gt", 1).le("le", 2).lt("le", 3).ge("ge", 4).eq("eq", 5).allEq(map).originalSql();
 //        System.out.println("sql ==> " + sqlPart);
@@ -335,13 +335,13 @@ public class EntityWrapperTest {
          * 实体带where ifneed
          */
         ew.setEntity(new User(1));
-        ew.setParamAlias("ceshi" );
-        ew.or("sql = {0}" , "sql" ).like("default" , "default" , SqlLike.DEFAULT).like("left" , "left" , SqlLike.LEFT);
-        ew.in("aaabbbcc" , "1,3,4" );
-        String sqlPart = ew.in("bbb" , Arrays.asList(new String[]{"a" , "b" , "c"})).like("right" , "right" , SqlLike.RIGHT).isWhere(true)
-            .eq("bool" , true).between("ee" , "1111" , "222" ).originalSql();
+        ew.setParamAlias("ceshi");
+        ew.or("sql = {0}", "sql").like("default", "default", SqlLike.DEFAULT).like("left", "left", SqlLike.LEFT);
+        ew.in("aaabbbcc", "1,3,4");
+        String sqlPart = ew.in("bbb", Arrays.asList(new String[]{"a", "b", "c"})).like("right", "right", SqlLike.RIGHT).isWhere(true)
+            .eq("bool", true).between("ee", "1111", "222").originalSql();
         System.out.println("sql ==> " + sqlPart);
-        Assert.assertEquals("WHERE (sql = ? AND default LIKE ? AND left LIKE ? AND aaabbbcc IN (?,?,?) AND bbb IN (?,?,?) AND right LIKE ? AND bool = ? AND ee BETWEEN ? AND ?)" , sqlPart);
+        Assert.assertEquals("WHERE (sql = ? AND default LIKE ? AND left LIKE ? AND aaabbbcc IN (?,?,?) AND bbb IN (?,?,?) AND right LIKE ? AND bool = ? AND ee BETWEEN ? AND ?)", sqlPart);
         System.out.println(ew.getSqlSegment());
     }
 
@@ -350,11 +350,11 @@ public class EntityWrapperTest {
      */
     @Test
     public void testLimit() {
-        ew.where("name={0}" , "'123'" ).orderBy("id" , false);
-        ew.last("limit 1,2" );
+        ew.where("name={0}", "'123'").orderBy("id", false);
+        ew.last("limit 1,2");
         String sqlSegment = ew.originalSql();
         System.err.println("testLimit = " + sqlSegment);
-        Assert.assertEquals("AND (name=?)\nORDER BY id DESC limit 1,2" , sqlSegment);
+        Assert.assertEquals("AND (name=?)\nORDER BY id DESC limit 1,2", sqlSegment);
     }
 
     /**
@@ -363,9 +363,9 @@ public class EntityWrapperTest {
     @Test
     public void testSqlSelectStrings() {
         EntityWrapper entityWrapper = new EntityWrapper();
-        entityWrapper.setSqlSelect("name" , "age" , "sex" );
+        entityWrapper.setSqlSelect("name", "age", "sex");
         System.out.println(entityWrapper.getSqlSelect());
-        Assert.assertEquals("name,age,sex" , entityWrapper.getSqlSelect());
+        Assert.assertEquals("name,age,sex", entityWrapper.getSqlSelect());
     }
 
     /**
@@ -375,9 +375,9 @@ public class EntityWrapperTest {
     public void testSqlSelect() {
         EntityWrapper entityWrapper = new EntityWrapper();
         // entityWrapper.setSqlSelect(Column.create().column("col").as("name"),null,Column.create(),Column.create().as("11"),Column.create().column("col"));
-        entityWrapper.setSqlSelect(Column.create().column("col" ).as("name" ), null, Column.create(), Column.create().as("11" ), Column.create().column("col" ));
+        entityWrapper.setSqlSelect(Column.create().column("col").as("name"), null, Column.create(), Column.create().as("11"), Column.create().column("col"));
         System.out.println(entityWrapper.getSqlSelect());
-        Assert.assertNotNull("col AS name,col" , entityWrapper.getSqlSelect());
+        Assert.assertNotNull("col AS name,col", entityWrapper.getSqlSelect());
 
     }
 
@@ -387,10 +387,10 @@ public class EntityWrapperTest {
     @Test
     public void testSqlSelectColumns() {
         EntityWrapper entityWrapper = new EntityWrapper();
-        Columns columns = Columns.create().column("name" , "name1" ).column("age" ).column("sex" , "sex1" , false);
+        Columns columns = Columns.create().column("name", "name1").column("age").column("sex", "sex1", false);
         entityWrapper.setSqlSelect(columns);
         System.out.println(entityWrapper.getSqlSelect());
-        Assert.assertEquals("name AS name1,age,sex AS sex1" , entityWrapper.getSqlSelect());
+        Assert.assertEquals("name AS name1,age,sex AS sex1", entityWrapper.getSqlSelect());
     }
 
     /**
@@ -399,9 +399,9 @@ public class EntityWrapperTest {
     @Test
     public void testEntityWrapperOrderBy() {
         EntityWrapper entityWrapper = new EntityWrapper();
-        entityWrapper.orderBy("id desc" );
+        entityWrapper.orderBy("id desc");
         System.out.println(entityWrapper.getSqlSegment());
-        Assert.assertEquals("ORDER BY id desc" , entityWrapper.getSqlSegment());
+        Assert.assertEquals("ORDER BY id desc", entityWrapper.getSqlSegment());
     }
 
     /**

+ 6 - 6
mybatis-plus-extension/src/test/java/com/baomidou/mybatisplus/extension/test/GlobalConfigurationTest.java

@@ -61,7 +61,7 @@ public class GlobalConfigurationTest extends CrudTest {
         Test test = new Test();
         test.setCreateTime(new Date());
         // 开启全局校验字符串会忽略空字符串
-        test.setType("" );
+        test.setType("");
         testMapper.insert(test);
 
         SqlSession sqlSession = this.sqlSessionFactory().openSession(false);
@@ -84,9 +84,9 @@ public class GlobalConfigurationTest extends CrudTest {
 //        pkMapper.selectPage(RowBounds.DEFAULT, type);
         NotPK notPK2 = null;
         try {
-            notPK2 = pkMapper.selectById("1" );
+            notPK2 = pkMapper.selectById("1");
         } catch (Exception e) {
-            System.out.println("因为没有主键,所以没有注入该方法" );
+            System.out.println("因为没有主键,所以没有注入该方法");
         }
         Assert.assertNull(notPK2);
         int count = pkMapper.selectCount(Condition.EMPTY);
@@ -97,9 +97,9 @@ public class GlobalConfigurationTest extends CrudTest {
         int deleteCount = pkMapper.delete(null);
         Assert.assertTrue(deleteCount > 0);
         List<String> list = new ArrayList<>();
-        list.add("1" );
-        list.add("2" );
-        list.add("3" );
+        list.add("1");
+        list.add("2");
+        list.add("3");
         RoleMapper mapper = sqlSession.getMapper(RoleMapper.class);
         System.out.println(mapper.selectBatchIds(list));
         System.out.println(mapper.selectBatchIds(new HashSet<>(list)));

+ 1 - 1
mybatis-plus-extension/src/test/java/com/baomidou/mybatisplus/extension/test/IdWorkerTest.java

@@ -50,7 +50,7 @@ public class IdWorkerTest {
     //@Test
     public void test() throws Exception {
         int count = 1000;
-        System.err.println("共有" + count + "个数参与测试" );
+        System.err.println("共有" + count + "个数参与测试");
 
         ExecutorService executorService = Executors.newFixedThreadPool(20);
         final List<Long> results = new ArrayList<>();

+ 1 - 1
mybatis-plus-extension/src/test/java/com/baomidou/mybatisplus/extension/test/MybatisMapperRefreshTest.java

@@ -44,7 +44,7 @@ public class MybatisMapperRefreshTest extends CrudTest {
      * 测试 Mybatis XML 修改自动刷新
      */
     public static void main(String[] args) throws Exception {
-        Resource[] resource = new ClassPathResource[]{new ClassPathResource("mysql/UserMapper.xml" )};
+        Resource[] resource = new ClassPathResource[]{new ClassPathResource("mysql/UserMapper.xml")};
         SqlSessionFactory sessionFactory = new CrudTest().sqlSessionFactory();
         new MybatisMapperRefresh(resource, sessionFactory, 0, 5, true);
         boolean isReturn = false;

+ 3 - 3
mybatis-plus-extension/src/test/java/com/baomidou/mybatisplus/extension/test/StringUtilsTest.java

@@ -33,8 +33,8 @@ public class StringUtilsTest {
 
     @Test
     public void removePrefixAfterPrefixToLower() {
-        Assert.assertEquals("user" , StringUtils.removePrefixAfterPrefixToLower("isUser" , 2));
-        Assert.assertEquals("userInfo" , StringUtils.removePrefixAfterPrefixToLower("isUserInfo" , 2));
-        Assert.assertEquals(true, StringUtils.isMixedMode("Xxx_ss1aa" ));
+        Assert.assertEquals("user", StringUtils.removePrefixAfterPrefixToLower("isUser", 2));
+        Assert.assertEquals("userInfo", StringUtils.removePrefixAfterPrefixToLower("isUserInfo", 2));
+        Assert.assertEquals(true, StringUtils.isMixedMode("Xxx_ss1aa"));
     }
 }

+ 12 - 12
mybatis-plus-extension/src/test/java/com/baomidou/mybatisplus/extension/test/activerecord/ActiveRecordTest.java

@@ -44,31 +44,31 @@ public class ActiveRecordTest extends CrudTest {
         TableInfoHelper.initSqlSessionFactory(this.sqlSessionFactory());
         // 保存一条记录
         Test t1 = new Test();
-        t1.setType("test10" );
+        t1.setType("test10");
         boolean rlt = t1.insert();
         print(" ar save=" + rlt + ", id=" + t1.getId());
 
         // 根据ID更新
-        t1.setType("t1001" );
+        t1.setType("t1001");
         rlt = t1.updateAllColumnById();
         print(" ar updateAllColumnById:" + rlt);
 
-        t1.setType("t1023" );
+        t1.setType("t1023");
         rlt = t1.updateById();
         print(" ar updateById:" + rlt);
 
         // 更新 SQL
         Test t11 = new Test();
-        t11.setType("123" );
-        rlt = t11.update("id={0}" , t1.getId());
+        t11.setType("123");
+        rlt = t11.update("id={0}", t1.getId());
         print("update sql=" + rlt);
 
         // 查询 SQL
-        Test t10 = t1.selectOne("id={0}" , t1.getId());
+        Test t10 = t1.selectOne("id={0}", t1.getId());
         print("selectOne=" + t10.getType());
 
         // 插入OR更新
-        t1.setType("t1021" );
+        t1.setType("t1021");
         rlt = t1.insertOrUpdate();
         print(" ar saveOrUpdate:" + rlt);
 
@@ -99,12 +99,12 @@ public class ActiveRecordTest extends CrudTest {
         // 执行 SQL 查询总数
         List<Map<String, Object>> ul = t2.sql().selectList(new SQL() {
             {
-                SELECT("*" );
-                FROM("test" );
-                WHERE("type='t1021'" );
+                SELECT("*");
+                FROM("test");
+                WHERE("type='t1021'");
             }
         }.toString());
-        System.err.println("selectList SQL:" );
+        System.err.println("selectList SQL:");
         for (Map<String, Object> map : ul) {
             System.err.println(map);
         }
@@ -114,7 +114,7 @@ public class ActiveRecordTest extends CrudTest {
         print("t2 删除后是否存在?" + (null != t20));
 
         // 删除 SQL
-        rlt = t2.delete("type={0}" , "t1021" );
+        rlt = t2.delete("type={0}", "t1021");
         System.err.println("delete sql=" + rlt);
     }
 

+ 1 - 1
mybatis-plus-extension/src/test/java/com/baomidou/mybatisplus/extension/test/h2/H2LogicDeleteSqlParserTest.java

@@ -57,7 +57,7 @@ public class H2LogicDeleteSqlParserTest extends H2Test {
 
 
     @Test
-    public void testMySelect(){
+    public void testMySelect() {
         personMapper.getAddrListByUserId(1L);
         //TODO: 然并无
     }

+ 15 - 15
mybatis-plus-extension/src/test/java/com/baomidou/mybatisplus/extension/test/h2/H2LogicDeleteTest.java

@@ -42,7 +42,7 @@ public class H2LogicDeleteTest extends H2Test {
         AnnotationConfigWebApplicationContext context = new AnnotationConfigWebApplicationContext();
         context.register(ServiceConfig.class);
         context.refresh();
-        DataSource ds = (DataSource) context.getBean("dataSource" );
+        DataSource ds = (DataSource) context.getBean("dataSource");
         try (Connection conn = ds.getConnection()) {
             initData(conn);
         }
@@ -55,43 +55,43 @@ public class H2LogicDeleteTest extends H2Test {
     public void testInsert() {
         H2UserLogicDelete user = new H2UserLogicDelete();
         user.setAge(1);
-        user.setPrice(new BigDecimal("9.99" ));
+        user.setPrice(new BigDecimal("9.99"));
         user.setVersion(1);
         userService.insert(user);
         Long id = user.getId();
         Assert.assertNotNull(id);
-        user.setDesc("Caratacus" );
+        user.setDesc("Caratacus");
         userService.insertOrUpdate(user);
-        System.out.println("************************************" );
+        System.out.println("************************************");
         System.out.println("*********" + user.getVersion());
-        System.out.println("************************************" );
+        System.out.println("************************************");
         user = new H2UserLogicDelete();
         user.setId(id);
         EntityWrapper<H2UserLogicDelete> ew = new EntityWrapper<>(user);
         List<H2UserLogicDelete> list = userService.selectList(ew);
-        System.out.println("************************************" );
+        System.out.println("************************************");
         System.out.println("*********" + list.size());
-        System.out.println("************************************" );
+        System.out.println("************************************");
         H2UserLogicDelete userFromDB = userService.selectById(user.getId());
-        Assert.assertEquals("Caratacus" , userFromDB.getDesc());
+        Assert.assertEquals("Caratacus", userFromDB.getDesc());
         Assert.assertEquals(1, userFromDB.getVersion().intValue());
         Page page = new Page();
 
-        page.setOrderByField("desc" );
+        page.setOrderByField("desc");
         //TODO 3.0
 //        userService.selectPage(page, Condition.create().eq("desc", "111"));
         userService.deleteById(id);
         list = userService.selectList(ew);
-        System.out.println("************************************" );
+        System.out.println("************************************");
         System.out.println("*********" + list.size());
-        System.out.println("************************************" );
+        System.out.println("************************************");
     }
 
     @Test
     public void testLogicDeleted() {
         H2UserLogicDelete user = new H2UserLogicDelete();
         user.setAge(1);
-        user.setPrice(new BigDecimal("9.99" ));
+        user.setPrice(new BigDecimal("9.99"));
         user.setVersion(-1);
         userService.insert(user);
         Long id = user.getId();
@@ -106,7 +106,7 @@ public class H2LogicDeleteTest extends H2Test {
     public void testDelete() {
         H2UserLogicDelete user = new H2UserLogicDelete();
         user.setAge(1);
-        user.setPrice(new BigDecimal("9.99" ));
+        user.setPrice(new BigDecimal("9.99"));
         user.setVersion(1);
         userService.insert(user);
         Long id = user.getId();
@@ -118,8 +118,8 @@ public class H2LogicDeleteTest extends H2Test {
     }
 
     @Test
-    public void testSelectBatchIds(){
-        userService.selectBatchIds(Arrays.asList(101,102,103,104));
+    public void testSelectBatchIds() {
+        userService.selectBatchIds(Arrays.asList(101, 102, 103, 104));
 
     }
 }

+ 22 - 22
mybatis-plus-extension/src/test/java/com/baomidou/mybatisplus/extension/test/h2/H2MapUnderline2CamelTest.java

@@ -49,7 +49,7 @@ public class H2MapUnderline2CamelTest extends H2Test {
         AnnotationConfigWebApplicationContext context = new AnnotationConfigWebApplicationContext();
         context.register(DBConfig.class);
         context.refresh();
-        DataSource ds = (DataSource) context.getBean("dataSource" );
+        DataSource ds = (DataSource) context.getBean("dataSource");
         try (Connection conn = ds.getConnection()) {
             initData(conn);
         }
@@ -60,23 +60,23 @@ public class H2MapUnderline2CamelTest extends H2Test {
         List<Map<String, Object>> list = userService.selectMaps(new EntityWrapper<H2User>());
         for (Map<String, Object> map : list) {
             System.out.println(map);
-            Object obj = map.get("TEST_DATE" );
+            Object obj = map.get("TEST_DATE");
             if (obj != null) {
                 System.out.println("TEST_DATE.class" + obj.getClass().getName());
             } else {
-                obj = map.get("test_date" );
+                obj = map.get("test_date");
                 if (obj != null) {
                     System.out.println("test_date.class" + obj.getClass().getName());
                 } else {
-                    obj = map.get("testDate" );
+                    obj = map.get("testDate");
                     if (obj != null) {
                         System.out.println("testDate.class" + obj.getClass().getName());
                     } else {
-                        obj = map.get("TESTDATE" );
+                        obj = map.get("TESTDATE");
                         if (obj != null) {
                             System.out.println("TESTDATE.class" + obj.getClass().getName());
                         } else {
-                            obj = map.get("testdate" );
+                            obj = map.get("testdate");
                             if (obj != null) {
                                 System.out.println("testdate.class" + obj.getClass().getName());
                             }
@@ -92,11 +92,11 @@ public class H2MapUnderline2CamelTest extends H2Test {
         List<Map> list = userService.mySelectMaps();
         for (Map map : list) {
             System.out.println(JSONObject.toJSON(map));
-            System.out.println("TESTID=" + map.get("TESTID" ));
-            System.out.println("testid=" + map.get("testid" ));
-            System.out.println("testId=" + map.get("testId" ));
-            System.out.println("TEST_ID=" + map.get("TEST_ID" ));
-            System.out.println("test_id=" + map.get("test_id" ));
+            System.out.println("TESTID=" + map.get("TESTID"));
+            System.out.println("testid=" + map.get("testid"));
+            System.out.println("testId=" + map.get("testId"));
+            System.out.println("TEST_ID=" + map.get("TEST_ID"));
+            System.out.println("test_id=" + map.get("test_id"));
 //            Assert.assertNotNull("test_id should be auto converted to testId", map.get("testId"));
 //            Assert.assertNull("test_id should be auto converted to testId", map.get("TESTID"));
 //            Assert.assertNull("test_id should be auto converted to testId", map.get("testid"));
@@ -109,27 +109,27 @@ public class H2MapUnderline2CamelTest extends H2Test {
     @Test
     public void testSelectSql4SelectMaps() {
         EntityWrapper<H2User> ew = new EntityWrapper<>();
-        ew.setSqlSelect("test_id, test_type" );
+        ew.setSqlSelect("test_id, test_type");
         List<Map<String, Object>> list = userService.selectMaps(ew);
         for (Map<String, Object> map : list) {
             System.out.println(map);
-            Object obj = map.get("TEST_DATE" );
+            Object obj = map.get("TEST_DATE");
             if (obj != null) {
                 System.out.println("TEST_DATE.class" + obj.getClass().getName());
             } else {
-                obj = map.get("test_date" );
+                obj = map.get("test_date");
                 if (obj != null) {
                     System.out.println("test_date.class" + obj.getClass().getName());
                 } else {
-                    obj = map.get("testDate" );
+                    obj = map.get("testDate");
                     if (obj != null) {
                         System.out.println("testDate.class" + obj.getClass().getName());
                     } else {
-                        obj = map.get("TESTDATE" );
+                        obj = map.get("TESTDATE");
                         if (obj != null) {
                             System.out.println("TESTDATE.class" + obj.getClass().getName());
                         } else {
-                            obj = map.get("testdate" );
+                            obj = map.get("testdate");
                             if (obj != null) {
                                 System.out.println("testdate.class" + obj.getClass().getName());
                             }
@@ -143,12 +143,12 @@ public class H2MapUnderline2CamelTest extends H2Test {
     @Test
     public void testSelectSqlNotMapping() {
         EntityWrapper<H2User> ew = new EntityWrapper<>();
-        ew.setSqlSelect("test_id, test_type" );
+        ew.setSqlSelect("test_id, test_type");
         List<H2User> list = userService.selectList(ew);
         for (H2User u : list) {
             System.out.println(JSONObject.toJSON(u));
-            Assert.assertNull("test_id is not null, but should not mapping to id" , u.getId());
-            Assert.assertNotNull("test_type should be convert to testType" , u.getTestType());
+            Assert.assertNull("test_id is not null, but should not mapping to id", u.getId());
+            Assert.assertNotNull("test_type should be convert to testType", u.getTestType());
         }
     }
 
@@ -156,8 +156,8 @@ public class H2MapUnderline2CamelTest extends H2Test {
     public void testMpSelect() {
         List<H2User> list = userService.selectList(new EntityWrapper<H2User>());
         for (H2User u : list) {
-            Assert.assertNotNull("id should not be null" , u.getId());
-            Assert.assertNotNull("test_type should not be null" , u.getTestType());
+            Assert.assertNotNull("id should not be null", u.getId());
+            Assert.assertNotNull("test_type should not be null", u.getTestType());
         }
     }
 }

+ 42 - 42
mybatis-plus-extension/src/test/java/com/baomidou/mybatisplus/extension/test/h2/H2MetaObjAndVersionAndOptLockTest.java

@@ -43,12 +43,12 @@ public class H2MetaObjAndVersionAndOptLockTest extends H2Test {
 
     @BeforeClass
     public static void initDB() throws SQLException, IOException {
-        @SuppressWarnings("resource" )
+        @SuppressWarnings("resource")
         AnnotationConfigWebApplicationContext context = new AnnotationConfigWebApplicationContext();
         context.register(DBConfig.class);
         context.register(MybatisConfigMetaObjOptLockConfig.class);
         context.refresh();
-        DataSource ds = (DataSource) context.getBean("dataSource" );
+        DataSource ds = (DataSource) context.getBean("dataSource");
         try (Connection conn = ds.getConnection()) {
             initData(conn);
         }
@@ -62,23 +62,23 @@ public class H2MetaObjAndVersionAndOptLockTest extends H2Test {
         Long id = 991L;
         H2UserVersionAndLogicDeleteEntity user = new H2UserVersionAndLogicDeleteEntity();
         user.setId(id);
-        user.setName("991" );
+        user.setName("991");
         user.setAge(91);
         user.setPrice(BigDecimal.TEN);
-        user.setDesc("asdf" );
+        user.setDesc("asdf");
         user.setTestType(null);
         user.setVersion(1);
         userMapper.insertAllColumn(user);
 
         H2UserVersionAndLogicDeleteEntity userDB = userMapper.selectById(id);
-        Assert.assertEquals("lastUpdateDt should be null for insert()" , null, userDB.getLastUpdatedDt());
-        Assert.assertNotNull("testType should not be null for insert() due to insertFill()" , userDB.getTestType());
+        Assert.assertEquals("lastUpdateDt should be null for insert()", null, userDB.getLastUpdatedDt());
+        Assert.assertNotNull("testType should not be null for insert() due to insertFill()", userDB.getTestType());
 
-        userDB.setName("991" );
+        userDB.setName("991");
         userMapper.updateById(userDB);
 
         userDB = userMapper.selectById(id);
-        Assert.assertEquals("991" , userDB.getName());
+        Assert.assertEquals("991", userDB.getName());
         assertUpdateFill(userDB.getLastUpdatedDt());
     }
 
@@ -87,24 +87,24 @@ public class H2MetaObjAndVersionAndOptLockTest extends H2Test {
         Long id = 992L;
         H2UserVersionAndLogicDeleteEntity user = new H2UserVersionAndLogicDeleteEntity();
         user.setId(id);
-        user.setName("992" );
+        user.setName("992");
         user.setAge(92);
         user.setPrice(BigDecimal.TEN);
-        user.setDesc("asdf" );
+        user.setDesc("asdf");
         user.setTestType(1);
         user.setVersion(1);
         userMapper.insertAllColumn(user);
 
         H2UserVersionAndLogicDeleteEntity userDB = userMapper.selectById(id);
-        Assert.assertEquals("testType will only be updated by insertFill() when testType is null " , 1, userDB.getTestType().intValue());
+        Assert.assertEquals("testType will only be updated by insertFill() when testType is null ", 1, userDB.getTestType().intValue());
 
         H2UserVersionAndLogicDeleteEntity updUser = new H2UserVersionAndLogicDeleteEntity();
-        updUser.setName("999" );
+        updUser.setName("999");
 
         userMapper.update(updUser, new EntityWrapper<>(userDB));
 
         userDB = userMapper.selectById(id);
-        Assert.assertEquals("999" , userDB.getName());
+        Assert.assertEquals("999", userDB.getName());
         assertUpdateFill(userDB.getLastUpdatedDt());
     }
 
@@ -113,10 +113,10 @@ public class H2MetaObjAndVersionAndOptLockTest extends H2Test {
         Long id = 994L;
         H2UserVersionAndLogicDeleteEntity user = new H2UserVersionAndLogicDeleteEntity();
         user.setId(id);
-        user.setName("994" );
+        user.setName("994");
         user.setAge(91);
         user.setPrice(BigDecimal.TEN);
-        user.setDesc("asdf" );
+        user.setDesc("asdf");
         user.setTestType(1);
         user.setVersion(1);
         Calendar cal = Calendar.getInstance();
@@ -125,23 +125,23 @@ public class H2MetaObjAndVersionAndOptLockTest extends H2Test {
         userMapper.insertAllColumn(user);
 
         System.out.println("before update: testDate=" + user.getTestDate());
-        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH" );
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH");
         H2UserVersionAndLogicDeleteEntity userDB = userMapper.selectById(id);
 
         Assert.assertNotNull(userDB.getTestDate());
         String originalDateVersionStr = sdf.format(cal.getTime());
         Assert.assertEquals(originalDateVersionStr, sdf.format(userDB.getTestDate()));
 
-        userDB.setName("991" );
+        userDB.setName("991");
         userMapper.updateById(userDB);
         userDB = userMapper.selectById(id);
-        Assert.assertEquals("991" , userDB.getName());
+        Assert.assertEquals("991", userDB.getName());
         Date versionDate = userDB.getTestDate();
         System.out.println("after update: testDate=" + versionDate);
         String versionDateStr = sdf.format(versionDate);
-        Assert.assertEquals("@version field:testDate should be updated to current sysdate" , sdf.format(new Date()), versionDateStr);
+        Assert.assertEquals("@version field:testDate should be updated to current sysdate", sdf.format(new Date()), versionDateStr);
 
-        Assert.assertNotEquals("@version field should be updated" , originalDateVersionStr, versionDateStr);
+        Assert.assertNotEquals("@version field should be updated", originalDateVersionStr, versionDateStr);
 
     }
 
@@ -150,10 +150,10 @@ public class H2MetaObjAndVersionAndOptLockTest extends H2Test {
         Long id = 993L;
         H2UserVersionAndLogicDeleteEntity user = new H2UserVersionAndLogicDeleteEntity();
         user.setId(id);
-        user.setName("992" );
+        user.setName("992");
         user.setAge(92);
         user.setPrice(BigDecimal.TEN);
-        user.setDesc("asdf" );
+        user.setDesc("asdf");
         user.setTestType(1);
         user.setVersion(1);
         Calendar cal = Calendar.getInstance();
@@ -164,20 +164,20 @@ public class H2MetaObjAndVersionAndOptLockTest extends H2Test {
         H2UserVersionAndLogicDeleteEntity userDB = userMapper.selectById(id);
 
         H2UserVersionAndLogicDeleteEntity updUser = new H2UserVersionAndLogicDeleteEntity();
-        updUser.setName("999" );
+        updUser.setName("999");
         userDB.setVersion(null);
         userMapper.update(updUser, new EntityWrapper<>(userDB));
 
         System.out.println("before update: testDate=" + userDB.getTestDate());
-        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH" );
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH");
 
         userDB = userMapper.selectById(id);
-        Assert.assertEquals("999" , userDB.getName());
+        Assert.assertEquals("999", userDB.getName());
 
         Date versionDate = userDB.getTestDate();
         System.out.println("after update: testDate=" + versionDate);
         String versionDateStr = sdf.format(versionDate);
-        Assert.assertEquals("@version field:testDate should be updated to current sysdate" , sdf.format(new Date()), versionDateStr);
+        Assert.assertEquals("@version field:testDate should be updated to current sysdate", sdf.format(new Date()), versionDateStr);
         assertUpdateFill(userDB.getLastUpdatedDt());
     }
 
@@ -186,7 +186,7 @@ public class H2MetaObjAndVersionAndOptLockTest extends H2Test {
     public void testLogicDeleted() {
         H2UserVersionAndLogicDeleteEntity user = new H2UserVersionAndLogicDeleteEntity();
         user.setAge(1);
-        user.setPrice(new BigDecimal("9.99" ));
+        user.setPrice(new BigDecimal("9.99"));
         user.setVersion(-1);
         userMapper.insert(user);
         Long id = user.getId();
@@ -201,21 +201,21 @@ public class H2MetaObjAndVersionAndOptLockTest extends H2Test {
     public void testLogicDeleteRecordWithAutoFill() {
         H2UserVersionAndLogicDeleteEntity user = new H2UserVersionAndLogicDeleteEntity();
         user.setAge(1);
-        user.setPrice(new BigDecimal("9.99" ));
+        user.setPrice(new BigDecimal("9.99"));
         user.setVersion(1);
         userMapper.insert(user);
-        Assert.assertNotNull("testType should be auto filled" , user.getTestType());
+        Assert.assertNotNull("testType should be auto filled", user.getTestType());
         userMapper.deleteById(user);
-        Assert.assertNotNull("logicDelete should call update(), lastUpdateDt should be auto filled" , user.getLastUpdatedDt());
-        Assert.assertNull("logic deleted, should not be retrieved" , userMapper.selectById(user.getId()));
+        Assert.assertNotNull("logicDelete should call update(), lastUpdateDt should be auto filled", user.getLastUpdatedDt());
+        Assert.assertNull("logic deleted, should not be retrieved", userMapper.selectById(user.getId()));
         H2UserVersionAndLogicDeleteEntity userDB = userMapper.selectMyRecordById(user.getId());
-        Assert.assertNotNull("logic delete should not delete record physical" , userDB);
-        Assert.assertEquals("logic delete should update version=-1" , -1, userDB.getVersion().intValue());
+        Assert.assertNotNull("logic delete should not delete record physical", userDB);
+        Assert.assertEquals("logic delete should update version=-1", -1, userDB.getVersion().intValue());
     }
 
     @Test
     public void testInsertMy() {
-        String name = "自定义insert" ;
+        String name = "自定义insert";
         int version = 1;
         int row = userMapper.myInsertWithNameVersion(name, version);
         Assert.assertEquals(1, row);
@@ -223,7 +223,7 @@ public class H2MetaObjAndVersionAndOptLockTest extends H2Test {
 
     @Test
     public void testInsertObjectWithParam() {
-        String name = "自定义insert带Param注解" ;
+        String name = "自定义insert带Param注解";
         int version = 1;
         H2UserVersionAndLogicDeleteEntity user = new H2UserVersionAndLogicDeleteEntity();
         user.setName(name);
@@ -234,7 +234,7 @@ public class H2MetaObjAndVersionAndOptLockTest extends H2Test {
 
     @Test
     public void testInsertObjectWithoutParam() {
-        String name = "自定义insert带Param注解" ;
+        String name = "自定义insert带Param注解";
         int version = 1;
         H2UserVersionAndLogicDeleteEntity user = new H2UserVersionAndLogicDeleteEntity();
         user.setName(name);
@@ -248,20 +248,20 @@ public class H2MetaObjAndVersionAndOptLockTest extends H2Test {
         Long id = 10087L;
         H2UserVersionAndLogicDeleteEntity user = new H2UserVersionAndLogicDeleteEntity();
         user.setId(id);
-        user.setName("myUpdate" );
+        user.setName("myUpdate");
         user.setVersion(1);
         userMapper.insert(user);
 
         H2UserVersionAndLogicDeleteEntity dbUser = userMapper.selectById(id);
         Assert.assertNotNull(dbUser);
-        Assert.assertEquals("myUpdate" , dbUser.getName());
+        Assert.assertEquals("myUpdate", dbUser.getName());
 
-        Assert.assertEquals(1, userMapper.myUpdateWithNameId(id, "updateMy" ));
+        Assert.assertEquals(1, userMapper.myUpdateWithNameId(id, "updateMy"));
 
         dbUser = userMapper.selectById(id);
         Assert.assertNotNull(dbUser);
-        Assert.assertEquals("updateMy" , dbUser.getName());
-        Assert.assertEquals("自定义update需要自己控制version" , 1, user.getVersion().intValue());
+        Assert.assertEquals("updateMy", dbUser.getName());
+        Assert.assertEquals("自定义update需要自己控制version", 1, user.getVersion().intValue());
     }
 
 
@@ -269,7 +269,7 @@ public class H2MetaObjAndVersionAndOptLockTest extends H2Test {
     public void testCondition() {
         Page<H2UserVersionAndLogicDeleteEntity> page = new Page<>(1, 3);
         Map<String, Object> condition = new HashMap<>();
-        condition.put("test_type" , 1);
+        condition.put("test_type", 1);
         page.setCondition(condition);
         List<H2UserVersionAndLogicDeleteEntity> pageResult = userMapper.selectPage(page, new EntityWrapper<H2UserVersionAndLogicDeleteEntity>());
         for (H2UserVersionAndLogicDeleteEntity u : pageResult) {

+ 11 - 11
mybatis-plus-extension/src/test/java/com/baomidou/mybatisplus/extension/test/h2/H2MetaObjectHandler.java

@@ -36,28 +36,28 @@ public class H2MetaObjectHandler extends MetaObjectHandler {
      * 测试 user 表 name 字段为空自动填充
      */
     public void insertFill(MetaObject metaObject) {
-        System.out.println("*************************" );
-        System.out.println("insert fill" );
-        System.out.println("*************************" );
+        System.out.println("*************************");
+        System.out.println("insert fill");
+        System.out.println("*************************");
 
         // 测试下划线
-        Object testType = this.getFieldValByName("testType" , metaObject);
+        Object testType = this.getFieldValByName("testType", metaObject);
         System.out.println("testType=" + testType);
         if (testType == null) {
             //测试实体没有的字段,配置在公共填充,不应该set到实体里面
-            this.setFieldValByName("testType1" , 3, metaObject);
-            this.setFieldValByName("testType" , 3, metaObject);
+            this.setFieldValByName("testType1", 3, metaObject);
+            this.setFieldValByName("testType", 3, metaObject);
         }
     }
 
     @Override
     public void updateFill(MetaObject metaObject) {
-        System.out.println("*************************" );
-        System.out.println("update fill" );
-        System.out.println("*************************" );
+        System.out.println("*************************");
+        System.out.println("update fill");
+        System.out.println("*************************");
         //测试实体没有的字段,配置在公共填充,不应该set到实体里面
-        this.setFieldValByName("lastUpdatedDt1" , new Timestamp(System.currentTimeMillis()), metaObject);
-        this.setFieldValByName("lastUpdatedDt" , new Timestamp(System.currentTimeMillis()), metaObject);
+        this.setFieldValByName("lastUpdatedDt1", new Timestamp(System.currentTimeMillis()), metaObject);
+        this.setFieldValByName("lastUpdatedDt", new Timestamp(System.currentTimeMillis()), metaObject);
     }
 }
 

Algúns arquivos non se mostraron porque demasiados arquivos cambiaron neste cambio