浏览代码

统一格式化

= 7 年之前
父节点
当前提交
c6a82d3275
共有 100 个文件被更改,包括 2022 次插入2020 次删除
  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. 4 4
      mybatis-plus-core/src/main/java/com/baomidou/mybatisplus/core/MybatisConfiguration.java
  11. 16 16
      mybatis-plus-core/src/main/java/com/baomidou/mybatisplus/core/MybatisDefaultParameterHandler.java
  12. 74 74
      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. 78 78
      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. 4 4
      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. 39 38
      mybatis-plus-core/src/main/java/com/baomidou/mybatisplus/core/conditions/Wrapper.java
  22. 4 4
      mybatis-plus-core/src/main/java/com/baomidou/mybatisplus/core/enums/SqlLike.java
  23. 27 27
      mybatis-plus-core/src/main/java/com/baomidou/mybatisplus/core/enums/SqlMethod.java
  24. 2 2
      mybatis-plus-core/src/main/java/com/baomidou/mybatisplus/core/handlers/MetaObjectHandler.java
  25. 105 105
      mybatis-plus-core/src/main/java/com/baomidou/mybatisplus/core/handlers/SqlReservedWordsHandler.java
  26. 137 137
      mybatis-plus-core/src/main/java/com/baomidou/mybatisplus/core/injector/AutoSqlInjector.java
  27. 17 17
      mybatis-plus-core/src/main/java/com/baomidou/mybatisplus/core/mapper/BaseMapper.java
  28. 1 1
      mybatis-plus-core/src/main/java/com/baomidou/mybatisplus/core/metadata/Column.java
  29. 2 2
      mybatis-plus-core/src/main/java/com/baomidou/mybatisplus/core/metadata/GlobalConfiguration.java
  30. 4 4
      mybatis-plus-core/src/main/java/com/baomidou/mybatisplus/core/metadata/TableFieldInfo.java
  31. 2 2
      mybatis-plus-core/src/main/java/com/baomidou/mybatisplus/core/metadata/TableInfo.java
  32. 4 4
      mybatis-plus-core/src/main/java/com/baomidou/mybatisplus/core/pagination/Page.java
  33. 1 1
      mybatis-plus-core/src/main/java/com/baomidou/mybatisplus/core/pagination/PageHelper.java
  34. 1 1
      mybatis-plus-core/src/main/java/com/baomidou/mybatisplus/core/pagination/Pagination.java
  35. 2 2
      mybatis-plus-core/src/main/java/com/baomidou/mybatisplus/core/parser/SqlParserHelper.java
  36. 5 5
      mybatis-plus-core/src/main/java/com/baomidou/mybatisplus/core/toolkit/ClassUtils.java
  37. 1 1
      mybatis-plus-core/src/main/java/com/baomidou/mybatisplus/core/toolkit/EnumUtils.java
  38. 5 4
      mybatis-plus-core/src/main/java/com/baomidou/mybatisplus/core/toolkit/GlobalConfigUtils.java
  39. 7 7
      mybatis-plus-core/src/main/java/com/baomidou/mybatisplus/core/toolkit/IOUtils.java
  40. 1 1
      mybatis-plus-core/src/main/java/com/baomidou/mybatisplus/core/toolkit/IdWorker.java
  41. 2 2
      mybatis-plus-core/src/main/java/com/baomidou/mybatisplus/core/toolkit/PluginUtils.java
  42. 11 11
      mybatis-plus-core/src/main/java/com/baomidou/mybatisplus/core/toolkit/ReflectionKit.java
  43. 10 10
      mybatis-plus-core/src/main/java/com/baomidou/mybatisplus/core/toolkit/Sequence.java
  44. 791 791
      mybatis-plus-core/src/main/java/com/baomidou/mybatisplus/core/toolkit/StringUtils.java
  45. 1 1
      mybatis-plus-core/src/main/java/com/baomidou/mybatisplus/core/toolkit/SystemClock.java
  46. 18 18
      mybatis-plus-core/src/main/java/com/baomidou/mybatisplus/core/toolkit/TableInfoHelper.java
  47. 51 51
      mybatis-plus-core/src/main/java/com/baomidou/mybatisplus/core/toolkit/sql/SqlFormatter.java
  48. 2 2
      mybatis-plus-core/src/main/java/com/baomidou/mybatisplus/core/toolkit/sql/SqlHelper.java
  49. 13 13
      mybatis-plus-core/src/main/java/com/baomidou/mybatisplus/core/toolkit/sql/SqlUtils.java
  50. 2 2
      mybatis-plus-core/src/main/java/com/baomidou/mybatisplus/core/toolkit/sql/StringEscape.java
  51. 1 1
      mybatis-plus-extension/src/main/java/com/baomidou/mybatisplus/extension/MybatisMapWrapperFactory.java
  52. 10 10
      mybatis-plus-extension/src/main/java/com/baomidou/mybatisplus/extension/MybatisSqlSessionTemplate.java
  53. 15 15
      mybatis-plus-extension/src/main/java/com/baomidou/mybatisplus/extension/activerecord/Model.java
  54. 12 12
      mybatis-plus-extension/src/main/java/com/baomidou/mybatisplus/extension/enums/DBType.java
  55. 22 22
      mybatis-plus-extension/src/main/java/com/baomidou/mybatisplus/extension/handlers/BlobTypeHandler.java
  56. 2 2
      mybatis-plus-extension/src/main/java/com/baomidou/mybatisplus/extension/handlers/EnumTypeHandler.java
  57. 1 1
      mybatis-plus-extension/src/main/java/com/baomidou/mybatisplus/extension/handlers/MybatisMapWrapper.java
  58. 1 1
      mybatis-plus-extension/src/main/java/com/baomidou/mybatisplus/extension/incrementer/DB2KeyGenerator.java
  59. 2 2
      mybatis-plus-extension/src/main/java/com/baomidou/mybatisplus/extension/incrementer/H2KeyGenerator.java
  60. 2 2
      mybatis-plus-extension/src/main/java/com/baomidou/mybatisplus/extension/incrementer/OracleKeyGenerator.java
  61. 2 2
      mybatis-plus-extension/src/main/java/com/baomidou/mybatisplus/extension/incrementer/PostgreKeyGenerator.java
  62. 49 49
      mybatis-plus-extension/src/main/java/com/baomidou/mybatisplus/extension/injector/LogicSqlInjector.java
  63. 1 1
      mybatis-plus-extension/src/main/java/com/baomidou/mybatisplus/extension/package-info.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. 20 20
      mybatis-plus-extension/src/main/java/com/baomidou/mybatisplus/extension/plugins/PerformanceInterceptor.java
  68. 10 10
      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. 11 11
      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. 14 14
      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. 15 15
      mybatis-plus-extension/src/main/java/com/baomidou/mybatisplus/extension/service/impl/ServiceImpl.java
  83. 25 25
      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. 6 6
      mybatis-plus-extension/src/main/java/com/baomidou/mybatisplus/extension/toolkit/PackageHelper.java
  87. 13 13
      mybatis-plus-extension/src/main/java/com/baomidou/mybatisplus/extension/toolkit/SqlRunner.java
  88. 4 4
      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. 81 81
      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. 13 13
      mybatis-plus-extension/src/test/java/com/baomidou/mybatisplus/extension/test/h2/H2LogicDeleteTest.java
  97. 22 22
      mybatis-plus-extension/src/test/java/com/baomidou/mybatisplus/extension/test/h2/H2MapUnderline2CamelTest.java
  98. 42 42
      mybatis-plus-extension/src/test/java/com/baomidou/mybatisplus/extension/test/h2/H2MetaObjAndVersionAndOptLockTest.java
  99. 11 11
      mybatis-plus-extension/src/test/java/com/baomidou/mybatisplus/extension/test/h2/H2MetaObjectHandler.java
  100. 15 15
      mybatis-plus-extension/src/test/java/com/baomidou/mybatisplus/extension/test/h2/H2MetaObjectHandlerTest.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 "" ;
 
 }

+ 4 - 4
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." );
     }
 
     /**
@@ -68,14 +68,14 @@ public class MybatisConfiguration extends Configuration {
         if (GlobalConfigUtils.isRefresh(ms.getConfiguration())) {
             /*
              * 支持是否自动刷新 XML 变更内容,开发环境使用【 注:生产环境勿用!】
-			 */
+             */
             this.mappedStatements.remove(ms.getId());
         } else {
             if (this.mappedStatements.containsKey(ms.getId())) {
                 /*
                  * 说明已加载了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;
             }
         }

+ 16 - 16
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) {
@@ -115,7 +115,7 @@ public class MybatisDefaultParameterHandler extends DefaultParameterHandler {
         if (ms.getSqlCommandType() == SqlCommandType.INSERT) {
             isFill = true;
         } else if (ms.getSqlCommandType() == SqlCommandType.UPDATE
-                && metaObjectHandler.openUpdateFill()) {
+            && metaObjectHandler.openUpdateFill()) {
             isFill = true;
         }
         if (isFill) {
@@ -129,7 +129,7 @@ public class MybatisDefaultParameterHandler extends DefaultParameterHandler {
                     } else {
                         /*
                          * 非表映射类不处理
-						 */
+                         */
                         objList.add(parameter);
                     }
                 }
@@ -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++) {

+ 74 - 74
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);
@@ -202,7 +202,7 @@ public class MybatisMapperAnnotationBuilder extends MapperAnnotationBuilder {
             Long flushInterval = cacheDomain.flushInterval() == 0 ? null : cacheDomain.flushInterval();
             Properties props = convertToProperties(cacheDomain.properties());
             assistant.useNewCache(cacheDomain.implementation(), cacheDomain.eviction(), flushInterval, size,
-                    cacheDomain.readWrite(), cacheDomain.blocking(), props);
+                cacheDomain.readWrite(), cacheDomain.blocking(), props);
         }
     }
 
@@ -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,9 +289,9 @@ 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());
+                : discriminator.typeHandler());
             Case[] cases = discriminator.cases();
             Map<String, String> discriminatorMap = new HashMap<>();
             for (Case c : 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);
                 }
@@ -370,30 +370,30 @@ public class MybatisMapperAnnotationBuilder extends MapperAnnotationBuilder {
             }
 
             assistant.addMappedStatement(
-                    mappedStatementId,
-                    sqlSource,
-                    statementType,
-                    sqlCommandType,
-                    fetchSize,
-                    timeout,
-                    // ParameterMapID
-                    null,
-                    parameterTypeClass,
-                    resultMapId,
-                    getReturnType(method),
-                    resultSetType,
-                    flushCache,
-                    useCache,
-                    // TODO gcode issue #577
-                    false,
-                    keyGenerator,
-                    keyProperty,
-                    keyColumn,
-                    // DatabaseID
-                    null,
-                    languageDriver,
-                    // ResultSets
-                    options != null ? nullOrEmpty(options.resultSets()) : null);
+                mappedStatementId,
+                sqlSource,
+                statementType,
+                sqlCommandType,
+                fetchSize,
+                timeout,
+                // ParameterMapID
+                null,
+                parameterTypeClass,
+                resultMapId,
+                getReturnType(method),
+                resultSetType,
+                flushCache,
+                useCache,
+                // TODO gcode issue #577
+                false,
+                keyGenerator,
+                keyProperty,
+                keyColumn,
+                // DatabaseID
+                null,
+                languageDriver,
+                // ResultSets
+                options != null ? nullOrEmpty(options.resultSets()) : null);
         }
     }
 
@@ -411,7 +411,7 @@ public class MybatisMapperAnnotationBuilder extends MapperAnnotationBuilder {
         Class<?>[] parameterTypes = method.getParameterTypes();
         for (Class<?> currentParameterType : parameterTypes) {
             if (!RowBounds.class.isAssignableFrom(currentParameterType)
-                    && !ResultHandler.class.isAssignableFrom(currentParameterType)) {
+                && !ResultHandler.class.isAssignableFrom(currentParameterType)) {
                 if (parameterType == null) {
                     parameterType = currentParameterType;
                 } else {
@@ -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,24 +552,24 @@ 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());
+                ((result.typeHandler() == UnknownTypeHandler.class) ? null : result.typeHandler());
             ResultMapping resultMapping = assistant.buildResultMapping(
-                    resultType,
-                    nullOrEmpty(result.property()),
-                    nullOrEmpty(result.column()),
-                    result.javaType() == void.class ? null : result.javaType(),
-                    result.jdbcType() == JdbcType.UNDEFINED ? null : result.jdbcType(),
-                    hasNestedSelect(result) ? nestedSelectId(result) : null,
-                    null,
-                    null,
-                    null,
-                    typeHandler,
-                    flags,
-                    null,
-                    null,
-                    isLazy(result));
+                resultType,
+                nullOrEmpty(result.property()),
+                nullOrEmpty(result.column()),
+                result.javaType() == void.class ? null : result.javaType(),
+                result.jdbcType() == JdbcType.UNDEFINED ? null : result.jdbcType(),
+                hasNestedSelect(result) ? nestedSelectId(result) : null,
+                null,
+                null,
+                null,
+                typeHandler,
+                flags,
+                null,
+                null,
+                isLazy(result));
             resultMappings.add(resultMapping);
         }
     }
@@ -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,24 +609,24 @@ 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());
+                (arg.typeHandler() == UnknownTypeHandler.class ? null : arg.typeHandler());
             ResultMapping resultMapping = assistant.buildResultMapping(
-                    resultType,
-                    nullOrEmpty(arg.name()),
-                    nullOrEmpty(arg.column()),
-                    arg.javaType() == void.class ? null : arg.javaType(),
-                    arg.jdbcType() == JdbcType.UNDEFINED ? null : arg.jdbcType(),
-                    nullOrEmpty(arg.select()),
-                    nullOrEmpty(arg.resultMap()),
-                    null,
-                    null,
-                    typeHandler,
-                    flags,
-                    null,
-                    null,
-                    false);
+                resultType,
+                nullOrEmpty(arg.name()),
+                nullOrEmpty(arg.column()),
+                arg.javaType() == void.class ? null : arg.javaType(),
+                arg.jdbcType() == JdbcType.UNDEFINED ? null : arg.jdbcType(),
+                nullOrEmpty(arg.select()),
+                nullOrEmpty(arg.resultMap()),
+                null,
+                null,
+                typeHandler,
+                flags,
+                null,
+                null,
+                false);
             resultMappings.add(resultMapping);
         }
     }
@@ -665,8 +665,8 @@ public class MybatisMapperAnnotationBuilder extends MapperAnnotationBuilder {
         SqlCommandType sqlCommandType = SqlCommandType.SELECT;
 
         assistant.addMappedStatement(id, sqlSource, statementType, sqlCommandType, fetchSize, timeout, parameterMap, parameterTypeClass, resultMap, resultTypeClass, resultSetTypeEnum,
-                flushCache, useCache, false,
-                keyGenerator, keyProperty, keyColumn, null, languageDriver, null);
+            flushCache, useCache, false,
+            keyGenerator, keyProperty, keyColumn, null, languageDriver, null);
 
         id = assistant.applyCurrentNamespace(id, false);
 

+ 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);

+ 78 - 78
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,49 +247,49 @@ 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)
-                            .dataSource(dataSource);
+                        .transactionFactory(txFactory)
+                        .dataSource(dataSource);
                     configuration.setEnvironment(environmentBuilder.build());
                 }
             }
@@ -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);
@@ -380,7 +380,7 @@ public class MybatisXMLConfigBuilder extends BaseBuilder {
                 InputStream inputStream = Resources.getResourceAsStream(resource);
                 //TODO
                 XMLMapperBuilder mapperParser = new XMLMapperBuilder(inputStream, configuration, resource,
-                        configuration.getSqlFragments());
+                    configuration.getSqlFragments());
                 mapperParser.parse();
             }
             for (Class<?> mapper : mapperClasses) {
@@ -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 {
 
     /**

+ 4 - 4
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> {
 
     /**
@@ -63,7 +63,7 @@ public class EntityWrapper<T> extends Wrapper<T> {
     public String getSqlSegment() {
         /*
          * 无条件
-		 */
+         */
         String sqlWhere = sql.toString();
         if (StringUtils.isEmpty(sqlWhere)) {
             return null;
@@ -71,8 +71,8 @@ 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 handerNull(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);

+ 39 - 38
mybatis-plus-core/src/main/java/com/baomidou/mybatisplus/core/conditions/Wrapper.java

@@ -42,19 +42,19 @@ import com.baomidou.mybatisplus.core.toolkit.StringUtils;
  * @author hubin , yanghu , Dyang , Caratacus
  * @Date 2016-11-7
  */
-@SuppressWarnings("serial")
+@SuppressWarnings("serial" )
 public abstract class Wrapper<T> implements Serializable {
 
     /**
      * 占位符
      */
-    private static final String PLACE_HOLDER = "{%s}";
+    private static final String PLACE_HOLDER = "{%s}" ;
 
-    private static final String MYBATIS_PLUS_TOKEN = "#{%s.paramNameValuePairs.%s}";
+    private static final String MYBATIS_PLUS_TOKEN = "#{%s.paramNameValuePairs.%s}" ;
 
-    private static final String MP_GENERAL_PARAMNAME = "MPGENVAL";
+    private static final String MP_GENERAL_PARAMNAME = "MPGENVAL" ;
 
-    private static final String DEFAULT_PARAM_ALIAS = "ew";
+    private static final String DEFAULT_PARAM_ALIAS = "ew" ;
     /**
      * 实现了TSQL语法的SQL实体
      */
@@ -73,7 +73,7 @@ public abstract class Wrapper<T> implements Serializable {
     /**
      * 拼接WHERE后应该是AND还是ORnull
      */
-    protected String AND_OR = "AND";
+    protected String AND_OR = "AND" ;
 
     /**
      * <p>
@@ -129,7 +129,7 @@ public abstract class Wrapper<T> implements Serializable {
         for (String column : columns) {
             if (StringUtils.isNotEmpty(column)) {
                 if (builder.length() > 0) {
-                    builder.append(",");
+                    builder.append("," );
                 }
                 builder.append(column);
             }
@@ -158,7 +158,7 @@ public abstract class Wrapper<T> implements Serializable {
                     }
                     builder.append(col).append(as);
                     if (i < column.length - 1) {
-                        builder.append(",");
+                        builder.append("," );
                     }
                 }
             }
@@ -192,13 +192,13 @@ public abstract class Wrapper<T> implements Serializable {
 
     @Override
     public String toString() {
-        StringBuilder sb = new StringBuilder("Wrapper<T>:");
+        StringBuilder sb = new StringBuilder("Wrapper<T>:" );
         String sqlSegment = getSqlSegment();
         sb.append(replacePlaceholder(sqlSegment));
         Object entity = getEntity();
         if (entity != null) {
-            sb.append("\n");
-            sb.append("entity=").append(entity.toString());
+            sb.append("\n" );
+            sb.append("entity=" ).append(entity.toString());
         }
         return sb.toString();
     }
@@ -215,7 +215,7 @@ public abstract class Wrapper<T> implements Serializable {
         if (StringUtils.isEmpty(sqlSegment)) {
             return StringUtils.EMPTY;
         }
-        return sqlSegment.replaceAll("#\\{" + getParamAlias() + ".paramNameValuePairs.MPGENVAL[0-9]+}", "\\?");
+        return sqlSegment.replaceAll("#\\{" + getParamAlias() + ".paramNameValuePairs.MPGENVAL[0-9]+}" , "\\?" );
     }
 
     /**
@@ -283,7 +283,7 @@ public abstract class Wrapper<T> implements Serializable {
      */
     public Wrapper<T> eq(boolean condition, String column, Object params) {
         if (condition) {
-            sql.WHERE(formatSql(String.format("%s = {0}", column), params));
+            sql.WHERE(formatSql(String.format("%s = {0}" , column), params));
         }
         return this;
     }
@@ -313,7 +313,7 @@ public abstract class Wrapper<T> implements Serializable {
      */
     public Wrapper<T> ne(boolean condition, String column, Object params) {
         if (condition) {
-            sql.WHERE(formatSql(String.format("%s <> {0}", column), params));
+            sql.WHERE(formatSql(String.format("%s <> {0}" , column), params));
         }
         return this;
     }
@@ -341,7 +341,7 @@ public abstract class Wrapper<T> implements Serializable {
      * @param params
      * @return
      */
-    @SuppressWarnings({"rawtypes", "unchecked"})
+    @SuppressWarnings({"rawtypes" , "unchecked"})
     public Wrapper<T> allEq(boolean condition, Map<String, Object> params) {
         if (condition && MapUtils.isNotEmpty(params)) {
             Iterator iterator = params.entrySet().iterator();
@@ -349,7 +349,7 @@ public abstract class Wrapper<T> implements Serializable {
                 Map.Entry<String, Object> entry = (Map.Entry<String, Object>) iterator.next();
                 Object value = entry.getValue();
                 if (StringUtils.checkValNotNull(value)) {
-                    sql.WHERE(formatSql(String.format("%s = {0}", entry.getKey()), entry.getValue()));
+                    sql.WHERE(formatSql(String.format("%s = {0}" , entry.getKey()), entry.getValue()));
                 }
 
             }
@@ -366,7 +366,7 @@ public abstract class Wrapper<T> implements Serializable {
      * @param params
      * @return
      */
-    @SuppressWarnings({"rawtypes", "unchecked"})
+    @SuppressWarnings({"rawtypes" , "unchecked"})
     public Wrapper<T> allEq(Map<String, Object> params) {
         return allEq(true, params);
     }
@@ -383,7 +383,7 @@ public abstract class Wrapper<T> implements Serializable {
      */
     public Wrapper<T> gt(boolean condition, String column, Object params) {
         if (condition) {
-            sql.WHERE(formatSql(String.format("%s > {0}", column), params));
+            sql.WHERE(formatSql(String.format("%s > {0}" , column), params));
         }
         return this;
     }
@@ -413,7 +413,7 @@ public abstract class Wrapper<T> implements Serializable {
      */
     public Wrapper<T> ge(boolean condition, String column, Object params) {
         if (condition) {
-            sql.WHERE(formatSql(String.format("%s >= {0}", column), params));
+            sql.WHERE(formatSql(String.format("%s >= {0}" , column), params));
         }
         return this;
     }
@@ -443,7 +443,7 @@ public abstract class Wrapper<T> implements Serializable {
      */
     public Wrapper<T> lt(boolean condition, String column, Object params) {
         if (condition) {
-            sql.WHERE(formatSql(String.format("%s < {0}", column), params));
+            sql.WHERE(formatSql(String.format("%s < {0}" , column), params));
         }
         return this;
     }
@@ -473,7 +473,7 @@ public abstract class Wrapper<T> implements Serializable {
      */
     public Wrapper<T> le(boolean condition, String column, Object params) {
         if (condition) {
-            sql.WHERE(formatSql(String.format("%s <= {0}", column), params));
+            sql.WHERE(formatSql(String.format("%s <= {0}" , column), params));
         }
         return this;
     }
@@ -613,7 +613,7 @@ public abstract class Wrapper<T> implements Serializable {
     public Wrapper<T> or(boolean condition, String sqlOr, Object... params) {
         if (condition) {
             if (StringUtils.isEmpty(sql.toString())) {
-                AND_OR = "OR";
+                AND_OR = "OR" ;
             }
             sql.OR().WHERE(formatSql(sqlOr, params));
         }
@@ -666,7 +666,7 @@ public abstract class Wrapper<T> implements Serializable {
     public Wrapper<T> orNew(boolean condition, String sqlOr, Object... params) {
         if (condition) {
             if (StringUtils.isEmpty(sql.toString())) {
-                AND_OR = "OR";
+                AND_OR = "OR" ;
             }
             sql.OR_NEW().WHERE(formatSql(sqlOr, params));
         }
@@ -808,7 +808,7 @@ public abstract class Wrapper<T> implements Serializable {
      */
     public Wrapper<T> orderBy(boolean condition, String columns, boolean isAsc) {
         if (condition && StringUtils.isNotEmpty(columns)) {
-            sql.ORDER_BY(columns + (isAsc ? " ASC" : " DESC"));
+            sql.ORDER_BY(columns + (isAsc ? " ASC" : " DESC" ));
         }
         return this;
     }
@@ -943,9 +943,9 @@ public abstract class Wrapper<T> implements Serializable {
             StringBuilder inSql = new StringBuilder();
             inSql.append(column);
             if (isNot) {
-                inSql.append(" NOT");
+                inSql.append(" NOT" );
             }
-            inSql.append(" LIKE {0}");
+            inSql.append(" LIKE {0}" );
             sql.WHERE(formatSql(inSql.toString(), SqlUtils.concatLike(value, type)));
         }
     }
@@ -1138,7 +1138,7 @@ public abstract class Wrapper<T> implements Serializable {
      */
     public Wrapper<T> in(boolean condition, String column, String value) {
         if (condition && StringUtils.isNotEmpty(value)) {
-            in(column, StringUtils.splitWorker(value, ",", -1, false));
+            in(column, StringUtils.splitWorker(value, "," , -1, false));
         }
         return this;
     }
@@ -1168,7 +1168,7 @@ public abstract class Wrapper<T> implements Serializable {
      */
     public Wrapper<T> notIn(boolean condition, String column, String value) {
         if (condition && StringUtils.isNotEmpty(value)) {
-            notIn(column, StringUtils.splitWorker(value, ",", -1, false));
+            notIn(column, StringUtils.splitWorker(value, "," , -1, false));
         }
         return this;
     }
@@ -1320,18 +1320,18 @@ public abstract class Wrapper<T> implements Serializable {
             StringBuilder inSql = new StringBuilder();
             inSql.append(column);
             if (isNot) {
-                inSql.append(" NOT");
+                inSql.append(" NOT" );
             }
-            inSql.append(" IN ");
-            inSql.append("(");
+            inSql.append(" IN " );
+            inSql.append("(" );
             int size = value.size();
             for (int i = 0; i < size; i++) {
                 inSql.append(String.format(PLACE_HOLDER, i));
                 if (i + 1 < size) {
-                    inSql.append(",");
+                    inSql.append("," );
                 }
             }
-            inSql.append(")");
+            inSql.append(")" );
             return inSql.toString();
         }
         return null;
@@ -1350,7 +1350,7 @@ public abstract class Wrapper<T> implements Serializable {
      */
     public Wrapper<T> between(boolean condition, String column, Object val1, Object val2) {
         if (condition) {
-            sql.WHERE(formatSql(String.format("%s BETWEEN {0} AND {1}", column), val1, val2));
+            sql.WHERE(formatSql(String.format("%s BETWEEN {0} AND {1}" , column), val1, val2));
         }
         return this;
     }
@@ -1382,7 +1382,7 @@ public abstract class Wrapper<T> implements Serializable {
      */
     public Wrapper<T> notBetween(boolean condition, String column, Object val1, Object val2) {
         if (condition) {
-            sql.WHERE(formatSql(String.format("%s NOT BETWEEN {0} AND {1}", column), val1, val2));
+            sql.WHERE(formatSql(String.format("%s NOT BETWEEN {0} AND {1}" , column), val1, val2));
         }
         return this;
     }
@@ -1532,10 +1532,10 @@ public abstract class Wrapper<T> implements Serializable {
      */
     public Wrapper<T> setParamAlias(String paramAlias) {
         if (StringUtils.isNotEmpty(getSqlSegment())) {
-            throw new MybatisPlusException("Error: Please call this method when initializing!");
+            throw new MybatisPlusException("Error: Please call this method when initializing!" );
         }
         if (StringUtils.isNotEmpty(this.paramAlias)) {
-            throw new MybatisPlusException("Error: Please do not call the method repeatedly!");
+            throw new MybatisPlusException("Error: Please do not call the method repeatedly!" );
         }
         this.paramAlias = paramAlias;
         return this;
@@ -1545,12 +1545,13 @@ public abstract class Wrapper<T> implements Serializable {
     public boolean isEmptyWrapper() {
         return checkWrapperEmpty();
     }
+
     //TODO: 3.0 提供protect方法,让子类可覆盖
     protected boolean checkWrapperEmpty() {
         return sql.isEmptyOfWhere() && sqlSelect == null;
     }
 
-    public static <T> Wrapper<T> getInstance(){
+    public static <T> Wrapper<T> getInstance() {
         return new Wrapper<T>() {
             @Override
             public String getSqlSegment() {

+ 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;

+ 2 - 2
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>
@@ -112,7 +112,7 @@ public abstract class MetaObjectHandler {
         return true;
     }
 
-    public static MetaObjectHandler getInstance(){
+    public static MetaObjectHandler getInstance() {
         return new MetaObjectHandler() {
             @Override
             public void insertFill(MetaObject metaObject) {

+ 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);

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

@@ -100,7 +100,7 @@ public class AutoSqlInjector implements ISqlInjector {
         this.languageDriver = configuration.getDefaultScriptingLanguageInstance();
         /**
          * 驼峰设置 PLUS 配置 > 原始配置
-		 */
+         */
         GlobalConfiguration globalCache = this.getGlobalConfig();
         if (!globalCache.isDbColumnUnderline()) {
             globalCache.setDbColumnUnderline(configuration.isMapUnderscoreToCamelCase());
@@ -145,8 +145,8 @@ 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.",
-                    modelClass.toString()));
+            logger.warn(String.format("%s ,Not found @TableId annotation, Cannot use Mybatis-Plus 'xxById' Method." ,
+                modelClass.toString()));
         }
         /**
          * 正常注入无需主键方法
@@ -192,12 +192,12 @@ public class AutoSqlInjector implements ISqlInjector {
         for (Type type : types) {
             if (type instanceof ParameterizedType) {
                 Type[] typeArray = ((ParameterizedType) type).getActualTypeArguments();
-                if(ArrayUtils.isNotEmpty(typeArray)){
-                    for (Type t:typeArray) {
-                        if(t instanceof TypeVariable || t instanceof WildcardType){
+                if (ArrayUtils.isNotEmpty(typeArray)) {
+                    for (Type t : typeArray) {
+                        if (t instanceof TypeVariable || t instanceof WildcardType) {
                             target = null;
                             break;
-                        }else {
+                        } else {
                             target = (ParameterizedType) type;
                             break;
                         }
@@ -222,17 +222,17 @@ public class AutoSqlInjector implements ISqlInjector {
     protected void injectInsertOneSql(boolean selective, Class<?> mapperClass, Class<?> modelClass, TableInfo table) {
         /*
          * INSERT INTO table <trim prefix="(" suffix=")" suffixOverrides=",">
-		 * <if test="xx != null">xx,</if> </trim> <trim prefix="values ("
-		 * suffix=")" suffixOverrides=","> <if test="xx != null">#{xx},</if>
-		 * </trim>
-		 */
+         * <if test="xx != null">xx,</if> </trim> <trim prefix="values ("
+         * suffix=")" suffixOverrides=","> <if test="xx != null">#{xx},</if>
+         * </trim>
+         */
         KeyGenerator keyGenerator = new NoKeyGenerator();
         StringBuilder fieldBuilder = new StringBuilder();
         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;
 
@@ -248,13 +248,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("}," );
                 }
             }
         }
@@ -265,26 +265,26 @@ public class AutoSqlInjector implements ISqlInjector {
         for (TableFieldInfo fieldInfo : fieldList) {
             // 在FieldIgnore,INSERT_UPDATE,INSERT 时设置为false
             ifTag = !(FieldFill.INSERT == fieldInfo.getFieldFill()
-                    || FieldFill.INSERT_UPDATE == fieldInfo.getFieldFill());
+                || 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());
+            placeholderBuilder.toString());
         SqlSource sqlSource = languageDriver.createSqlSource(configuration, sql, modelClass);
         this.addInsertMappedStatement(mapperClass, modelClass, sqlMethod.getMethod(), sqlSource, keyGenerator, keyProperty,
-                keyColumn);
+            keyColumn);
     }
 
     /**
@@ -335,9 +335,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);
@@ -356,13 +356,13 @@ 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(),
-                "et." + table.getKeyProperty(),
-                "<if test=\"et instanceof java.util.Map\">"
-                        + "<if test=\"et.MP_OPTLOCK_VERSION_ORIGINAL!=null\">"
-                        + "and ${et.MP_OPTLOCK_VERSION_COLUMN}=#{et.MP_OPTLOCK_VERSION_ORIGINAL}"
-                        + "</if>"
-                        + "</if>"
+        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\">"
+                + "and ${et.MP_OPTLOCK_VERSION_COLUMN}=#{et.MP_OPTLOCK_VERSION_ORIGINAL}"
+                + "</if>"
+                + "</if>"
         );
         SqlSource sqlSource = languageDriver.createSqlSource(configuration, sql, modelClass);
         this.addUpdateMappedStatement(mapperClass, modelClass, sqlMethod.getMethod(), sqlSource);
@@ -379,7 +379,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);
     }
@@ -400,14 +400,14 @@ 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);
+                sqlSelectColumns(table, false), table.getTableName(), table.getKeyColumn(), ids.toString()), modelClass);
         } else {
             sqlSource = new RawSqlSource(configuration, String.format(sqlMethod.getSql(), sqlSelectColumns(table, false),
-                    table.getTableName(), table.getKeyColumn(), table.getKeyProperty()), Object.class);
+                table.getTableName(), table.getKeyColumn(), table.getKeyProperty()), Object.class);
         }
         this.addSelectMappedStatement(mapperClass, sqlMethod.getMethod(), sqlSource, modelClass, table);
     }
@@ -456,7 +456,7 @@ public class AutoSqlInjector implements ISqlInjector {
      */
     protected void injectSelectListSql(SqlMethod sqlMethod, Class<?> mapperClass, Class<?> modelClass, TableInfo table) {
         String sql = String.format(sqlMethod.getSql(), sqlSelectColumns(table, true), table.getTableName(),
-                sqlWhereEntityWrapper(table));
+            sqlWhereEntityWrapper(table));
         SqlSource sqlSource = languageDriver.createSqlSource(configuration, sql, modelClass);
         this.addSelectMappedStatement(mapperClass, sqlMethod.getMethod(), sqlSource, modelClass, table);
     }
@@ -473,7 +473,7 @@ public class AutoSqlInjector implements ISqlInjector {
      */
     protected void injectSelectMapsSql(SqlMethod sqlMethod, Class<?> mapperClass, Class<?> modelClass, TableInfo table) {
         String sql = String.format(sqlMethod.getSql(), sqlSelectColumns(table, true), table.getTableName(),
-                sqlWhereEntityWrapper(table));
+            sqlWhereEntityWrapper(table));
         SqlSource sqlSource = languageDriver.createSqlSource(configuration, sql, modelClass);
         this.addSelectMappedStatement(mapperClass, sqlMethod.getMethod(), sqlSource, Map.class, table);
     }
@@ -490,7 +490,7 @@ public class AutoSqlInjector implements ISqlInjector {
      */
     protected void injectSelectObjsSql(SqlMethod sqlMethod, Class<?> mapperClass, Class<?> modelClass, TableInfo table) {
         String sql = String.format(sqlMethod.getSql(), sqlSelectObjsColumns(table), table.getTableName(),
-                sqlWhereEntityWrapper(table));
+            sqlWhereEntityWrapper(table));
         SqlSource sqlSource = languageDriver.createSqlSource(configuration, sql, modelClass);
         this.addSelectMappedStatement(mapperClass, sqlMethod.getMethod(), sqlSource, Object.class, table);
     }
@@ -530,26 +530,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();
     }
 
@@ -565,7 +565,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;
@@ -573,30 +573,30 @@ public class AutoSqlInjector implements ISqlInjector {
         for (TableFieldInfo fieldInfo : fieldList) {
             // 判断是否更新忽略,在FieldIgnore,UPDATE,INSERT_UPDATE设置为false
             ifTag = !(FieldFill.UPDATE == fieldInfo.getFieldFill()
-                    || FieldFill.INSERT_UPDATE == fieldInfo.getFieldFill());
+                || 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,20 +630,20 @@ public class AutoSqlInjector implements ISqlInjector {
         if (null != table.getResultMap()) {
             /*
              * 存在 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;
@@ -654,13 +654,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("," );
                 }
             }
 
@@ -677,22 +677,22 @@ 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>" );
             }
         }
 
-		/*
+        /*
          * 返回所有查询字段内容
-		 */
+         */
         return columns.toString();
     }
 
@@ -708,12 +708,12 @@ public class AutoSqlInjector implements ISqlInjector {
         StringBuilder columns = new StringBuilder();
         /*
          * 普通查询
-		 */
-        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()));
             }
@@ -729,11 +729,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();
     }
 
@@ -744,20 +744,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();
     }
 
@@ -768,17 +768,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();
     }
 
@@ -798,7 +798,7 @@ public class AutoSqlInjector implements ISqlInjector {
         FieldStrategy fieldStrategy = fieldInfo.getFieldStrategy();
         if (fieldStrategy == FieldStrategy.IGNORED) {
             if (ignored) {
-                return "";
+                return "" ;
             }
             // 查询策略,使用全局策略
             fieldStrategy = this.getGlobalConfig().getFieldStrategy();
@@ -806,10 +806,10 @@ public class AutoSqlInjector implements ISqlInjector {
 
         // 关闭标签
         if (close) {
-            return "</if>";
+            return "</if>" ;
         }
 
-		/** 前缀处理 */
+        /** 前缀处理 */
         String property = fieldInfo.getProperty();
         Class propertyType = fieldInfo.getPropertyType();
         property = StringUtils.removeIsPrefixIfBoolean(property, propertyType);
@@ -819,13 +819,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);
         }
     }
 
@@ -851,13 +851,13 @@ public class AutoSqlInjector implements ISqlInjector {
             if (null != resultMap) {
                 /** 返回 resultMap 映射结果集 */
                 return this.addMappedStatement(mapperClass, id, sqlSource, SqlCommandType.SELECT, null, resultMap, null,
-                        new NoKeyGenerator(), null, null);
+                    new NoKeyGenerator(), null, null);
             }
         }
 
-		/** 普通查询 */
+        /** 普通查询 */
         return this.addMappedStatement(mapperClass, id, sqlSource, SqlCommandType.SELECT, null, null, resultType,
-                new NoKeyGenerator(), null, null);
+            new NoKeyGenerator(), null, null);
     }
 
     /**
@@ -866,7 +866,7 @@ public class AutoSqlInjector implements ISqlInjector {
     public MappedStatement addInsertMappedStatement(Class<?> mapperClass, Class<?> modelClass, String id, SqlSource sqlSource,
                                                     KeyGenerator keyGenerator, String keyProperty, String keyColumn) {
         return this.addMappedStatement(mapperClass, id, sqlSource, SqlCommandType.INSERT, modelClass, null, Integer.class,
-                keyGenerator, keyProperty, keyColumn);
+            keyGenerator, keyProperty, keyColumn);
     }
 
     /**
@@ -874,7 +874,7 @@ public class AutoSqlInjector implements ISqlInjector {
      */
     public MappedStatement addDeleteMappedStatement(Class<?> mapperClass, String id, SqlSource sqlSource) {
         return this.addMappedStatement(mapperClass, id, sqlSource, SqlCommandType.DELETE, null, null, Integer.class,
-                new NoKeyGenerator(), null, null);
+            new NoKeyGenerator(), null, null);
     }
 
     /**
@@ -882,7 +882,7 @@ public class AutoSqlInjector implements ISqlInjector {
      */
     public MappedStatement addUpdateMappedStatement(Class<?> mapperClass, Class<?> modelClass, String id, SqlSource sqlSource) {
         return this.addMappedStatement(mapperClass, id, sqlSource, SqlCommandType.UPDATE, modelClass, null, Integer.class,
-                new NoKeyGenerator(), null, null);
+            new NoKeyGenerator(), null, null);
     }
 
     public MappedStatement addMappedStatement(Class<?> mapperClass, String id, SqlSource sqlSource,
@@ -891,17 +891,17 @@ 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;
         }
-		/** 缓存逻辑处理 */
+        /** 缓存逻辑处理 */
         boolean isSelect = false;
         if (sqlCommandType == SqlCommandType.SELECT) {
             isSelect = true;
         }
         return builderAssistant.addMappedStatement(id, sqlSource, StatementType.PREPARED, sqlCommandType, null, null, null,
-                parameterClass, resultMap, resultType, null, !isSelect, isSelect, false, keyGenerator, keyProperty, keyColumn,
-                configuration.getDatabaseId(), languageDriver, null);
+            parameterClass, resultMap, resultType, null, !isSelect, isSelect, false, keyGenerator, keyProperty, keyColumn,
+            configuration.getDatabaseId(), languageDriver, null);
     }
 
     // --------------------------------------------------------SqlRunner------------------------------------------------------------
@@ -935,15 +935,15 @@ 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))
-                                .build());
-                    }
-                }).build();
+            .resultMaps(new ArrayList<ResultMap>() {
+                {
+                    add(new ResultMap.Builder(configuration, "defaultResultMap" , resultType, new ArrayList<ResultMapping>(0))
+                        .build());
+                }
+            }).build();
         // 缓存
         configuration.addMappedStatement(ms);
     }
@@ -955,15 +955,15 @@ 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))
-                                .build());
-                    }
-                }).build();
+            new ArrayList<ResultMap>() {
+                {
+                    add(new ResultMap.Builder(configuration, "defaultResultMap" , int.class, new ArrayList<ResultMapping>(0))
+                        .build());
+                }
+            }).build();
         // 缓存
         configuration.addMappedStatement(ms);
     }
@@ -973,7 +973,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);
@@ -985,7 +985,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);
@@ -997,7 +997,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);
@@ -1009,7 +1009,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);
@@ -1021,7 +1021,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);
@@ -1033,7 +1033,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);

+ 17 - 17
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,18 +197,18 @@ 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>
      * 根据 Wrapper 条件,查询全部记录
-	 *   注意: 只返回第一个字段的值
+     * 注意: 只返回第一个字段的值
      * </p>
      *
      * @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 " ;
 
     /**
      * 获取实例

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

@@ -241,7 +241,7 @@ public class GlobalConfiguration implements Serializable {
 //        this.sqlSession = new MybatisSqlSessionTemplate(sqlSessionFactory);
     }
 
-    public GlobalConfiguration setSqlSession(SqlSession sqlSession){
+    public GlobalConfiguration setSqlSession(SqlSession sqlSession) {
         this.sqlSession = sqlSession;
         return this;
     }
@@ -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));
         }
     }
 

+ 4 - 4
mybatis-plus-core/src/main/java/com/baomidou/mybatisplus/core/metadata/TableFieldInfo.java

@@ -106,8 +106,8 @@ public class TableFieldInfo {
          * 设置 related 为 true
          */
         if (StringUtils.isEmpty(tableField.value())
-                && globalConfig.isDbColumnUnderline()) {
-             /* 开启字段下划线申明 */
+            && globalConfig.isDbColumnUnderline()) {
+            /* 开启字段下划线申明 */
             this.related = true;
             this.setColumn(globalConfig, StringUtils.camelToUnderline(column));
         } else {
@@ -120,7 +120,7 @@ public class TableFieldInfo {
         /*
          * 优先使用单个字段注解,否则使用全局配置<br>
          * 自定义字段验证策略 fixed-239
-		 */
+         */
         if (FieldStrategy.NOT_NULL != tableField.strategy()) {
             this.fieldStrategy = tableField.strategy();
         } else {
@@ -131,7 +131,7 @@ public class TableFieldInfo {
         this.condition = tableField.condition();
         /*
          * 保存当前字段的填充策略
-		 */
+         */
         this.fieldFill = tableField.fill();
     }
 

+ 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());
     }

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

@@ -46,7 +46,7 @@ public class EnumUtils {
                 return e;
             } else if (value instanceof Number) {
                 if (e.getValue() instanceof Number &&
-                        ((Number) value).doubleValue() == ((Number) e.getValue()).doubleValue()) {
+                    ((Number) value).doubleValue() == ((Number) e.getValue()).doubleValue()) {
                     return e;
                 }
             } else if (String.valueOf(value).equals(String.valueOf(e.getValue()))) {

+ 5 - 4
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;
         }
@@ -179,9 +179,10 @@ public class GlobalConfigUtils {
      * <p>
      * 设置元数据相关属性
      * </p>
-     * @deprecated 3.0
+     *
      * @param dataSource   数据源
      * @param globalConfig 全局配置
+     * @deprecated 3.0
      */
     @Deprecated
     public static void setMetaData(DataSource dataSource, GlobalConfiguration globalConfig) {

+ 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;
     }

+ 11 - 11
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,16 +76,16 @@ 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:",
-                    cls.getSimpleName())
-                    + e);
+            throw new MybatisPlusException(String.format("Error: Cannot execute a private method. in %s.  Cause:" ,
+                cls.getSimpleName())
+                + e);
         } catch (InvocationTargetException e) {
             throw new MybatisPlusException("Error: InvocationTargetException on getMethodValue.  Cause:" + 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(),
-                    params.length));
+            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];

+ 10 - 10
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;
@@ -91,12 +91,12 @@ public class Sequence {
         if (StringUtils.isNotEmpty(name)) {
             /*
              * GET jvmPid
-			 */
-            mpid.append(name.split("@")[0]);
+             */
+            mpid.append(name.split("@" )[0]);
         }
         /*
          * MAC + PID 的 hashcode 获取16个低位
-		 */
+         */
         return (mpid.toString().hashCode() & 0xffff) % (maxWorkerId + 1);
     }
 
@@ -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));
             }
         }
 
@@ -164,9 +164,9 @@ public class Sequence {
         lastTimestamp = timestamp;
 
         return ((timestamp - twepoch) << timestampLeftShift)    // 时间戳部分
-                | (datacenterId << datacenterIdShift)           // 数据中心部分
-                | (workerId << workerIdShift)                   // 机器标识部分
-                | sequence;                                     // 序列号部分
+            | (datacenterId << datacenterIdShift)           // 数据中心部分
+            | (workerId << workerIdShift)                   // 机器标识部分
+            | sequence;                                     // 序列号部分
     }
 
     protected long tilNextMillis(long lastTimestamp) {

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

@@ -37,795 +37,795 @@ import com.baomidou.mybatisplus.core.toolkit.sql.StringEscape;
  */
 public class StringUtils {
 
-	/**
-	 * UTF-8 编码格式
-	 */
-	public static final String UTF8 = "UTF-8";
-
-	/**
-	 * 空字符
-	 */
-	public static final String EMPTY = "";
-	/**
-	 * 字符串 is
-	 */
-	public static final String IS = "is";
-
-	/**
-	 * 下划线字符
-	 */
-	public static final char UNDERLINE = '_';
-
-	/**
-	 * 占位符
-	 */
-	public static final String PLACE_HOLDER = "{%s}";
-
-	private static boolean separatorBeforeDigit = false;
-	private static boolean separatorAfterDigit = true;
-
-
-	private StringUtils() {
-	}
-
-
-	/**
-	 * <p>
-	 * Blob 转为 String 格式
-	 * </p>
-	 *
-	 * @param blob Blob 对象
-	 * @return
-	 */
-	public static String blob2String(Blob blob) {
-		if (null != blob) {
-			try {
-				byte[] returnValue = blob.getBytes(1, (int) blob.length());
-				return new String(returnValue, UTF8);
-			} catch (Exception e) {
-				throw new MybatisPlusException("Blob Convert To String Error!");
-			}
-		}
-		return null;
-	}
-
-	/**
-	 * <p>
-	 * 判断字符串是否为空
-	 * </p>
-	 *
-	 * @param cs 需要判断字符串
-	 * @return 判断结果
-	 */
-	public static boolean isEmpty(final CharSequence cs) {
-		int strLen;
-		if (cs == null || (strLen = cs.length()) == 0) {
-			return true;
-		}
-		for (int i = 0; i < strLen; i++) {
-			if (!Character.isWhitespace(cs.charAt(i))) {
-				return false;
-			}
-		}
-		return true;
-	}
-
-	/**
-	 * <p>
-	 * 判断字符串是否不为空
-	 * </p>
-	 *
-	 * @param cs 需要判断字符串
-	 * @return 判断结果
-	 */
-	public static boolean isNotEmpty(final CharSequence cs) {
-		return !isEmpty(cs);
-	}
-
-	/**
-	 * <p>
-	 * 字符串驼峰转下划线格式
-	 * </p>
-	 *
-	 * @param param 需要转换的字符串
-	 * @return 转换好的字符串
-	 */
-	public static String camelToUnderline(String param) {
-		if (isEmpty(param)) {
-			return EMPTY;
-		}
-		int len = param.length();
-		StringBuilder sb = new StringBuilder(len);
-		for (int i = 0; i < len; i++) {
-			char c = param.charAt(i);
-			if (Character.isUpperCase(c) && i > 0) {
-				sb.append(UNDERLINE);
-			}
-			sb.append(Character.toLowerCase(c));
-		}
-		return sb.toString();
-	}
-
-	/**
-	 * <p>
-	 * 字符串下划线转驼峰格式
-	 * </p>
-	 *
-	 * @param param 需要转换的字符串
-	 * @return 转换好的字符串
-	 */
-	public static String underlineToCamel(String param) {
-		if (isEmpty(param)) {
-			return EMPTY;
-		}
-		String temp = param.toLowerCase();
-		int len = temp.length();
-		StringBuilder sb = new StringBuilder(len);
-		for (int i = 0; i < len; i++) {
-			char c = temp.charAt(i);
-			if (c == UNDERLINE) {
-				if (++i < len) {
-					sb.append(Character.toUpperCase(temp.charAt(i)));
-				}
-			} else {
-				sb.append(c);
-			}
-		}
-		return sb.toString();
-	}
-
-	/**
-	 * <p>
-	 * 首字母转换小写
-	 * </p>
-	 *
-	 * @param param 需要转换的字符串
-	 * @return 转换好的字符串
-	 */
-	public static String firstToLowerCase(String param) {
-		if (isEmpty(param)) {
-			return EMPTY;
-		}
-		StringBuilder sb = new StringBuilder(param.length());
-		sb.append(param.substring(0, 1).toLowerCase());
-		sb.append(param.substring(1));
-		return sb.toString();
-	}
-
-	/**
-	 * <p>
-	 * 判断字符串是否为纯大写字母
-	 * </p>
-	 *
-	 * @param str 要匹配的字符串
-	 * @return
-	 */
-	public static boolean isUpperCase(String str) {
-		return match("^[A-Z]+$", str);
-	}
-
-	/**
-	 * <p>
-	 * 正则表达式匹配
-	 * </p>
-	 *
-	 * @param regex 正则表达式字符串
-	 * @param str   要匹配的字符串
-	 * @return 如果str 符合 regex的正则表达式格式,返回true, 否则返回 false;
-	 */
-	public static boolean match(String regex, String str) {
-		Pattern pattern = Pattern.compile(regex);
-		Matcher matcher = pattern.matcher(str);
-		return matcher.matches();
-	}
-
-	/**
-	 * <p>
-	 * SQL 参数填充
-	 * </p>
-	 *
-	 * @param content 填充内容
-	 * @param args    填充参数
-	 * @return
-	 */
-	public static String sqlArgsFill(String content, Object... args) {
-		if (StringUtils.isEmpty(content)) {
-			return null;
-		}
-		if (args != null) {
-			int length = args.length;
-			if (length >= 1) {
-				for (int i = 0; i < length; i++) {
-					content = content.replace(String.format(PLACE_HOLDER, i), sqlParam(args[i]));
-				}
-			}
-		}
-		return content;
-	}
-
-	/**
-	 * <p>
-	 * 获取SQL PARAMS字符串
-	 * </p>
-	 *
-	 * @param obj
-	 * @return
-	 */
-	public static String sqlParam(Object obj) {
-		String repStr;
-		if (obj instanceof Collection) {
-			repStr = StringUtils.quotaMarkList((Collection<?>) obj);
-		} else {
-			repStr = StringUtils.quotaMark(obj);
-		}
-		return repStr;
-	}
-
-	/**
-	 * <p>
-	 * 使用单引号包含字符串
-	 * </p>
-	 *
-	 * @param obj 原字符串
-	 * @return 单引号包含的原字符串
-	 */
-	public static String quotaMark(Object obj) {
-		String srcStr = String.valueOf(obj);
-		if (obj instanceof CharSequence) {
-			// fix #79
-			return StringEscape.escapeString(srcStr);
-		}
-		return srcStr;
-	}
-
-	/**
-	 * <p>
-	 * 使用单引号包含字符串
-	 * </p>
-	 *
-	 * @param coll 集合
-	 * @return 单引号包含的原字符串的集合形式
-	 */
-	public static String quotaMarkList(Collection<?> coll) {
-		StringBuilder sqlBuild = new StringBuilder();
-		sqlBuild.append("(");
-		int size = coll.size();
-		int i = 0;
-		Iterator<?> iterator = coll.iterator();
-		while (iterator.hasNext()) {
-			String tempVal = StringUtils.quotaMark(iterator.next());
-			sqlBuild.append(tempVal);
-			if (i + 1 < size) {
-				sqlBuild.append(",");
-			}
-			i++;
-		}
-		sqlBuild.append(")");
-		return sqlBuild.toString();
-	}
-
-	/**
-	 * <p>
-	 * 拼接字符串第二个字符串第一个字母大写
-	 * </p>
-	 *
-	 * @param concatStr
-	 * @param str
-	 * @return
-	 */
-	public static String concatCapitalize(String concatStr, final String str) {
-		if (isEmpty(concatStr)) {
-			concatStr = EMPTY;
-		}
-		int strLen;
-		if (str == null || (strLen = str.length()) == 0) {
-			return str;
-		}
-
-		final char firstChar = str.charAt(0);
-		if (Character.isTitleCase(firstChar)) {
-			// already capitalized
-			return str;
-		}
-
-		StringBuilder sb = new StringBuilder(strLen);
-		sb.append(concatStr);
-		sb.append(Character.toTitleCase(firstChar));
-		sb.append(str.substring(1));
-		return sb.toString();
-	}
-
-	/**
-	 * <p>
-	 * 字符串第一个字母大写
-	 * </p>
-	 *
-	 * @param str
-	 * @return
-	 */
-	public static String capitalize(final String str) {
-		return concatCapitalize(null, str);
-	}
-
-	/**
-	 * <p>
-	 * 判断对象是否为空
-	 * </p>
-	 *
-	 * @param object
-	 * @return
-	 */
-	public static boolean checkValNotNull(Object object) {
-		if (object instanceof CharSequence) {
-			return isNotEmpty((CharSequence) object);
-		}
-		return object != null;
-	}
-
-	/**
-	 * <p>
-	 * 判断对象是否为空
-	 * </p>
-	 *
-	 * @param object
-	 * @return
-	 */
-	public static boolean checkValNull(Object object) {
-		return !checkValNotNull(object);
-	}
-
-	/**
-	 * <p>
-	 * 包含大写字母
-	 * </p>
-	 *
-	 * @param word 待判断字符串
-	 * @return
-	 */
-	public static boolean containsUpperCase(String word) {
-		for (int i = 0; i < word.length(); i++) {
-			char c = word.charAt(i);
-			if (Character.isUpperCase(c)) {
-				return true;
-			}
-		}
-		return false;
-	}
-
-	/**
-	 * <p>
-	 * 是否为大写命名
-	 * </p>
-	 *
-	 * @param word 待判断字符串
-	 * @return
-	 */
-	public static boolean isCapitalMode(String word) {
-		return null != word && word.matches("^[0-9A-Z/_]+$");
-	}
-
-	/**
-	 * <p>
-	 * 是否为驼峰下划线混合命名
-	 * </p>
-	 *
-	 * @param word 待判断字符串
-	 * @return
-	 */
-	public static boolean isMixedMode(String word) {
-		return Pattern.compile(".*[A-Z]+.*").matcher(word).matches() && Pattern.compile(".*[/_]+.*").matcher(word).matches();
-	}
-
-	/**
-	 * <p>
-	 * Check if a String ends with a specified suffix.
-	 * </p>
-	 * <p>
-	 * <p>
-	 * <code>null</code>s are handled without exceptions. Two <code>null</code>
-	 * references are considered to be equal. The comparison is case sensitive.
-	 * </p>
-	 * <p>
-	 * <pre>
-	 * StringUtils.endsWith(null, null)      = true
-	 * StringUtils.endsWith(null, "abcdef")  = false
-	 * StringUtils.endsWith("def", null)     = false
-	 * StringUtils.endsWith("def", "abcdef") = true
-	 * StringUtils.endsWith("def", "ABCDEF") = false
-	 * </pre>
-	 *
-	 * @param str    the String to check, may be null
-	 * @param suffix the suffix to find, may be null
-	 * @return <code>true</code> if the String ends with the suffix, case
-	 * sensitive, or both <code>null</code>
-	 * @see String#endsWith(String)
-	 * @since 2.4
-	 */
-	public static boolean endsWith(String str, String suffix) {
-		return endsWith(str, suffix, false);
-	}
-
-	/**
-	 * <p>
-	 * Case insensitive check if a String ends with a specified suffix.
-	 * </p>
-	 * <p>
-	 * <p>
-	 * <code>null</code>s are handled without exceptions. Two <code>null</code>
-	 * references are considered to be equal. The comparison is case
-	 * insensitive.
-	 * </p>
-	 * <p>
-	 * <pre>
-	 * StringUtils.endsWithIgnoreCase(null, null)      = true
-	 * StringUtils.endsWithIgnoreCase(null, "abcdef")  = false
-	 * StringUtils.endsWithIgnoreCase("def", null)     = false
-	 * StringUtils.endsWithIgnoreCase("def", "abcdef") = true
-	 * StringUtils.endsWithIgnoreCase("def", "ABCDEF") = false
-	 * </pre>
-	 *
-	 * @param str    the String to check, may be null
-	 * @param suffix the suffix to find, may be null
-	 * @return <code>true</code> if the String ends with the suffix, case
-	 * insensitive, or both <code>null</code>
-	 * @see String#endsWith(String)
-	 * @since 2.4
-	 */
-	public static boolean endsWithIgnoreCase(String str, String suffix) {
-		return endsWith(str, suffix, true);
-	}
-
-	/**
-	 * <p>
-	 * Check if a String ends with a specified suffix (optionally case
-	 * insensitive).
-	 * </p>
-	 *
-	 * @param str        the String to check, may be null
-	 * @param suffix     the suffix to find, may be null
-	 * @param ignoreCase inidicates whether the compare should ignore case (case
-	 *                   insensitive) or not.
-	 * @return <code>true</code> if the String starts with the prefix or both
-	 * <code>null</code>
-	 * @see String#endsWith(String)
-	 */
-	private static boolean endsWith(String str, String suffix, boolean ignoreCase) {
-		if (str == null || suffix == null) {
-			return (str == null && suffix == null);
-		}
-		if (suffix.length() > str.length()) {
-			return false;
-		}
-		int strOffset = str.length() - suffix.length();
-		return str.regionMatches(ignoreCase, strOffset, suffix, 0, suffix.length());
-	}
-
-	/**
-	 * <p>
-	 * Splits the provided text into an array, separators specified. This is an
-	 * alternative to using StringTokenizer.
-	 * </p>
-	 * <p>
-	 * <p>
-	 * The separator is not included in the returned String array. Adjacent
-	 * separators are treated as one separator. For more control over the split
-	 * use the StrTokenizer class.
-	 * </p>
-	 * <p>
-	 * <p>
-	 * A {@code null} input String returns {@code null}. A {@code null}
-	 * separatorChars splits on whitespace.
-	 * </p>
-	 * <p>
-	 * <pre>
-	 * StringUtils.split(null, *)         = null
-	 * StringUtils.split("", *)           = []
-	 * StringUtils.split("abc def", null) = ["abc", "def"]
-	 * StringUtils.split("abc def", " ")  = ["abc", "def"]
-	 * StringUtils.split("abc  def", " ") = ["abc", "def"]
-	 * StringUtils.split("ab:cd:ef", ":") = ["ab", "cd", "ef"]
-	 * </pre>
-	 *
-	 * @param str            the String to parse, may be null
-	 * @param separatorChars the characters used as the delimiters, {@code null} splits on
-	 *                       whitespace
-	 * @return an array of parsed Strings, {@code null} if null String input
-	 */
-	public static String[] split(final String str, final String separatorChars) {
-		List<String> strings = splitWorker(str, separatorChars, -1, false);
-		return strings.toArray(new String[strings.size()]);
-	}
-
-	/**
-	 * Performs the logic for the {@code split} and
-	 * {@code splitPreserveAllTokens} methods that return a maximum array
-	 * length.
-	 *
-	 * @param str               the String to parse, may be {@code null}
-	 * @param separatorChars    the separate character
-	 * @param max               the maximum number of elements to include in the array. A zero
-	 *                          or negative value implies no limit.
-	 * @param preserveAllTokens if {@code true}, adjacent separators are treated as empty
-	 *                          token separators; if {@code false}, adjacent separators are
-	 *                          treated as one separator.
-	 * @return an array of parsed Strings, {@code null} if null String input
-	 */
-	public static List<String> splitWorker(final String str, final String separatorChars, final int max,
-										   final boolean preserveAllTokens) {
-		// Performance tuned for 2.0 (JDK1.4)
-		// Direct code is quicker than StringTokenizer.
-		// Also, StringTokenizer uses isSpace() not isWhitespace()
-
-		if (str == null) {
-			return null;
-		}
-		final int len = str.length();
-		if (len == 0) {
-			return Collections.emptyList();
-		}
-		final List<String> list = new ArrayList<>();
-		int sizePlus1 = 1;
-		int i = 0, start = 0;
-		boolean match = false;
-		boolean lastMatch = false;
-		if (separatorChars == null) {
-			// Null separator means use whitespace
-			while (i < len) {
-				if (Character.isWhitespace(str.charAt(i))) {
-					if (match || preserveAllTokens) {
-						lastMatch = true;
-						if (sizePlus1++ == max) {
-							i = len;
-							lastMatch = false;
-						}
-						list.add(str.substring(start, i));
-						match = false;
-					}
-					start = ++i;
-					continue;
-				}
-				lastMatch = false;
-				match = true;
-				i++;
-			}
-		} else if (separatorChars.length() == 1) {
-			// Optimise 1 character case
-			final char sep = separatorChars.charAt(0);
-			while (i < len) {
-				if (str.charAt(i) == sep) {
-					if (match || preserveAllTokens) {
-						lastMatch = true;
-						if (sizePlus1++ == max) {
-							i = len;
-							lastMatch = false;
-						}
-						list.add(str.substring(start, i));
-						match = false;
-					}
-					start = ++i;
-					continue;
-				}
-				lastMatch = false;
-				match = true;
-				i++;
-			}
-		} else {
-			// standard case
-			while (i < len) {
-				if (separatorChars.indexOf(str.charAt(i)) >= 0) {
-					if (match || preserveAllTokens) {
-						lastMatch = true;
-						if (sizePlus1++ == max) {
-							i = len;
-							lastMatch = false;
-						}
-						list.add(str.substring(start, i));
-						match = false;
-					}
-					start = ++i;
-					continue;
-				}
-				lastMatch = false;
-				match = true;
-				i++;
-			}
-		}
-		if (match || preserveAllTokens && lastMatch) {
-			list.add(str.substring(start, i));
-		}
-		return list;
-	}
-
-	/**
-	 * <p>
-	 * 是否为CharSequence类型
-	 * </p>
-	 *
-	 * @param cls
-	 * @return
-	 */
-	public static Boolean isCharSequence(Class<?> cls) {
-		return cls != null && CharSequence.class.isAssignableFrom(cls);
-	}
-
-	/**
-	 * <p>
-	 * 去除boolean类型is开头的字符串
-	 * </p>
-	 *
-	 * @param propertyName 字段名
-	 * @param propertyType 字段类型
-	 * @return
-	 */
-	public static String removeIsPrefixIfBoolean(String propertyName, Class<?> propertyType) {
-		if (isBoolean(propertyType) && propertyName.startsWith(IS)) {
-			String property = propertyName.replaceFirst(IS, EMPTY);
-			if (isEmpty(property)) {
-				return propertyName;
-			} else {
-				String firstCharToLowerStr = firstCharToLower(property);
-				return property.equals(firstCharToLowerStr) ? propertyName : firstCharToLowerStr;
-			}
-		}
-		return propertyName;
-	}
-
-	/**
-	 * <p>
-	 * 是否为CharSequence类型
-	 * </p>
-	 *
-	 * @param propertyType
-	 * @return
-	 */
-	public static Boolean isCharSequence(String propertyType) {
-		try {
-			return isCharSequence(Class.forName(propertyType));
-		} catch (ClassNotFoundException e) {
-			return false;
-		}
-	}
-
-	/**
-	 * <p>
-	 * 是否为Boolean类型(包含普通类型)
-	 * </p>
-	 *
-	 * @param propertyCls
-	 * @return
-	 */
-	public static Boolean isBoolean(Class<?> propertyCls) {
-		return propertyCls != null && (boolean.class.isAssignableFrom(propertyCls) || Boolean.class.isAssignableFrom(propertyCls));
-	}
-
-	/**
-	 * <p>
-	 * 第一个首字母小写,之后字符大小写的不变<br>
-	 * StringUtils.firstCharToLower( "UserService" )     = userService
-	 * StringUtils.firstCharToLower( "UserServiceImpl" ) = userServiceImpl
-	 * </p>
-	 *
-	 * @param rawString 需要处理的字符串
-	 * @return
-	 */
-	public static String firstCharToLower(String rawString) {
-		return prefixToLower(rawString, 1);
-	}
-
-	/**
-	 * <p>
-	 * 前n个首字母小写,之后字符大小写的不变
-	 * </p>
-	 *
-	 * @param rawString 需要处理的字符串
-	 * @param index     多少个字符(从左至右)
-	 * @return
-	 */
-	public static String prefixToLower(String rawString, int index) {
-		String beforeChar = rawString.substring(0, index).toLowerCase();
-		String afterChar = rawString.substring(index, rawString.length());
-		return beforeChar + afterChar;
-	}
-
-	/**
-	 * <p>
-	 * 删除字符前缀之后,首字母小写,之后字符大小写的不变<br>
-	 * StringUtils.removePrefixAfterPrefixToLower( "isUser", 2 )     = user
-	 * StringUtils.removePrefixAfterPrefixToLower( "isUserInfo", 2 ) = userInfo
-	 * </p>
-	 *
-	 * @param rawString 需要处理的字符串
-	 * @param index     删除多少个字符(从左至右)
-	 * @return
-	 */
-	public static String removePrefixAfterPrefixToLower(String rawString, int index) {
-		return prefixToLower(rawString.substring(index, rawString.length()), 1);
-	}
-
-	/**
-	 * <p>
-	 * 驼峰转连字符<br>
-	 * StringUtils.camelToHyphen( "managerAdminUserService" ) = manager-admin-user-service
-	 * </p>
-	 *
-	 * @param input
-	 * @return 以'-'分隔
-	 * @see <a href="https://github.com/krasa/StringManipulation">document</a>
-	 */
-	public static String camelToHyphen(String input) {
-		return wordsToHyphenCase(wordsAndHyphenAndCamelToConstantCase(input));
-	}
-
-	private static String wordsAndHyphenAndCamelToConstantCase(String input) {
-		boolean betweenUpperCases = false;
-		boolean containsLowerCase = containsLowerCase(input);
-
-		StringBuilder buf = new StringBuilder();
-		char previousChar = ' ';
-		char[] chars = input.toCharArray();
-		for (int i = 0; i < chars.length; i++) {
-			char c = chars[i];
-			boolean isUpperCaseAndPreviousIsUpperCase = (Character.isUpperCase(previousChar)) && (Character.isUpperCase(c));
-			boolean isUpperCaseAndPreviousIsLowerCase = (Character.isLowerCase(previousChar)) && (Character.isUpperCase(c));
-
-			boolean previousIsWhitespace = Character.isWhitespace(previousChar);
-			boolean lastOneIsNotUnderscore = (buf.length() > 0) && (buf.charAt(buf.length() - 1) != '_');
-			boolean isNotUnderscore = c != '_';
-			if ((lastOneIsNotUnderscore) && ((isUpperCaseAndPreviousIsLowerCase) || (previousIsWhitespace) || ((betweenUpperCases)
-					&& (containsLowerCase) && (isUpperCaseAndPreviousIsUpperCase)))) {
-				buf.append("_");
-			} else if (((separatorAfterDigit) && (Character.isDigit(previousChar))
-					&& (Character.isLetter(c))) || ((separatorBeforeDigit) && (Character
-					.isDigit(c)) && (Character.isLetter(previousChar)))) {
-				buf.append('_');
-			}
-			if ((shouldReplace(c)) && (lastOneIsNotUnderscore)) {
-				buf.append('_');
-			} else if ((!Character.isWhitespace(c)) && ((isNotUnderscore) || (lastOneIsNotUnderscore))) {
-				buf.append(Character.toUpperCase(c));
-			}
-			previousChar = c;
-		}
-		if (Character.isWhitespace(previousChar)) {
-			buf.append("_");
-		}
-		return buf.toString();
-	}
-
-	public static boolean containsLowerCase(String s) {
-		for (char c : s.toCharArray()) {
-			if (Character.isLowerCase(c)) {
-				return true;
-			}
-		}
-		return false;
-	}
-
-	private static boolean shouldReplace(char c) {
-		return (c == '.') || (c == '_') || (c == '-');
-	}
-
-	private static String wordsToHyphenCase(String s) {
-		StringBuilder buf = new StringBuilder();
-		char lastChar = 'a';
-		for (char c : s.toCharArray()) {
-			if ((Character.isWhitespace(lastChar)) && (!Character.isWhitespace(c))
-					&& ('-' != c) && (buf.length() > 0)
-					&& (buf.charAt(buf.length() - 1) != '-')) {
-				buf.append("-");
-			}
-			if ('_' == c) {
-				buf.append('-');
-			} else if ('.' == c) {
-				buf.append('-');
-			} else if (!Character.isWhitespace(c)) {
-				buf.append(Character.toLowerCase(c));
-			}
-			lastChar = c;
-		}
-		if (Character.isWhitespace(lastChar)) {
-			buf.append("-");
-		}
-		return buf.toString();
-	}
+    /**
+     * UTF-8 编码格式
+     */
+    public static final String UTF8 = "UTF-8" ;
+
+    /**
+     * 空字符
+     */
+    public static final String EMPTY = "" ;
+    /**
+     * 字符串 is
+     */
+    public static final String IS = "is" ;
+
+    /**
+     * 下划线字符
+     */
+    public static final char UNDERLINE = '_';
+
+    /**
+     * 占位符
+     */
+    public static final String PLACE_HOLDER = "{%s}" ;
+
+    private static boolean separatorBeforeDigit = false;
+    private static boolean separatorAfterDigit = true;
+
+
+    private StringUtils() {
+    }
+
+
+    /**
+     * <p>
+     * Blob 转为 String 格式
+     * </p>
+     *
+     * @param blob Blob 对象
+     * @return
+     */
+    public static String blob2String(Blob blob) {
+        if (null != blob) {
+            try {
+                byte[] returnValue = blob.getBytes(1, (int) blob.length());
+                return new String(returnValue, UTF8);
+            } catch (Exception e) {
+                throw new MybatisPlusException("Blob Convert To String Error!" );
+            }
+        }
+        return null;
+    }
+
+    /**
+     * <p>
+     * 判断字符串是否为空
+     * </p>
+     *
+     * @param cs 需要判断字符串
+     * @return 判断结果
+     */
+    public static boolean isEmpty(final CharSequence cs) {
+        int strLen;
+        if (cs == null || (strLen = cs.length()) == 0) {
+            return true;
+        }
+        for (int i = 0; i < strLen; i++) {
+            if (!Character.isWhitespace(cs.charAt(i))) {
+                return false;
+            }
+        }
+        return true;
+    }
+
+    /**
+     * <p>
+     * 判断字符串是否不为空
+     * </p>
+     *
+     * @param cs 需要判断字符串
+     * @return 判断结果
+     */
+    public static boolean isNotEmpty(final CharSequence cs) {
+        return !isEmpty(cs);
+    }
+
+    /**
+     * <p>
+     * 字符串驼峰转下划线格式
+     * </p>
+     *
+     * @param param 需要转换的字符串
+     * @return 转换好的字符串
+     */
+    public static String camelToUnderline(String param) {
+        if (isEmpty(param)) {
+            return EMPTY;
+        }
+        int len = param.length();
+        StringBuilder sb = new StringBuilder(len);
+        for (int i = 0; i < len; i++) {
+            char c = param.charAt(i);
+            if (Character.isUpperCase(c) && i > 0) {
+                sb.append(UNDERLINE);
+            }
+            sb.append(Character.toLowerCase(c));
+        }
+        return sb.toString();
+    }
+
+    /**
+     * <p>
+     * 字符串下划线转驼峰格式
+     * </p>
+     *
+     * @param param 需要转换的字符串
+     * @return 转换好的字符串
+     */
+    public static String underlineToCamel(String param) {
+        if (isEmpty(param)) {
+            return EMPTY;
+        }
+        String temp = param.toLowerCase();
+        int len = temp.length();
+        StringBuilder sb = new StringBuilder(len);
+        for (int i = 0; i < len; i++) {
+            char c = temp.charAt(i);
+            if (c == UNDERLINE) {
+                if (++i < len) {
+                    sb.append(Character.toUpperCase(temp.charAt(i)));
+                }
+            } else {
+                sb.append(c);
+            }
+        }
+        return sb.toString();
+    }
+
+    /**
+     * <p>
+     * 首字母转换小写
+     * </p>
+     *
+     * @param param 需要转换的字符串
+     * @return 转换好的字符串
+     */
+    public static String firstToLowerCase(String param) {
+        if (isEmpty(param)) {
+            return EMPTY;
+        }
+        StringBuilder sb = new StringBuilder(param.length());
+        sb.append(param.substring(0, 1).toLowerCase());
+        sb.append(param.substring(1));
+        return sb.toString();
+    }
+
+    /**
+     * <p>
+     * 判断字符串是否为纯大写字母
+     * </p>
+     *
+     * @param str 要匹配的字符串
+     * @return
+     */
+    public static boolean isUpperCase(String str) {
+        return match("^[A-Z]+$" , str);
+    }
+
+    /**
+     * <p>
+     * 正则表达式匹配
+     * </p>
+     *
+     * @param regex 正则表达式字符串
+     * @param str   要匹配的字符串
+     * @return 如果str 符合 regex的正则表达式格式,返回true, 否则返回 false;
+     */
+    public static boolean match(String regex, String str) {
+        Pattern pattern = Pattern.compile(regex);
+        Matcher matcher = pattern.matcher(str);
+        return matcher.matches();
+    }
+
+    /**
+     * <p>
+     * SQL 参数填充
+     * </p>
+     *
+     * @param content 填充内容
+     * @param args    填充参数
+     * @return
+     */
+    public static String sqlArgsFill(String content, Object... args) {
+        if (StringUtils.isEmpty(content)) {
+            return null;
+        }
+        if (args != null) {
+            int length = args.length;
+            if (length >= 1) {
+                for (int i = 0; i < length; i++) {
+                    content = content.replace(String.format(PLACE_HOLDER, i), sqlParam(args[i]));
+                }
+            }
+        }
+        return content;
+    }
+
+    /**
+     * <p>
+     * 获取SQL PARAMS字符串
+     * </p>
+     *
+     * @param obj
+     * @return
+     */
+    public static String sqlParam(Object obj) {
+        String repStr;
+        if (obj instanceof Collection) {
+            repStr = StringUtils.quotaMarkList((Collection<?>) obj);
+        } else {
+            repStr = StringUtils.quotaMark(obj);
+        }
+        return repStr;
+    }
+
+    /**
+     * <p>
+     * 使用单引号包含字符串
+     * </p>
+     *
+     * @param obj 原字符串
+     * @return 单引号包含的原字符串
+     */
+    public static String quotaMark(Object obj) {
+        String srcStr = String.valueOf(obj);
+        if (obj instanceof CharSequence) {
+            // fix #79
+            return StringEscape.escapeString(srcStr);
+        }
+        return srcStr;
+    }
+
+    /**
+     * <p>
+     * 使用单引号包含字符串
+     * </p>
+     *
+     * @param coll 集合
+     * @return 单引号包含的原字符串的集合形式
+     */
+    public static String quotaMarkList(Collection<?> coll) {
+        StringBuilder sqlBuild = new StringBuilder();
+        sqlBuild.append("(" );
+        int size = coll.size();
+        int i = 0;
+        Iterator<?> iterator = coll.iterator();
+        while (iterator.hasNext()) {
+            String tempVal = StringUtils.quotaMark(iterator.next());
+            sqlBuild.append(tempVal);
+            if (i + 1 < size) {
+                sqlBuild.append("," );
+            }
+            i++;
+        }
+        sqlBuild.append(")" );
+        return sqlBuild.toString();
+    }
+
+    /**
+     * <p>
+     * 拼接字符串第二个字符串第一个字母大写
+     * </p>
+     *
+     * @param concatStr
+     * @param str
+     * @return
+     */
+    public static String concatCapitalize(String concatStr, final String str) {
+        if (isEmpty(concatStr)) {
+            concatStr = EMPTY;
+        }
+        int strLen;
+        if (str == null || (strLen = str.length()) == 0) {
+            return str;
+        }
+
+        final char firstChar = str.charAt(0);
+        if (Character.isTitleCase(firstChar)) {
+            // already capitalized
+            return str;
+        }
+
+        StringBuilder sb = new StringBuilder(strLen);
+        sb.append(concatStr);
+        sb.append(Character.toTitleCase(firstChar));
+        sb.append(str.substring(1));
+        return sb.toString();
+    }
+
+    /**
+     * <p>
+     * 字符串第一个字母大写
+     * </p>
+     *
+     * @param str
+     * @return
+     */
+    public static String capitalize(final String str) {
+        return concatCapitalize(null, str);
+    }
+
+    /**
+     * <p>
+     * 判断对象是否为空
+     * </p>
+     *
+     * @param object
+     * @return
+     */
+    public static boolean checkValNotNull(Object object) {
+        if (object instanceof CharSequence) {
+            return isNotEmpty((CharSequence) object);
+        }
+        return object != null;
+    }
+
+    /**
+     * <p>
+     * 判断对象是否为空
+     * </p>
+     *
+     * @param object
+     * @return
+     */
+    public static boolean checkValNull(Object object) {
+        return !checkValNotNull(object);
+    }
+
+    /**
+     * <p>
+     * 包含大写字母
+     * </p>
+     *
+     * @param word 待判断字符串
+     * @return
+     */
+    public static boolean containsUpperCase(String word) {
+        for (int i = 0; i < word.length(); i++) {
+            char c = word.charAt(i);
+            if (Character.isUpperCase(c)) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    /**
+     * <p>
+     * 是否为大写命名
+     * </p>
+     *
+     * @param word 待判断字符串
+     * @return
+     */
+    public static boolean isCapitalMode(String word) {
+        return null != word && word.matches("^[0-9A-Z/_]+$" );
+    }
+
+    /**
+     * <p>
+     * 是否为驼峰下划线混合命名
+     * </p>
+     *
+     * @param word 待判断字符串
+     * @return
+     */
+    public static boolean isMixedMode(String word) {
+        return Pattern.compile(".*[A-Z]+.*" ).matcher(word).matches() && Pattern.compile(".*[/_]+.*" ).matcher(word).matches();
+    }
+
+    /**
+     * <p>
+     * Check if a String ends with a specified suffix.
+     * </p>
+     * <p>
+     * <p>
+     * <code>null</code>s are handled without exceptions. Two <code>null</code>
+     * references are considered to be equal. The comparison is case sensitive.
+     * </p>
+     * <p>
+     * <pre>
+     * StringUtils.endsWith(null, null)      = true
+     * StringUtils.endsWith(null, "abcdef")  = false
+     * StringUtils.endsWith("def", null)     = false
+     * StringUtils.endsWith("def", "abcdef") = true
+     * StringUtils.endsWith("def", "ABCDEF") = false
+     * </pre>
+     *
+     * @param str    the String to check, may be null
+     * @param suffix the suffix to find, may be null
+     * @return <code>true</code> if the String ends with the suffix, case
+     * sensitive, or both <code>null</code>
+     * @see String#endsWith(String)
+     * @since 2.4
+     */
+    public static boolean endsWith(String str, String suffix) {
+        return endsWith(str, suffix, false);
+    }
+
+    /**
+     * <p>
+     * Case insensitive check if a String ends with a specified suffix.
+     * </p>
+     * <p>
+     * <p>
+     * <code>null</code>s are handled without exceptions. Two <code>null</code>
+     * references are considered to be equal. The comparison is case
+     * insensitive.
+     * </p>
+     * <p>
+     * <pre>
+     * StringUtils.endsWithIgnoreCase(null, null)      = true
+     * StringUtils.endsWithIgnoreCase(null, "abcdef")  = false
+     * StringUtils.endsWithIgnoreCase("def", null)     = false
+     * StringUtils.endsWithIgnoreCase("def", "abcdef") = true
+     * StringUtils.endsWithIgnoreCase("def", "ABCDEF") = false
+     * </pre>
+     *
+     * @param str    the String to check, may be null
+     * @param suffix the suffix to find, may be null
+     * @return <code>true</code> if the String ends with the suffix, case
+     * insensitive, or both <code>null</code>
+     * @see String#endsWith(String)
+     * @since 2.4
+     */
+    public static boolean endsWithIgnoreCase(String str, String suffix) {
+        return endsWith(str, suffix, true);
+    }
+
+    /**
+     * <p>
+     * Check if a String ends with a specified suffix (optionally case
+     * insensitive).
+     * </p>
+     *
+     * @param str        the String to check, may be null
+     * @param suffix     the suffix to find, may be null
+     * @param ignoreCase inidicates whether the compare should ignore case (case
+     *                   insensitive) or not.
+     * @return <code>true</code> if the String starts with the prefix or both
+     * <code>null</code>
+     * @see String#endsWith(String)
+     */
+    private static boolean endsWith(String str, String suffix, boolean ignoreCase) {
+        if (str == null || suffix == null) {
+            return (str == null && suffix == null);
+        }
+        if (suffix.length() > str.length()) {
+            return false;
+        }
+        int strOffset = str.length() - suffix.length();
+        return str.regionMatches(ignoreCase, strOffset, suffix, 0, suffix.length());
+    }
+
+    /**
+     * <p>
+     * Splits the provided text into an array, separators specified. This is an
+     * alternative to using StringTokenizer.
+     * </p>
+     * <p>
+     * <p>
+     * The separator is not included in the returned String array. Adjacent
+     * separators are treated as one separator. For more control over the split
+     * use the StrTokenizer class.
+     * </p>
+     * <p>
+     * <p>
+     * A {@code null} input String returns {@code null}. A {@code null}
+     * separatorChars splits on whitespace.
+     * </p>
+     * <p>
+     * <pre>
+     * StringUtils.split(null, *)         = null
+     * StringUtils.split("", *)           = []
+     * StringUtils.split("abc def", null) = ["abc", "def"]
+     * StringUtils.split("abc def", " ")  = ["abc", "def"]
+     * StringUtils.split("abc  def", " ") = ["abc", "def"]
+     * StringUtils.split("ab:cd:ef", ":") = ["ab", "cd", "ef"]
+     * </pre>
+     *
+     * @param str            the String to parse, may be null
+     * @param separatorChars the characters used as the delimiters, {@code null} splits on
+     *                       whitespace
+     * @return an array of parsed Strings, {@code null} if null String input
+     */
+    public static String[] split(final String str, final String separatorChars) {
+        List<String> strings = splitWorker(str, separatorChars, -1, false);
+        return strings.toArray(new String[strings.size()]);
+    }
+
+    /**
+     * Performs the logic for the {@code split} and
+     * {@code splitPreserveAllTokens} methods that return a maximum array
+     * length.
+     *
+     * @param str               the String to parse, may be {@code null}
+     * @param separatorChars    the separate character
+     * @param max               the maximum number of elements to include in the array. A zero
+     *                          or negative value implies no limit.
+     * @param preserveAllTokens if {@code true}, adjacent separators are treated as empty
+     *                          token separators; if {@code false}, adjacent separators are
+     *                          treated as one separator.
+     * @return an array of parsed Strings, {@code null} if null String input
+     */
+    public static List<String> splitWorker(final String str, final String separatorChars, final int max,
+                                           final boolean preserveAllTokens) {
+        // Performance tuned for 2.0 (JDK1.4)
+        // Direct code is quicker than StringTokenizer.
+        // Also, StringTokenizer uses isSpace() not isWhitespace()
+
+        if (str == null) {
+            return null;
+        }
+        final int len = str.length();
+        if (len == 0) {
+            return Collections.emptyList();
+        }
+        final List<String> list = new ArrayList<>();
+        int sizePlus1 = 1;
+        int i = 0, start = 0;
+        boolean match = false;
+        boolean lastMatch = false;
+        if (separatorChars == null) {
+            // Null separator means use whitespace
+            while (i < len) {
+                if (Character.isWhitespace(str.charAt(i))) {
+                    if (match || preserveAllTokens) {
+                        lastMatch = true;
+                        if (sizePlus1++ == max) {
+                            i = len;
+                            lastMatch = false;
+                        }
+                        list.add(str.substring(start, i));
+                        match = false;
+                    }
+                    start = ++i;
+                    continue;
+                }
+                lastMatch = false;
+                match = true;
+                i++;
+            }
+        } else if (separatorChars.length() == 1) {
+            // Optimise 1 character case
+            final char sep = separatorChars.charAt(0);
+            while (i < len) {
+                if (str.charAt(i) == sep) {
+                    if (match || preserveAllTokens) {
+                        lastMatch = true;
+                        if (sizePlus1++ == max) {
+                            i = len;
+                            lastMatch = false;
+                        }
+                        list.add(str.substring(start, i));
+                        match = false;
+                    }
+                    start = ++i;
+                    continue;
+                }
+                lastMatch = false;
+                match = true;
+                i++;
+            }
+        } else {
+            // standard case
+            while (i < len) {
+                if (separatorChars.indexOf(str.charAt(i)) >= 0) {
+                    if (match || preserveAllTokens) {
+                        lastMatch = true;
+                        if (sizePlus1++ == max) {
+                            i = len;
+                            lastMatch = false;
+                        }
+                        list.add(str.substring(start, i));
+                        match = false;
+                    }
+                    start = ++i;
+                    continue;
+                }
+                lastMatch = false;
+                match = true;
+                i++;
+            }
+        }
+        if (match || preserveAllTokens && lastMatch) {
+            list.add(str.substring(start, i));
+        }
+        return list;
+    }
+
+    /**
+     * <p>
+     * 是否为CharSequence类型
+     * </p>
+     *
+     * @param cls
+     * @return
+     */
+    public static Boolean isCharSequence(Class<?> cls) {
+        return cls != null && CharSequence.class.isAssignableFrom(cls);
+    }
+
+    /**
+     * <p>
+     * 去除boolean类型is开头的字符串
+     * </p>
+     *
+     * @param propertyName 字段名
+     * @param propertyType 字段类型
+     * @return
+     */
+    public static String removeIsPrefixIfBoolean(String propertyName, Class<?> propertyType) {
+        if (isBoolean(propertyType) && propertyName.startsWith(IS)) {
+            String property = propertyName.replaceFirst(IS, EMPTY);
+            if (isEmpty(property)) {
+                return propertyName;
+            } else {
+                String firstCharToLowerStr = firstCharToLower(property);
+                return property.equals(firstCharToLowerStr) ? propertyName : firstCharToLowerStr;
+            }
+        }
+        return propertyName;
+    }
+
+    /**
+     * <p>
+     * 是否为CharSequence类型
+     * </p>
+     *
+     * @param propertyType
+     * @return
+     */
+    public static Boolean isCharSequence(String propertyType) {
+        try {
+            return isCharSequence(Class.forName(propertyType));
+        } catch (ClassNotFoundException e) {
+            return false;
+        }
+    }
+
+    /**
+     * <p>
+     * 是否为Boolean类型(包含普通类型)
+     * </p>
+     *
+     * @param propertyCls
+     * @return
+     */
+    public static Boolean isBoolean(Class<?> propertyCls) {
+        return propertyCls != null && (boolean.class.isAssignableFrom(propertyCls) || Boolean.class.isAssignableFrom(propertyCls));
+    }
+
+    /**
+     * <p>
+     * 第一个首字母小写,之后字符大小写的不变<br>
+     * StringUtils.firstCharToLower( "UserService" )     = userService
+     * StringUtils.firstCharToLower( "UserServiceImpl" ) = userServiceImpl
+     * </p>
+     *
+     * @param rawString 需要处理的字符串
+     * @return
+     */
+    public static String firstCharToLower(String rawString) {
+        return prefixToLower(rawString, 1);
+    }
+
+    /**
+     * <p>
+     * 前n个首字母小写,之后字符大小写的不变
+     * </p>
+     *
+     * @param rawString 需要处理的字符串
+     * @param index     多少个字符(从左至右)
+     * @return
+     */
+    public static String prefixToLower(String rawString, int index) {
+        String beforeChar = rawString.substring(0, index).toLowerCase();
+        String afterChar = rawString.substring(index, rawString.length());
+        return beforeChar + afterChar;
+    }
+
+    /**
+     * <p>
+     * 删除字符前缀之后,首字母小写,之后字符大小写的不变<br>
+     * StringUtils.removePrefixAfterPrefixToLower( "isUser", 2 )     = user
+     * StringUtils.removePrefixAfterPrefixToLower( "isUserInfo", 2 ) = userInfo
+     * </p>
+     *
+     * @param rawString 需要处理的字符串
+     * @param index     删除多少个字符(从左至右)
+     * @return
+     */
+    public static String removePrefixAfterPrefixToLower(String rawString, int index) {
+        return prefixToLower(rawString.substring(index, rawString.length()), 1);
+    }
+
+    /**
+     * <p>
+     * 驼峰转连字符<br>
+     * StringUtils.camelToHyphen( "managerAdminUserService" ) = manager-admin-user-service
+     * </p>
+     *
+     * @param input
+     * @return 以'-'分隔
+     * @see <a href="https://github.com/krasa/StringManipulation">document</a>
+     */
+    public static String camelToHyphen(String input) {
+        return wordsToHyphenCase(wordsAndHyphenAndCamelToConstantCase(input));
+    }
+
+    private static String wordsAndHyphenAndCamelToConstantCase(String input) {
+        boolean betweenUpperCases = false;
+        boolean containsLowerCase = containsLowerCase(input);
+
+        StringBuilder buf = new StringBuilder();
+        char previousChar = ' ';
+        char[] chars = input.toCharArray();
+        for (int i = 0; i < chars.length; i++) {
+            char c = chars[i];
+            boolean isUpperCaseAndPreviousIsUpperCase = (Character.isUpperCase(previousChar)) && (Character.isUpperCase(c));
+            boolean isUpperCaseAndPreviousIsLowerCase = (Character.isLowerCase(previousChar)) && (Character.isUpperCase(c));
+
+            boolean previousIsWhitespace = Character.isWhitespace(previousChar);
+            boolean lastOneIsNotUnderscore = (buf.length() > 0) && (buf.charAt(buf.length() - 1) != '_');
+            boolean isNotUnderscore = c != '_';
+            if ((lastOneIsNotUnderscore) && ((isUpperCaseAndPreviousIsLowerCase) || (previousIsWhitespace) || ((betweenUpperCases)
+                && (containsLowerCase) && (isUpperCaseAndPreviousIsUpperCase)))) {
+                buf.append("_" );
+            } else if (((separatorAfterDigit) && (Character.isDigit(previousChar))
+                && (Character.isLetter(c))) || ((separatorBeforeDigit) && (Character
+                .isDigit(c)) && (Character.isLetter(previousChar)))) {
+                buf.append('_');
+            }
+            if ((shouldReplace(c)) && (lastOneIsNotUnderscore)) {
+                buf.append('_');
+            } else if ((!Character.isWhitespace(c)) && ((isNotUnderscore) || (lastOneIsNotUnderscore))) {
+                buf.append(Character.toUpperCase(c));
+            }
+            previousChar = c;
+        }
+        if (Character.isWhitespace(previousChar)) {
+            buf.append("_" );
+        }
+        return buf.toString();
+    }
+
+    public static boolean containsLowerCase(String s) {
+        for (char c : s.toCharArray()) {
+            if (Character.isLowerCase(c)) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    private static boolean shouldReplace(char c) {
+        return (c == '.') || (c == '_') || (c == '-');
+    }
+
+    private static String wordsToHyphenCase(String s) {
+        StringBuilder buf = new StringBuilder();
+        char lastChar = 'a';
+        for (char c : s.toCharArray()) {
+            if ((Character.isWhitespace(lastChar)) && (!Character.isWhitespace(c))
+                && ('-' != c) && (buf.length() > 0)
+                && (buf.charAt(buf.length() - 1) != '-')) {
+                buf.append("-" );
+            }
+            if ('_' == c) {
+                buf.append('-');
+            } else if ('.' == c) {
+                buf.append('-');
+            } else if (!Character.isWhitespace(c)) {
+                buf.append(Character.toLowerCase(c));
+            }
+            lastChar = c;
+        }
+        if (Character.isWhitespace(lastChar)) {
+            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;
             }

+ 18 - 18
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>
@@ -152,9 +152,9 @@ public class TableInfoHelper {
         boolean isReadPK = false;
         boolean existTableId = existTableId(list);
         for (Field field : list) {
-           /*
-            * 主键ID 初始化
-            */
+            /*
+             * 主键ID 初始化
+             */
             if (!isReadPK) {
                 if (existTableId) {
                     isReadPK = initTableId(globalConfig, tableInfo, field, clazz);
@@ -179,17 +179,17 @@ public class TableInfoHelper {
             fieldList.add(new TableFieldInfo(globalConfig, tableInfo, field));
         }
 
-		/* 字段列表 */
+        /* 字段列表 */
         tableInfo.setFieldList(globalConfig, fieldList);
         /*
          * 未发现主键注解,提示警告信息
-		 */
+         */
         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()));
         }
         /*
          * 注入
-		 */
+         */
         tableInfoCache.put(clazz.getName(), tableInfo);
         return tableInfo;
     }
@@ -230,7 +230,7 @@ public class TableInfoHelper {
             if (StringUtils.isEmpty(tableInfo.getKeyColumn())) {
                 /*
                  * 主键策略( 注解 > 全局 > 默认 )
-				 */
+                 */
                 // 设置 Sequence 其他策略无效
                 if (IdType.NONE != tableId.type()) {
                     tableInfo.setIdType(tableId.type());
@@ -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());
     }
@@ -326,19 +326,19 @@ public class TableInfoHelper {
             }
             /*
              * el 语法支持,可以传入多个参数以逗号分开
-			 */
+             */
             String el = field.getName();
             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();
@@ -405,10 +405,10 @@ public class TableInfoHelper {
         String keyProperty = tableInfo.getKeyProperty();
         String keyColumn = tableInfo.getKeyColumn();
         SqlSource sqlSource = languageDriver.createSqlSource(builderAssistant.getConfiguration(),
-                keyGenerator.executeSql(tableInfo.getKeySequence().value()), null);
+            keyGenerator.executeSql(tableInfo.getKeySequence().value()), null);
         builderAssistant.addMappedStatement(id, sqlSource, statementType, SqlCommandType.SELECT, null, null, null,
-                null, null, resultTypeClass, null, false, false, false,
-                new NoKeyGenerator(), keyProperty, keyColumn, null, languageDriver, null);
+            null, null, resultTypeClass, null, false, false, false,
+            new NoKeyGenerator(), keyProperty, keyColumn, null, languageDriver, null);
         id = builderAssistant.applyCurrentNamespace(id, false);
         MappedStatement keyStatement = builderAssistant.getConfiguration().getMappedStatement(id, false);
         SelectKeyGenerator selectKeyGenerator = new SelectKeyGenerator(keyStatement, true);

+ 51 - 51
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) {
@@ -101,9 +101,9 @@ public class SqlFormatter {
 
         public FormatProcess(String sql) {
             tokens = new StringTokenizer(
-                    sql,
-                    "()+*/-=<>'`\"[]," + WHITESPACE,
-                    true
+                sql,
+                "()+*/-=<>'`\"[]," + WHITESPACE,
+                true
             );
         }
 
@@ -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(" " );
             }
         }
 
@@ -268,8 +268,8 @@ public class SqlFormatter {
             newline();
             afterBeginBeforeEnd = false;
             afterByOrSetOrFromOrSelect = "by".equals(lcToken)
-                    || "set".equals(lcToken)
-                    || "from".equals(lcToken);
+                || "set".equals(lcToken)
+                || "from".equals(lcToken);
         }
 
         private void beginNewClause() {
@@ -337,11 +337,11 @@ public class SqlFormatter {
             final char begin = tok.charAt(0);
             final boolean isIdentifier = Character.isJavaIdentifierStart(begin) || '"' == begin;
             return isIdentifier &&
-                    !LOGICAL.contains(tok) &&
-                    !END_CLAUSES.contains(tok) &&
-                    !QUANTIFIERS.contains(tok) &&
-                    !DML.contains(tok) &&
-                    !MISC.contains(tok);
+                !LOGICAL.contains(tok) &&
+                !END_CLAUSES.contains(tok) &&
+                !QUANTIFIERS.contains(tok) &&
+                !DML.contains(tok) &&
+                !MISC.contains(tok);
         }
 
         private static boolean isWhitespace(String token) {
@@ -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 + "\'" ;
     }
 
 }

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

@@ -10,7 +10,7 @@ import com.baomidou.mybatisplus.extension.handlers.MybatisMapWrapper;
 
 /**
  * <p>
- *   开启返回map结果集的下划线转驼峰
+ * 开启返回map结果集的下划线转驼峰
  * </p>
  *
  * @author yuxiaobin

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

@@ -74,7 +74,7 @@ public class MybatisSqlSessionTemplate implements SqlSession, DisposableBean {
      */
     public MybatisSqlSessionTemplate(SqlSessionFactory sqlSessionFactory, ExecutorType executorType) {
         this(sqlSessionFactory, executorType, new MyBatisExceptionTranslator(sqlSessionFactory.getConfiguration()
-                .getEnvironment().getDataSource(), true));
+            .getEnvironment().getDataSource(), true));
     }
 
     /**
@@ -93,14 +93,14 @@ 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;
         this.exceptionTranslator = exceptionTranslator;
         this.sqlSessionProxy = (SqlSession) newProxyInstance(SqlSessionFactory.class.getClassLoader(),
-                new Class[]{SqlSession.class}, new SqlSessionInterceptor());
+            new Class[]{SqlSession.class}, new SqlSessionInterceptor());
     }
 
     public SqlSessionFactory getSqlSessionFactory() {
@@ -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" );
     }
 
     /**
@@ -396,7 +396,7 @@ public class MybatisSqlSessionTemplate implements SqlSession, DisposableBean {
         @Override
         public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
             SqlSession sqlSession = MybatisSqlSessionTemplate.this.sqlSessionFactory
-                    .openSession(MybatisSqlSessionTemplate.this.executorType);
+                .openSession(MybatisSqlSessionTemplate.this.executorType);
             try {
                 Object result = method.invoke(sqlSession, args);
                 sqlSession.commit(true);

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

@@ -77,7 +77,7 @@ public abstract class Model<T extends Model> implements Serializable {
         } else {
             /*
              * 更新成功直接返回,失败执行插入逻辑
-			 */
+             */
             return updateById() || insert();
         }
     }
@@ -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);
     }
 
@@ -304,8 +304,8 @@ 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);
+        wrapper = (Wrapper<T>) SqlHelper.fillWrapper(page, 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));
     }
 

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

@@ -27,47 +27,47 @@ import com.baomidou.mybatisplus.core.exceptions.MybatisPlusException;
  * @Date 2016-04-15
  */
 //TODO: 3.0 如何在GlobalConfiguration里面支持?
-public enum DBType implements IDBType{
+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() {

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

@@ -38,30 +38,30 @@ import com.baomidou.mybatisplus.core.toolkit.StringUtils;
  */
 public class BlobTypeHandler extends BaseTypeHandler<String> {
 
-	@Override
-	public void setNonNullParameter(PreparedStatement ps, int i, String parameter, JdbcType jdbcType) throws SQLException {
-		try {
-			ps.setBinaryStream(i, new ByteArrayInputStream(parameter.getBytes(StringUtils.UTF8)),
-					parameter.length());
-		} catch (UnsupportedEncodingException e) {
-			throw new MybatisPlusException("Blob Encoding Error!");
-		}
-	}
+    @Override
+    public void setNonNullParameter(PreparedStatement ps, int i, String parameter, JdbcType jdbcType) throws SQLException {
+        try {
+            ps.setBinaryStream(i, new ByteArrayInputStream(parameter.getBytes(StringUtils.UTF8)),
+                parameter.length());
+        } catch (UnsupportedEncodingException e) {
+            throw new MybatisPlusException("Blob Encoding Error!" );
+        }
+    }
 
-	@Override
-	public String getNullableResult(ResultSet rs, String columnName) throws SQLException {
-		return StringUtils.blob2String(rs.getBlob(columnName));
-	}
+    @Override
+    public String getNullableResult(ResultSet rs, String columnName) throws SQLException {
+        return StringUtils.blob2String(rs.getBlob(columnName));
+    }
 
-	@Override
-	public String getNullableResult(CallableStatement cs, int columnIndex) throws SQLException {
-		return StringUtils.blob2String(cs.getBlob(columnIndex));
-	}
+    @Override
+    public String getNullableResult(CallableStatement cs, int columnIndex) throws SQLException {
+        return StringUtils.blob2String(cs.getBlob(columnIndex));
+    }
 
-	@Override
-	public String getNullableResult(ResultSet rs, int columnIndex)
-			throws SQLException {
-		return null;
-	}
+    @Override
+    public String getNullableResult(ResultSet rs, int columnIndex)
+        throws SQLException {
+        return null;
+    }
 
 }

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

@@ -40,14 +40,14 @@ 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;
     }
 
     @Override
     public void setNonNullParameter(PreparedStatement ps, int i, IEnum parameter, JdbcType jdbcType)
-            throws SQLException {
+        throws SQLException {
         if (jdbcType == null) {
             ps.setObject(i, parameter.getValue());
         } else {

+ 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();
         }
         // 正常逻辑

+ 1 - 1
mybatis-plus-extension/src/main/java/com/baomidou/mybatisplus/extension/package-info.java

@@ -1,6 +1,6 @@
 /**
  * <p>
- *   mybatis-plus扩展功能,包括分页,sql解析,spring集成
+ * mybatis-plus扩展功能,包括分页,sql解析,spring集成
  * </p>
  *
  * @author yuxiaobin

+ 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;

+ 20 - 20
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) {
@@ -105,7 +105,7 @@ public class PerformanceInterceptor implements Interceptor {
             } catch (Exception ignored) {
             }
         } else if (T4CPreparedStatement.equals(stmtClassName)
-                || OraclePreparedStatementWrapper.equals(stmtClassName)) {
+            || OraclePreparedStatementWrapper.equals(stmtClassName)) {
             try {
                 if (oracleGetOriginalSqlMethod != null) {
                     Object stmtSql = oracleGetOriginalSqlMethod.invoke(statement);
@@ -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);
         }

+ 10 - 10
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 语句是否停止执行
      */
@@ -76,8 +76,8 @@ public class SqlExplainInterceptor implements Interceptor {
             Connection connection = executor.getTransaction().getConnection();
             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!");
+                && VersionUtils.compare(minMySQLVersion, databaseVersion)) {
+                logger.warn("Warn: Your mysql version needs to be greater than '5.6.3' to execute of Sql Explain!" );
                 return invocation.proceed();
             }
             /**
@@ -103,21 +103,21 @@ 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,
-                SqlCommandType.SELECT);
+        MappedStatement.Builder builder = new MappedStatement.Builder(configuration, "explain_sql" , sqlsource,
+            SqlCommandType.SELECT);
         builder.resultMaps(mappedStatement.getResultMaps()).resultSetType(mappedStatement.getResultSetType())
-                .statementType(mappedStatement.getStatementType());
+            .statementType(mappedStatement.getStatementType());
         MappedStatement queryStatement = builder.build();
         DefaultParameterHandler handler = new DefaultParameterHandler(queryStatement, parameter, boundSql);
         try (PreparedStatement stmt = connection.prepareStatement(sqlExplain)) {
             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;
     }

+ 11 - 11
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(getRowNumber(originalSql));
+            .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();
     }
 }

+ 14 - 14
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 ")
-                //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__");
+        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__" );
         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);
 
     /**

+ 15 - 15
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;
     }
@@ -159,11 +159,11 @@ public class ServiceImpl<M extends BaseMapper<T>, T> implements IService<T> {
                 } else {
                     /*
                      * 更新成功直接返回,失败执行插入逻辑
-					 */
+                     */
                     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;
@@ -182,11 +182,11 @@ public class ServiceImpl<M extends BaseMapper<T>, T> implements IService<T> {
                 } else {
                     /*
                      * 更新成功直接返回,失败执行插入逻辑
-					 */
+                     */
                     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;
     }
@@ -405,14 +405,14 @@ public class ServiceImpl<M extends BaseMapper<T>, T> implements IService<T> {
 
     @Override
     public Page<Map<String, Object>> selectMapsPage(Page page, Wrapper<T> wrapper) {
-        wrapper = (Wrapper<T>) SqlHelper.fillWrapper(page,  wrapper);
+        wrapper = (Wrapper<T>) SqlHelper.fillWrapper(page, wrapper);
         page.setRecords(baseMapper.selectMapsPage(page, wrapper));
         return page;
     }
 
     @Override
     public Page<T> selectPage(Page<T> page, Wrapper<T> wrapper) {
-        wrapper = (Wrapper<T>) SqlHelper.fillWrapper(page,  wrapper);
+        wrapper = (Wrapper<T>) SqlHelper.fillWrapper(page, wrapper);
         page.setRecords(baseMapper.selectPage(page, wrapper));
         return page;
     }

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

@@ -109,7 +109,7 @@ public class MybatisMapperRefresh implements Runnable {
         final GlobalConfiguration globalConfig = GlobalConfigUtils.getGlobalConfig(configuration);
         /*
          * 启动 XML 热加载
-		 */
+         */
         if (enabled) {
             beforeTime = SystemClock.now();
             final MybatisMapperRefresh runnable = this;
@@ -124,7 +124,7 @@ public class MybatisMapperRefresh implements Runnable {
                                 try {
                                     if (ResourceUtils.isJarURL(mapperLocation.getURL())) {
                                         String key = new UrlResource(ResourceUtils.extractJarFileURL(mapperLocation.getURL()))
-                                                .getFile().getPath();
+                                            .getFile().getPath();
                                         fileSet.add(key);
                                         if (jarMapper.get(key) != null) {
                                             jarMapper.get(key).add(mapperLocation);
@@ -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");
+                new XMLMapperEntityResolver());
+            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());
+                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);
@@ -253,12 +253,12 @@ public class MybatisMapperRefresh implements Runnable {
     private void clearResultMap(XNode xNode, String namespace) {
         for (XNode resultChild : xNode.getChildren()) {
             if ("association".equals(resultChild.getName()) || "collection".equals(resultChild.getName())
-                    || "case".equals(resultChild.getName())) {
-                if (resultChild.getStringAttribute("select") == null) {
+                || "case".equals(resultChild.getName())) {
+                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;
         }
     }

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

@@ -53,11 +53,11 @@ 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")加载非模式路径部分,然后进行遍历模式匹配,排除重复包路径
-		 */
+         * 将首先通过ClassLoader.getResource("META-INF")加载非模式路径部分,然后进行遍历模式匹配,排除重复包路径
+         */
         try {
             Set<String> set = new HashSet<>();
             Resource[] resources = resolver.getResources(pkg);
@@ -93,11 +93,11 @@ 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")加载非模式路径部分,然后进行遍历模式匹配,排除重复包路径
-		 */
+         * 将首先通过ClassLoader.getResource("META-INF")加载非模式路径部分,然后进行遍历模式匹配,排除重复包路径
+         */
         try {
             Set<Class> set = new HashSet<>();
             Resource[] resources = resolver.getResources(pkg);

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

@@ -37,7 +37,7 @@ import com.baomidou.mybatisplus.core.toolkit.StringUtils;
  * @author Caratacus
  * @Date 2016-12-11
  */
-public class SqlRunner extends ISqlRunner{
+public class SqlRunner extends ISqlRunner {
 
     // 单例Query
     public static final SqlRunner DEFAULT = new SqlRunner();
@@ -95,8 +95,8 @@ public class SqlRunner extends ISqlRunner{
     /**
      * 获取sqlMap参数
      *
-     * @param sql   指定参数的格式: {0}, {1}
-     * @param args  仅支持String
+     * @param sql  指定参数的格式: {0}, {1}
+     * @param args 仅支持String
      * @return
      */
     private Map<String, String> sqlMap(String sql, Object... args) {
@@ -112,10 +112,10 @@ public class SqlRunner extends ISqlRunner{
 
     /**
      * 根据sql查询Map结果集
-     *   SqlRunner.db().selectList("select * from tbl_user where name={0}", "Caratacus")
+     * SqlRunner.db().selectList("select * from tbl_user where name={0}", "Caratacus")
      *
-     * @param sql    sql语句,可添加参数,格式:{0},{1}
-     * @param args   只接受String格式
+     * @param sql  sql语句,可添加参数,格式:{0},{1}
+     * @param args 只接受String格式
      * @return
      */
     public List<Map<String, Object>> selectList(String sql, Object... args) {
@@ -124,10 +124,10 @@ public class SqlRunner extends ISqlRunner{
 
     /**
      * 根据sql查询一个字段值的结果集
-     *   注意:该方法只会返回一个字段的值, 如果需要多字段,请参考{@code selectList()}
+     * 注意:该方法只会返回一个字段的值, 如果需要多字段,请参考{@code selectList()}
      *
-     * @param sql    sql语句,可添加参数,格式:{0},{1}
-     * @param args   只接受String格式
+     * @param sql  sql语句,可添加参数,格式:{0},{1}
+     * @param args 只接受String格式
      * @return
      */
     public List<Object> selectObjs(String sql, Object... args) {
@@ -136,10 +136,10 @@ public class SqlRunner extends ISqlRunner{
 
     /**
      * 根据sql查询一个字段值的一条结果
-     *   注意:该方法只会返回一个字段的值, 如果需要多字段,请参考{@code selectOne()}
+     * 注意:该方法只会返回一个字段的值, 如果需要多字段,请参考{@code selectOne()}
      *
-     * @param sql    sql语句,可添加参数,格式:{0},{1}
-     * @param args   只接受String格式
+     * @param sql  sql语句,可添加参数,格式:{0},{1}
+     * @param args 只接受String格式
      * @return
      */
     public Object selectObj(String sql, Object... args) {
@@ -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;

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

@@ -22,18 +22,18 @@ 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);
         int diff = 0;
         // 先比较长度 再比较字符
         while (idx < minLength && (diff = versionArray1[idx].length() - versionArray2[idx].length()) == 0
-                && (diff = versionArray1[idx].compareTo(versionArray2[idx])) == 0) {
+            && (diff = versionArray1[idx].compareTo(versionArray2[idx])) == 0) {
             ++idx;
         }
         // 如果已经分出大小,则直接返回,如果未分出大小,则再比较位数,有子版本的为大;

+ 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);
         // 加载配置文件

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

@@ -52,126 +52,126 @@ public class EntityWrapperTest {
     public void test() {
         /*
          * 无条件测试
-		 */
-        Assert.assertEquals("", ew.originalSql());
+         */
+        Assert.assertEquals("" , ew.originalSql());
     }
 
     @Test
     public void test11() {
         /*
          * 实体带where ifneed
-		 */
+         */
         ew.setEntity(new User(1));
-        ew.where("name={0}", "'123'").addFilterIfNeed(false, "id=12");
+        ew.where("name={0}" , "'123'" ).addFilterIfNeed(false, "id=12" );
         String sqlSegment = ew.originalSql();
         System.err.println("test11 = " + sqlSegment);
-        Assert.assertEquals("AND (name=?)", sqlSegment);
+        Assert.assertEquals("AND (name=?)" , sqlSegment);
     }
 
     @Test
     public void test12() {
         /*
          * 实体带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
     public void test13() {
         /*
          * 实体排序
-		 */
+         */
         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
     public void test21() {
         /*
          * 无实体 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
     public void test23() {
         /*
          * 无实体查询,只排序
-		 */
-        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
     public void testNoTSQL() {
         /*
          * 实体 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
     public void testNoTSQL1() {
         /*
          * 非 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
     public void testTSQL11() {
         /*
          * 实体带查询使用方法 输出看结果
-		 */
+         */
         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());
+            + "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());
     }
 
     @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);
     }
 
     /**
@@ -179,10 +179,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);
     }
 
     /**
@@ -190,10 +190,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);
     }
 
     /**
@@ -201,10 +201,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);
     }
 
     /**
@@ -213,13 +213,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);
     }
 
     /**
@@ -231,10 +231,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);
     }
 
     /**
@@ -246,10 +246,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);
     }
 
     /**
@@ -257,12 +257,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);
     }
 
     /**
@@ -270,12 +270,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);
     }
 
     /**
@@ -283,8 +283,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);
@@ -295,12 +295,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);
@@ -328,15 +328,15 @@ public class EntityWrapperTest {
     public void testIsWhere() {
         /*
          * 实体带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());
     }
 
@@ -345,11 +345,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);
     }
 
     /**
@@ -358,9 +358,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());
     }
 
     /**
@@ -370,9 +370,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());
 
     }
 
@@ -382,10 +382,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());
     }
 
     /**
@@ -394,9 +394,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);
     }
 

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

@@ -45,7 +45,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);
         }
@@ -58,43 +58,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();
@@ -109,7 +109,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();

+ 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);
     }
 }
 

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

@@ -42,9 +42,9 @@ public class H2MetaObjectHandlerTest extends H2Test {
 
     @BeforeClass
     public static void initDB() throws SQLException, IOException {
-        @SuppressWarnings("resource")
-        ApplicationContext context = new ClassPathXmlApplicationContext("classpath:h2/spring-test-h2-metaobj.xml");
-        DataSource ds = (DataSource) context.getBean("dataSource");
+        @SuppressWarnings("resource" )
+        ApplicationContext context = new ClassPathXmlApplicationContext("classpath:h2/spring-test-h2-metaobj.xml" );
+        DataSource ds = (DataSource) context.getBean("dataSource" );
         try (Connection conn = ds.getConnection()) {
             initData(conn);
         }
@@ -53,37 +53,37 @@ public class H2MetaObjectHandlerTest extends H2Test {
     @Test
     public void testMetaObjectHandler() {
         H2UserMetaObj user = new H2UserMetaObj();
-        user.setName("metaobjtest");
+        user.setName("metaobjtest" );
         user.setVersion(1);
         user.setAge(12);
         Calendar cal = Calendar.getInstance();
         cal.add(Calendar.DAY_OF_MONTH, -1);
         user.setLastUpdatedDt(new Timestamp(cal.getTimeInMillis()));
-        user.setDesc("abc");
+        user.setDesc("abc" );
         userMapper.insert(user);
         System.out.println("before update: getLastUpdatedDt=" + user.getLastUpdatedDt());
         Assert.assertNotNull(userMapper.selectById(user.getId()).getTestType());
 
-        user.setName("999");
+        user.setName("999" );
         userMapper.updateById(user);
         H2UserMetaObj userDB = userMapper.selectById(user.getId());
         //MyMetaObjectHandler.insertFill() : set default testType value=3
         Assert.assertEquals(3, userDB.getTestType().intValue());
-        Assert.assertEquals("999", userDB.getName());
+        Assert.assertEquals("999" , userDB.getName());
         assertUpdateFill(userDB.getLastUpdatedDt());
     }
 
     @Test
     public void testMetaObjectHandlerNullInsert4Update() {
         H2UserMetaObj user = new H2UserMetaObj();
-        user.setName("metaobjtest");
+        user.setName("metaobjtest" );
         user.setVersion(1);
         user.setAge(12);
-        user.setDesc("abc");
+        user.setDesc("abc" );
         userMapper.insert(user);
         System.out.println("before update: getLastUpdatedDt=" + user.getLastUpdatedDt());
         Assert.assertNotNull(userMapper.selectById(user.getId()).getTestType());
-        user.setName("999");
+        user.setName("999" );
         userMapper.updateById(user);
         H2UserMetaObj userDB = userMapper.selectById(user.getId());
         assertUpdateFill(userDB.getLastUpdatedDt());
@@ -92,7 +92,7 @@ public class H2MetaObjectHandlerTest extends H2Test {
 
     @Test
     public void testInsertMy() {
-        String name = "testInsertMy";
+        String name = "testInsertMy" ;
         int version = 1;
         int row = userMapper.myInsertWithNameVersion(name, version);
         Assert.assertEquals(1, row);
@@ -101,19 +101,19 @@ public class H2MetaObjectHandlerTest extends H2Test {
     @Test
     public void testUpdateMy() {
         H2UserMetaObj user = new H2UserMetaObj();
-        user.setName("myUpdate");
+        user.setName("myUpdate" );
         user.setVersion(1);
         userMapper.insert(user);
         Long id = user.getId();
         H2UserMetaObj 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("updateMy" , dbUser.getName());
         Assert.assertEquals(1, user.getVersion().intValue());
     }
 

部分文件因为文件数量过多而无法显示