Ver código fonte

clean generator

miemie 4 anos atrás
pai
commit
4720b0acc9
100 arquivos alterados com 0 adições e 8763 exclusões
  1. 0 6
      build.gradle
  2. 0 18
      mybatis-plus-generator/build.gradle
  3. 0 196
      mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/AutoGenerator.java
  4. 0 80
      mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/InjectionConfig.java
  5. 0 69
      mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/config/ConstVal.java
  6. 0 174
      mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/config/DataSourceConfig.java
  7. 0 49
      mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/config/FileOutConfig.java
  8. 0 101
      mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/config/GlobalConfig.java
  9. 0 104
      mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/config/IDbQuery.java
  10. 0 54
      mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/config/IFileCreate.java
  11. 0 60
      mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/config/IKeyWordsHandler.java
  12. 0 44
      mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/config/INameConvert.java
  13. 0 50
      mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/config/ITypeConvert.java
  14. 0 83
      mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/config/PackageConfig.java
  15. 0 400
      mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/config/StrategyConfig.java
  16. 0 84
      mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/config/TemplateConfig.java
  17. 0 28
      mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/config/TemplateType.java
  18. 0 687
      mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/config/builder/ConfigBuilder.java
  19. 0 19
      mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/config/builder/package-info.java
  20. 0 56
      mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/config/converts/DB2TypeConvert.java
  21. 0 72
      mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/config/converts/DmTypeConvert.java
  22. 0 89
      mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/config/converts/FirebirdTypeConvert.java
  23. 0 89
      mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/config/converts/KingbaseESTypeConvert.java
  24. 0 92
      mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/config/converts/MySqlTypeConvert.java
  25. 0 96
      mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/config/converts/OracleTypeConvert.java
  26. 0 89
      mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/config/converts/OscarTypeConvert.java
  27. 0 87
      mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/config/converts/PostgreSqlTypeConvert.java
  28. 0 85
      mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/config/converts/SqlServerTypeConvert.java
  29. 0 57
      mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/config/converts/SqliteTypeConvert.java
  30. 0 99
      mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/config/converts/TypeConverts.java
  31. 0 16
      mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/config/converts/package-info.java
  32. 0 64
      mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/config/converts/select/Branch.java
  33. 0 59
      mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/config/converts/select/BranchBuilder.java
  34. 0 110
      mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/config/converts/select/Selector.java
  35. 0 19
      mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/config/package-info.java
  36. 0 52
      mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/config/po/LikeTable.java
  37. 0 138
      mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/config/po/TableField.java
  38. 0 43
      mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/config/po/TableFill.java
  39. 0 161
      mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/config/po/TableInfo.java
  40. 0 19
      mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/config/po/package-info.java
  41. 0 42
      mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/config/querys/AbstractDbQuery.java
  42. 0 73
      mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/config/querys/DB2Query.java
  43. 0 78
      mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/config/querys/DMQuery.java
  44. 0 53
      mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/config/querys/DbQueryRegistry.java
  45. 0 95
      mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/config/querys/FirebirdQuery.java
  46. 0 77
      mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/config/querys/GaussQuery.java
  47. 0 83
      mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/config/querys/H2Query.java
  48. 0 75
      mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/config/querys/KingbaseESQuery.java
  49. 0 81
      mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/config/querys/MariadbQuery.java
  50. 0 81
      mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/config/querys/MySqlQuery.java
  51. 0 82
      mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/config/querys/OracleQuery.java
  52. 0 81
      mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/config/querys/OscarQuery.java
  53. 0 75
      mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/config/querys/PostgreSqlQuery.java
  54. 0 97
      mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/config/querys/SqlServerQuery.java
  55. 0 72
      mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/config/querys/SqliteQuery.java
  56. 0 67
      mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/config/querys/XuguQuery.java
  57. 0 19
      mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/config/querys/package-info.java
  58. 0 38
      mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/config/rules/DateType.java
  59. 0 92
      mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/config/rules/DbColumnType.java
  60. 0 32
      mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/config/rules/FileType.java
  61. 0 39
      mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/config/rules/IColumnType.java
  62. 0 145
      mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/config/rules/NamingStrategy.java
  63. 0 19
      mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/config/rules/package-info.java
  64. 0 315
      mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/engine/AbstractTemplateEngine.java
  65. 0 80
      mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/engine/BeetlTemplateEngine.java
  66. 0 62
      mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/engine/FreemarkerTemplateEngine.java
  67. 0 78
      mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/engine/VelocityTemplateEngine.java
  68. 0 45
      mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/keywords/BaseKeyWordsHandler.java
  69. 0 127
      mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/keywords/H2KeyWordsHandler.java
  70. 0 668
      mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/keywords/MySqlKeyWordsHandler.java
  71. 0 147
      mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/keywords/PostgreSqlKeyWordsHandler.java
  72. 0 23
      mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/keywords/package-info.java
  73. 0 19
      mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/package-info.java
  74. 0 39
      mybatis-plus-generator/src/main/resources/templates/controller.java.btl
  75. 0 39
      mybatis-plus-generator/src/main/resources/templates/controller.java.ftl
  76. 0 41
      mybatis-plus-generator/src/main/resources/templates/controller.java.vm
  77. 0 166
      mybatis-plus-generator/src/main/resources/templates/entity.java.btl
  78. 0 156
      mybatis-plus-generator/src/main/resources/templates/entity.java.ftl
  79. 0 159
      mybatis-plus-generator/src/main/resources/templates/entity.java.vm
  80. 0 124
      mybatis-plus-generator/src/main/resources/templates/entity.kt.btl
  81. 0 115
      mybatis-plus-generator/src/main/resources/templates/entity.kt.ftl
  82. 0 114
      mybatis-plus-generator/src/main/resources/templates/entity.kt.vm
  83. 0 20
      mybatis-plus-generator/src/main/resources/templates/mapper.java.btl
  84. 0 20
      mybatis-plus-generator/src/main/resources/templates/mapper.java.ftl
  85. 0 20
      mybatis-plus-generator/src/main/resources/templates/mapper.java.vm
  86. 0 41
      mybatis-plus-generator/src/main/resources/templates/mapper.xml.btl
  87. 0 39
      mybatis-plus-generator/src/main/resources/templates/mapper.xml.ftl
  88. 0 39
      mybatis-plus-generator/src/main/resources/templates/mapper.xml.vm
  89. 0 20
      mybatis-plus-generator/src/main/resources/templates/service.java.btl
  90. 0 20
      mybatis-plus-generator/src/main/resources/templates/service.java.ftl
  91. 0 20
      mybatis-plus-generator/src/main/resources/templates/service.java.vm
  92. 0 26
      mybatis-plus-generator/src/main/resources/templates/serviceImpl.java.btl
  93. 0 26
      mybatis-plus-generator/src/main/resources/templates/serviceImpl.java.ftl
  94. 0 26
      mybatis-plus-generator/src/main/resources/templates/serviceImpl.java.vm
  95. 0 54
      mybatis-plus-generator/src/test/java/com/baomidou/mybatisplus/generator/config/converts/SqlServerTypeConvertTest.java
  96. 0 33
      mybatis-plus-generator/src/test/java/com/baomidou/mybatisplus/generator/config/converts/select/SelectorTest.java
  97. 0 18
      mybatis-plus-generator/src/test/java/com/baomidou/mybatisplus/generator/config/rules/NamingStrategyTest.java
  98. 0 129
      mybatis-plus-generator/src/test/java/com/baomidou/mybatisplus/test/generator/CodeGeneratorTest.java
  99. 0 122
      mybatis-plus-generator/src/test/java/com/baomidou/mybatisplus/test/generator/CodeGeneratorWithTemplateTest.java
  100. 0 79
      mybatis-plus-generator/src/test/java/com/baomidou/mybatisplus/test/generator/DB2Generator.java

+ 0 - 6
build.gradle

@@ -63,11 +63,6 @@ ext {
         "mysql"                      : "mysql:mysql-connector-java:8.0.21",
         "sqlite"                     : "org.xerial:sqlite-jdbc:3.32.3.1",
         "firebird"                   : "org.firebirdsql.jdbc:jaybird:4.0.1.java8",
-        //code generator
-        "velocity"                   : "org.apache.velocity:velocity-engine-core:2.2",
-        "freemarker"                 : "org.freemarker:freemarker:2.3.30",
-        "beetl"                      : "com.ibeetl:beetl:3.2.1.RELEASE",
-        "swagger-annotations"        : "io.swagger:swagger-annotations:1.6.2",
         //cache
         "mybatis-ehcache"            : "org.mybatis.caches:mybatis-ehcache:1.2.1",
         "mybatis-redis"              : "org.mybatis.caches:mybatis-redis:1.0.0-beta2",
@@ -172,7 +167,6 @@ subprojects {
     test {
         dependsOn("cleanTest", "generatePomFileForMavenJavaPublication")
         useJUnitPlatform()
-        exclude("**/generator/**")
         exclude("**/mysql/**")
         exclude("**/phoenix/**")
     }

+ 0 - 18
mybatis-plus-generator/build.gradle

@@ -1,18 +0,0 @@
-dependencies {
-    api project(":mybatis-plus-extension")
-
-    implementation "${lib.velocity}"
-    implementation "${lib.freemarker}"
-    implementation "${lib.beetl}"
-
-    testImplementation "${lib.sqlserver}"
-    testImplementation "${lib.postgresql}"
-    testImplementation lib.oracle as ConfigurableFileTree
-    testImplementation lib.dm as ConfigurableFileTree
-    testImplementation lib.kingbase as ConfigurableFileTree
-    testImplementation "${lib.h2}"
-    testImplementation "${lib.mysql}"
-    testImplementation "${lib.sqlite}"
-    testImplementation "${lib.firebird}"
-    testImplementation "${lib.'swagger-annotations'}"
-}

+ 0 - 196
mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/AutoGenerator.java

@@ -1,196 +0,0 @@
-/*
- * Copyright (c) 2011-2020, baomidou (jobob@qq.com).
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.baomidou.mybatisplus.generator;
-
-import com.baomidou.mybatisplus.annotation.TableId;
-import com.baomidou.mybatisplus.annotation.TableLogic;
-import com.baomidou.mybatisplus.annotation.TableName;
-import com.baomidou.mybatisplus.annotation.Version;
-import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
-import com.baomidou.mybatisplus.core.toolkit.StringUtils;
-import com.baomidou.mybatisplus.extension.activerecord.Model;
-import com.baomidou.mybatisplus.generator.config.*;
-import com.baomidou.mybatisplus.generator.config.builder.ConfigBuilder;
-import com.baomidou.mybatisplus.generator.config.po.TableField;
-import com.baomidou.mybatisplus.generator.config.po.TableInfo;
-import com.baomidou.mybatisplus.generator.engine.AbstractTemplateEngine;
-import com.baomidou.mybatisplus.generator.engine.VelocityTemplateEngine;
-import lombok.AccessLevel;
-import lombok.Data;
-import lombok.Getter;
-import lombok.Setter;
-import lombok.experimental.Accessors;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.Serializable;
-import java.util.List;
-import java.util.stream.Collectors;
-
-/**
- * 生成文件
- *
- * @author YangHu, tangguo, hubin
- * @since 2016-08-30
- */
-@Data
-@Accessors(chain = true)
-public class AutoGenerator {
-    private static final Logger logger = LoggerFactory.getLogger(AutoGenerator.class);
-
-    /**
-     * 配置信息
-     */
-    protected ConfigBuilder config;
-    /**
-     * 注入配置
-     */
-    @Getter(AccessLevel.NONE)
-    @Setter(AccessLevel.NONE)
-    protected InjectionConfig injectionConfig;
-    /**
-     * 数据源配置
-     */
-    private DataSourceConfig dataSource;
-    /**
-     * 数据库表配置
-     */
-    private StrategyConfig strategy;
-    /**
-     * 包 相关配置
-     */
-    private PackageConfig packageInfo;
-    /**
-     * 模板 相关配置
-     */
-    private TemplateConfig template;
-    /**
-     * 全局 相关配置
-     */
-    private GlobalConfig globalConfig;
-    /**
-     * 模板引擎
-     */
-    private AbstractTemplateEngine templateEngine;
-
-    /**
-     * 生成代码
-     */
-    public void execute() {
-        logger.debug("==========================准备生成文件...==========================");
-        // 初始化配置
-        if (null == config) {
-            config = new ConfigBuilder(packageInfo, dataSource, strategy, template, globalConfig);
-            if (null != injectionConfig) {
-                injectionConfig.setConfig(config);
-            }
-        }
-        if (null == templateEngine) {
-            // 为了兼容之前逻辑,采用 Velocity 引擎 【 默认 】
-            templateEngine = new VelocityTemplateEngine();
-        }
-        // 模板引擎初始化执行文件输出
-        templateEngine.init(this.pretreatmentConfigBuilder(config)).mkdirs().batchOutput().open();
-        logger.debug("==========================文件生成完成!!!==========================");
-    }
-
-    /**
-     * 开放表信息、预留子类重写
-     *
-     * @param config 配置信息
-     * @return ignore
-     */
-    protected List<TableInfo> getAllTableInfoList(ConfigBuilder config) {
-        return config.getTableInfoList();
-    }
-
-    /**
-     * 预处理配置
-     *
-     * @param config 总配置信息
-     * @return 解析数据结果集
-     */
-    protected ConfigBuilder pretreatmentConfigBuilder(ConfigBuilder config) {
-        /*
-         * 注入自定义配置
-         */
-        if (null != injectionConfig) {
-            injectionConfig.initMap();
-            config.setInjectionConfig(injectionConfig);
-        }
-        /*
-         * 表信息列表
-         */
-        List<TableInfo> tableList = this.getAllTableInfoList(config);
-        for (TableInfo tableInfo : tableList) {
-            /* ---------- 添加导入包 ---------- */
-            if (config.getGlobalConfig().isActiveRecord()) {
-                // 开启 ActiveRecord 模式
-                tableInfo.setImportPackages(Model.class.getCanonicalName());
-            }
-            if (tableInfo.isConvert()) {
-                // 表注解
-                tableInfo.setImportPackages(TableName.class.getCanonicalName());
-            }
-            if (config.getStrategyConfig().getLogicDeleteFieldName() != null && tableInfo.isLogicDelete(config.getStrategyConfig().getLogicDeleteFieldName())) {
-                // 逻辑删除注解
-                tableInfo.setImportPackages(TableLogic.class.getCanonicalName());
-            }
-            if (StringUtils.isNotBlank(config.getStrategyConfig().getVersionFieldName())) {
-                // 乐观锁注解
-                tableInfo.setImportPackages(Version.class.getCanonicalName());
-            }
-            boolean importSerializable = true;
-            if (StringUtils.isNotBlank(config.getStrategyConfig().getSuperEntityClass())) {
-                // 父实体
-                tableInfo.setImportPackages(config.getStrategyConfig().getSuperEntityClass());
-                importSerializable = false;
-            }
-            if (config.getGlobalConfig().isActiveRecord()) {
-                importSerializable = true;
-            }
-            if (importSerializable) {
-                tableInfo.setImportPackages(Serializable.class.getCanonicalName());
-            }
-            // Boolean类型is前缀处理
-            if (config.getStrategyConfig().isEntityBooleanColumnRemoveIsPrefix()
-                && CollectionUtils.isNotEmpty(tableInfo.getFields())) {
-                List<TableField> tableFields = tableInfo.getFields().stream().filter(field -> "boolean".equalsIgnoreCase(field.getPropertyType()))
-                    .filter(field -> field.getPropertyName().startsWith("is")).collect(Collectors.toList());
-                tableFields.forEach(field -> {
-                    //主键为is的情况基本上是不存在的.
-                    if (field.isKeyFlag()) {
-                        tableInfo.setImportPackages(TableId.class.getCanonicalName());
-                    } else {
-                        tableInfo.setImportPackages(com.baomidou.mybatisplus.annotation.TableField.class.getCanonicalName());
-                    }
-                    field.setConvert(true);
-                    field.setPropertyName(StringUtils.removePrefixAfterPrefixToLower(field.getPropertyName(), 2));
-                });
-            }
-        }
-        return config.setTableInfoList(tableList);
-    }
-
-    public InjectionConfig getCfg() {
-        return injectionConfig;
-    }
-
-    public AutoGenerator setCfg(InjectionConfig injectionConfig) {
-        this.injectionConfig = injectionConfig;
-        return this;
-    }
-}

+ 0 - 80
mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/InjectionConfig.java

@@ -1,80 +0,0 @@
-/*
- * Copyright (c) 2011-2020, baomidou (jobob@qq.com).
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.baomidou.mybatisplus.generator;
-
-import com.baomidou.mybatisplus.generator.config.FileOutConfig;
-import com.baomidou.mybatisplus.generator.config.IFileCreate;
-import com.baomidou.mybatisplus.generator.config.builder.ConfigBuilder;
-import com.baomidou.mybatisplus.generator.config.po.TableInfo;
-import lombok.Data;
-import lombok.experimental.Accessors;
-
-import java.util.List;
-import java.util.Map;
-
-/**
- * 抽象的对外接口
- *
- * @author hubin
- * @since 2016-12-07
- */
-@Data
-@Accessors(chain = true)
-public abstract class InjectionConfig {
-
-    /**
-     * 全局配置
-     */
-    private ConfigBuilder config;
-
-    /**
-     * 自定义返回配置 Map 对象
-     */
-    private Map<String, Object> map;
-
-    /**
-     * 自定义输出文件
-     */
-    private List<FileOutConfig> fileOutConfigList;
-
-    /**
-     * 自定义判断是否创建文件
-     */
-    private IFileCreate fileCreate;
-
-    /**
-     * 注入自定义 Map 对象,针对所有表的全局参数
-     */
-    public abstract void initMap();
-
-    /**
-     * 依据表相关信息,从三方获取到需要元数据,处理方法环境里面
-     *
-     * @param tableInfo
-     */
-    public void initTableMap(TableInfo tableInfo) {
-        // 子类重写注入表对应补充信息
-    }
-
-    /**
-     * 模板待渲染 Object Map 预处理<br>
-     * com.baomidou.mybatisplus.generator.engine.AbstractTemplateEngine
-     * 方法: getObjectMap 结果处理
-     */
-    public Map<String, Object> prepareObjectMap(Map<String, Object> objectMap) {
-        return objectMap;
-    }
-}

+ 0 - 69
mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/config/ConstVal.java

@@ -1,69 +0,0 @@
-/*
- * Copyright (c) 2011-2020, baomidou (jobob@qq.com).
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.baomidou.mybatisplus.generator.config;
-
-import com.baomidou.mybatisplus.core.toolkit.StringPool;
-
-import java.nio.charset.StandardCharsets;
-
-/**
- * 定义常量
- *
- * @author YangHu, tangguo, hubin
- * @since 2016-08-31
- */
-public interface ConstVal {
-
-    String MODULE_NAME = "ModuleName";
-
-    String ENTITY = "Entity";
-    String SERVICE = "Service";
-    String SERVICE_IMPL = "ServiceImpl";
-    String MAPPER = "Mapper";
-    String XML = "Xml";
-    String CONTROLLER = "Controller";
-
-    String ENTITY_PATH = "entity_path";
-    String SERVICE_PATH = "service_path";
-    String SERVICE_IMPL_PATH = "service_impl_path";
-    String MAPPER_PATH = "mapper_path";
-    String XML_PATH = "xml_path";
-    String CONTROLLER_PATH = "controller_path";
-
-    String JAVA_TMPDIR = "java.io.tmpdir";
-    String UTF8 = StandardCharsets.UTF_8.name();
-    String UNDERLINE = "_";
-
-    String JAVA_SUFFIX = StringPool.DOT_JAVA;
-    String KT_SUFFIX = ".kt";
-    String XML_SUFFIX = ".xml";
-
-    String TEMPLATE_ENTITY_JAVA = "/templates/entity.java";
-    String TEMPLATE_ENTITY_KT = "/templates/entity.kt";
-    String TEMPLATE_MAPPER = "/templates/mapper.java";
-    String TEMPLATE_XML = "/templates/mapper.xml";
-    String TEMPLATE_SERVICE = "/templates/service.java";
-    String TEMPLATE_SERVICE_IMPL = "/templates/serviceImpl.java";
-    String TEMPLATE_CONTROLLER = "/templates/controller.java";
-
-    String VM_LOAD_PATH_KEY = "file.resource.loader.class";
-    String VM_LOAD_PATH_VALUE = "org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader";
-
-    String SUPER_MAPPER_CLASS = "com.baomidou.mybatisplus.core.mapper.BaseMapper";
-    String SUPER_SERVICE_CLASS = "com.baomidou.mybatisplus.extension.service.IService";
-    String SUPER_SERVICE_IMPL_CLASS = "com.baomidou.mybatisplus.extension.service.impl.ServiceImpl";
-
-}

+ 0 - 174
mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/config/DataSourceConfig.java

@@ -1,174 +0,0 @@
-/*
- * Copyright (c) 2011-2020, baomidou (jobob@qq.com).
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.baomidou.mybatisplus.generator.config;
-
-import com.baomidou.mybatisplus.annotation.DbType;
-import com.baomidou.mybatisplus.core.toolkit.ExceptionUtils;
-import com.baomidou.mybatisplus.generator.config.converts.MySqlTypeConvert;
-import com.baomidou.mybatisplus.generator.config.converts.TypeConverts;
-import com.baomidou.mybatisplus.generator.config.querys.DbQueryRegistry;
-import lombok.Data;
-import lombok.experimental.Accessors;
-
-import java.sql.Connection;
-import java.sql.DriverManager;
-import java.sql.SQLException;
-import java.util.Optional;
-
-/**
- * 数据库配置
- *
- * @author YangHu, hcl
- * @since 2016/8/30
- */
-@Data
-@Accessors(chain = true)
-public class DataSourceConfig {
-
-    /**
-     * 数据库信息查询
-     */
-    private IDbQuery dbQuery;
-    /**
-     * 数据库类型
-     */
-    private DbType dbType;
-    /**
-     * schemaName
-     */
-    private String schemaName;
-    /**
-     * 类型转换
-     */
-    private ITypeConvert typeConvert;
-    /**
-     * 关键字处理器
-     *
-     * @since 3.3.2
-     */
-    private IKeyWordsHandler keyWordsHandler;
-    /**
-     * 驱动连接的URL
-     */
-    private String url;
-    /**
-     * 驱动名称
-     */
-    private String driverName;
-    /**
-     * 数据库连接用户名
-     */
-    private String username;
-    /**
-     * 数据库连接密码
-     */
-    private String password;
-
-    public IDbQuery getDbQuery() {
-        if (null == dbQuery) {
-            DbType dbType = getDbType();
-            DbQueryRegistry dbQueryRegistry = new DbQueryRegistry();
-            // 默认 MYSQL
-            dbQuery = Optional.ofNullable(dbQueryRegistry.getDbQuery(dbType))
-                .orElseGet(() -> dbQueryRegistry.getDbQuery(DbType.MYSQL));
-        }
-        return dbQuery;
-    }
-
-    /**
-     * 判断数据库类型
-     *
-     * @return 类型枚举值
-     */
-    public DbType getDbType() {
-        if (null == this.dbType) {
-            this.dbType = this.getDbType(this.url.toLowerCase());
-            if (null == this.dbType) {
-                throw ExceptionUtils.mpe("Unknown type of database!");
-            }
-        }
-
-        return this.dbType;
-    }
-
-    /**
-     * 判断数据库类型
-     *
-     * @param str 用于寻找特征的字符串,可以是 driverName 或小写后的 url
-     * @return 类型枚举值,如果没找到,则返回 null
-     */
-    private DbType getDbType(String str) {
-        if (str.contains(":mysql:") || str.contains(":cobar:")) {
-            return DbType.MYSQL;
-        } else if (str.contains(":oracle:")) {
-            return DbType.ORACLE;
-        } else if (str.contains(":postgresql:")) {
-            return DbType.POSTGRE_SQL;
-        } else if (str.contains(":sqlserver:")) {
-            return DbType.SQL_SERVER;
-        } else if (str.contains(":db2:")) {
-            return DbType.DB2;
-        } else if (str.contains(":mariadb:")) {
-            return DbType.MARIADB;
-        } else if (str.contains(":sqlite:")) {
-            return DbType.SQLITE;
-        } else if (str.contains(":h2:")) {
-            return DbType.H2;
-        } else if (str.contains(":kingbase:") || str.contains(":kingbase8:")) {
-            return DbType.KINGBASE_ES;
-        } else if (str.contains(":dm:")) {
-            return DbType.DM;
-        } else if (str.contains(":zenith:")) {
-            return DbType.GAUSS;
-        } else if (str.contains(":oscar:")) {
-            return DbType.OSCAR;
-        } else if (str.contains(":firebird:")) {
-            return DbType.FIREBIRD;
-        } else if (str.contains(":xugu:")) {
-            return DbType.XU_GU;
-        } else {
-            return DbType.OTHER;
-        }
-    }
-
-    public ITypeConvert getTypeConvert() {
-        if (null == typeConvert) {
-            DbType dbType = getDbType();
-            // 默认 MYSQL
-            typeConvert = TypeConverts.getTypeConvert(dbType);
-            if (null == typeConvert) {
-                typeConvert = MySqlTypeConvert.INSTANCE;
-            }
-        }
-        return typeConvert;
-    }
-
-    /**
-     * 创建数据库连接对象
-     *
-     * @return Connection
-     */
-    public Connection getConn() {
-        Connection conn;
-        try {
-            Class.forName(driverName);
-            conn = DriverManager.getConnection(url, username, password);
-        } catch (ClassNotFoundException | SQLException e) {
-            throw new RuntimeException(e);
-        }
-        return conn;
-    }
-}

+ 0 - 49
mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/config/FileOutConfig.java

@@ -1,49 +0,0 @@
-/*
- * Copyright (c) 2011-2020, baomidou (jobob@qq.com).
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.baomidou.mybatisplus.generator.config;
-
-import com.baomidou.mybatisplus.generator.config.po.TableInfo;
-import lombok.Data;
-import lombok.experimental.Accessors;
-
-/**
- * 输出文件配置
- *
- * @author hubin
- * @since 2017-01-18
- */
-@Data
-@Accessors(chain = true)
-public abstract class FileOutConfig {
-
-    /**
-     * 模板
-     */
-    private String templatePath;
-
-    public FileOutConfig() {
-        // to do nothing
-    }
-
-    public FileOutConfig(String templatePath) {
-        this.templatePath = templatePath;
-    }
-
-    /**
-     * 输出文件
-     */
-    public abstract String outputFile(TableInfo tableInfo);
-}

+ 0 - 101
mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/config/GlobalConfig.java

@@ -1,101 +0,0 @@
-/*
- * Copyright (c) 2011-2020, baomidou (jobob@qq.com).
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.baomidou.mybatisplus.generator.config;
-
-import com.baomidou.mybatisplus.annotation.IdType;
-import com.baomidou.mybatisplus.generator.config.rules.DateType;
-import lombok.Data;
-import lombok.experimental.Accessors;
-
-/**
- * 全局配置
- *
- * @author hubin
- * @since 2016-12-02
- */
-@Data
-@Accessors(chain = true)
-public class GlobalConfig {
-
-    /**
-     * 生成文件的输出目录【默认 D 盘根目录】
-     */
-    private String outputDir = "D://";
-
-    /**
-     * 是否覆盖已有文件
-     */
-    private boolean fileOverride = false;
-
-    /**
-     * 是否打开输出目录
-     */
-    private boolean open = true;
-
-    /**
-     * 是否在xml中添加二级缓存配置
-     */
-    private boolean enableCache = false;
-
-    /**
-     * 开发人员
-     */
-    private String author;
-
-    /**
-     * 开启 Kotlin 模式
-     */
-    private boolean kotlin = false;
-
-    /**
-     * 开启 swagger2 模式
-     */
-    private boolean swagger2 = false;
-
-    /**
-     * 开启 ActiveRecord 模式
-     */
-    private boolean activeRecord = false;
-
-    /**
-     * 开启 BaseResultMap
-     */
-    private boolean baseResultMap = false;
-
-    /**
-     * 时间类型对应策略
-     */
-    private DateType dateType = DateType.TIME_PACK;
-
-    /**
-     * 开启 baseColumnList
-     */
-    private boolean baseColumnList = false;
-    /**
-     * 各层文件名称方式,例如: %sAction 生成 UserAction
-     * %s 为占位符
-     */
-    private String entityName;
-    private String mapperName;
-    private String xmlName;
-    private String serviceName;
-    private String serviceImplName;
-    private String controllerName;
-    /**
-     * 指定生成的主键的ID类型
-     */
-    private IdType idType;
-}

+ 0 - 104
mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/config/IDbQuery.java

@@ -1,104 +0,0 @@
-/*
- * Copyright (c) 2011-2020, baomidou (jobob@qq.com).
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.baomidou.mybatisplus.generator.config;
-
-import com.baomidou.mybatisplus.annotation.DbType;
-
-import java.sql.ResultSet;
-import java.sql.SQLException;
-
-/**
- * 表数据查询接口
- *
- * @author hubin
- * @since 2018-01-16
- */
-public interface IDbQuery {
-
-    /**
-     * 数据库类型
-     *
-     * @deprecated 3.3.1 {@link DataSourceConfig#setDbType(DbType)}
-     */
-    @Deprecated
-    default DbType dbType() {
-        return null;
-    }
-
-
-    /**
-     * 表信息查询 SQL
-     */
-    String tablesSql();
-
-
-    /**
-     * 表字段信息查询 SQL
-     */
-    String tableFieldsSql();
-
-
-    /**
-     * 表名称
-     */
-    String tableName();
-
-
-    /**
-     * 表注释
-     */
-    String tableComment();
-
-
-    /**
-     * 字段名称
-     */
-    String fieldName();
-
-
-    /**
-     * 字段类型
-     */
-    String fieldType();
-
-
-    /**
-     * 字段注释
-     */
-    String fieldComment();
-
-
-    /**
-     * 主键字段
-     */
-    String fieldKey();
-
-
-    /**
-     * 判断主键是否为identity
-     *
-     * @param results ResultSet
-     * @return 主键是否为identity
-     * @throws SQLException ignore
-     */
-    boolean isKeyIdentity(ResultSet results) throws SQLException;
-
-
-    /**
-     * 自定义字段名称
-     */
-    String[] fieldCustom();
-}

+ 0 - 54
mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/config/IFileCreate.java

@@ -1,54 +0,0 @@
-/*
- * Copyright (c) 2011-2020, baomidou (jobob@qq.com).
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.baomidou.mybatisplus.generator.config;
-
-
-import com.baomidou.mybatisplus.generator.config.builder.ConfigBuilder;
-import com.baomidou.mybatisplus.generator.config.rules.FileType;
-
-import java.io.File;
-
-/**
- * 文件覆盖接口
- *
- * @author hubin
- * @since 2018-08-07
- */
-public interface IFileCreate {
-
-    /**
-     * 自定义判断是否创建文件
-     *
-     * @param configBuilder 配置构建器
-     * @param fileType      文件类型
-     * @param filePath      文件路径
-     * @return ignore
-     */
-    boolean isCreate(ConfigBuilder configBuilder, FileType fileType, String filePath);
-
-    /**
-     * 检查文件目录,不存在自动递归创建
-     *
-     * @param filePath 文件路径
-     */
-    default void checkDir(String filePath) {
-        File file = new File(filePath);
-        boolean exist = file.exists();
-        if (!exist) {
-            file.getParentFile().mkdir();
-        }
-    }
-}

+ 0 - 60
mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/config/IKeyWordsHandler.java

@@ -1,60 +0,0 @@
-/*
- * Copyright (c) 2011-2020, baomidou (jobob@qq.com).
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.baomidou.mybatisplus.generator.config;
-
-import java.util.List;
-
-/**
- * 关键字处理接口
- *
- * @author nieqiurong 2020/5/7.
- * @since 3.3.2
- */
-public interface IKeyWordsHandler {
-    
-    /**
-     * 获取关键字
-     *
-     * @return 关键字集合
-     */
-    List<String> getKeyWords();
-    
-    /**
-     * 格式化关键字格式
-     *
-     * @return 格式
-     */
-    String formatStyle();
-    
-    /**
-     * 是否为关键字
-     *
-     * @param columnName 字段名称
-     * @return 是否为关键字
-     */
-    boolean isKeyWords(String columnName);
-    
-    /**
-     * 格式化字段
-     *
-     * @param columnName 字段名称
-     * @return 格式化字段
-     */
-    default String formatColumn(String columnName) {
-        return String.format(formatStyle(), columnName);
-    }
-    
-}

+ 0 - 44
mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/config/INameConvert.java

@@ -1,44 +0,0 @@
-/*
- * Copyright (c) 2011-2020, baomidou (jobob@qq.com).
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.baomidou.mybatisplus.generator.config;
-
-import com.baomidou.mybatisplus.generator.config.po.TableField;
-import com.baomidou.mybatisplus.generator.config.po.TableInfo;
-
-/**
- * 名称转换接口类
- *
- * @author hubin
- * @since 2017-01-20
- */
-public interface INameConvert {
-
-    /**
-     * 执行实体名称转换
-     *
-     * @param tableInfo 表信息对象
-     * @return
-     */
-    String entityNameConvert(TableInfo tableInfo);
-
-    /**
-     * 执行属性名称转换
-     *
-     * @param field 表字段对象,如果属性表字段命名不一致注意 convert 属性的设置
-     * @return
-     */
-    String propertyNameConvert(TableField field);
-}

+ 0 - 50
mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/config/ITypeConvert.java

@@ -1,50 +0,0 @@
-/*
- * Copyright (c) 2011-2020, baomidou (jobob@qq.com).
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.baomidou.mybatisplus.generator.config;
-
-import com.baomidou.mybatisplus.generator.config.po.TableField;
-import com.baomidou.mybatisplus.generator.config.rules.IColumnType;
-
-/**
- * 数据库字段类型转换
- *
- * @author hubin
- * @author hanchunlin
- * @since 2017-01-20
- */
-public interface ITypeConvert {
-
-    /**
-     * 执行类型转换
-     *
-     * @param globalConfig 全局配置
-     * @param tableField   字段列信息
-     * @return ignore
-     */
-    default IColumnType processTypeConvert(GlobalConfig globalConfig, TableField tableField) {
-        return processTypeConvert(globalConfig, tableField.getType());
-    }
-
-    /**
-     * 执行类型转换
-     *
-     * @param globalConfig 全局配置
-     * @param fieldType    字段类型
-     * @return ignore
-     */
-    IColumnType processTypeConvert(GlobalConfig globalConfig, String fieldType);
-
-}

+ 0 - 83
mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/config/PackageConfig.java

@@ -1,83 +0,0 @@
-/*
- * Copyright (c) 2011-2020, baomidou (jobob@qq.com).
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.baomidou.mybatisplus.generator.config;
-
-
-import com.baomidou.mybatisplus.core.toolkit.StringPool;
-import com.baomidou.mybatisplus.core.toolkit.StringUtils;
-import lombok.Data;
-import lombok.experimental.Accessors;
-
-import java.util.Map;
-
-/**
- * 跟包相关的配置项
- *
- * @author YangHu, tangguo, hubin
- * @since 2016-08-30
- */
-
-@Data
-@Accessors(chain = true)
-public class PackageConfig {
-
-    /**
-     * 父包名。如果为空,将下面子包名必须写全部, 否则就只需写子包名
-     */
-    private String parent = "com.baomidou";
-    /**
-     * 父包模块名
-     */
-    private String moduleName = "";
-    /**
-     * Entity包名
-     */
-    private String entity = "entity";
-    /**
-     * Service包名
-     */
-    private String service = "service";
-    /**
-     * Service Impl包名
-     */
-    private String serviceImpl = "service.impl";
-    /**
-     * Mapper包名
-     */
-    private String mapper = "mapper";
-    /**
-     * Mapper XML包名
-     */
-    private String xml = "mapper.xml";
-    /**
-     * Controller包名
-     */
-    private String controller = "controller";
-    /**
-     * 路径配置信息
-     */
-    private Map<String, String> pathInfo;
-
-    /**
-     * 父包名
-     */
-    public String getParent() {
-        if (StringUtils.isNotBlank(moduleName)) {
-            return parent + StringPool.DOT + moduleName;
-        }
-        return parent;
-    }
-}

+ 0 - 400
mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/config/StrategyConfig.java

@@ -1,400 +0,0 @@
-/*
- * Copyright (c) 2011-2020, baomidou (jobob@qq.com).
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.baomidou.mybatisplus.generator.config;
-
-import com.baomidou.mybatisplus.annotation.TableField;
-import com.baomidou.mybatisplus.annotation.TableId;
-import com.baomidou.mybatisplus.core.metadata.TableInfoHelper;
-import com.baomidou.mybatisplus.core.toolkit.ClassUtils;
-import com.baomidou.mybatisplus.core.toolkit.StringUtils;
-import com.baomidou.mybatisplus.generator.config.po.LikeTable;
-import com.baomidou.mybatisplus.generator.config.po.TableFill;
-import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy;
-import lombok.AccessLevel;
-import lombok.Data;
-import lombok.Setter;
-import lombok.experimental.Accessors;
-
-import java.lang.reflect.Field;
-import java.util.*;
-import java.util.stream.Collectors;
-
-/**
- * 策略配置项
- *
- * @author YangHu, tangguo, hubin
- * @since 2016/8/30
- */
-@Data
-@Accessors(chain = true)
-public class StrategyConfig {
-    /**
-     * 是否大写命名
-     */
-    private boolean isCapitalMode = false;
-    /**
-     * 是否跳过视图
-     */
-    private boolean skipView = false;
-    /**
-     * 名称转换
-     */
-    private INameConvert nameConvert;
-    /**
-     * 数据库表映射到实体的命名策略
-     */
-    private NamingStrategy naming = NamingStrategy.no_change;
-    /**
-     * 数据库表字段映射到实体的命名策略
-     * <p>未指定按照 naming 执行</p>
-     */
-    private NamingStrategy columnNaming = null;
-    /**
-     * 表前缀
-     */
-    @Setter(AccessLevel.NONE)
-    private final Set<String> tablePrefix = new HashSet<>();
-    /**
-     * 字段前缀
-     */
-    @Setter(AccessLevel.NONE)
-    private final Set<String> fieldPrefix = new HashSet<>();
-    /**
-     * 自定义继承的Entity类全称,带包名
-     */
-    @Setter(AccessLevel.NONE)
-    private String superEntityClass;
-    /**
-     * 自定义基础的Entity类,公共字段
-     */
-    @Setter(AccessLevel.NONE)
-    private final Set<String> superEntityColumns = new HashSet<>();
-    /**
-     * 自定义继承的Mapper类全称,带包名
-     */
-    private String superMapperClass = ConstVal.SUPER_MAPPER_CLASS;
-    /**
-     * 自定义继承的Service类全称,带包名
-     */
-    private String superServiceClass = ConstVal.SUPER_SERVICE_CLASS;
-    /**
-     * 自定义继承的ServiceImpl类全称,带包名
-     */
-    private String superServiceImplClass = ConstVal.SUPER_SERVICE_IMPL_CLASS;
-    /**
-     * 自定义继承的Controller类全称,带包名
-     */
-    private String superControllerClass;
-    /**
-     * 需要包含的表名,允许正则表达式(与exclude二选一配置)<br/>
-     * 当{@link #enableSqlFilter}为true时,正则表达式无效.
-     */
-    @Setter(AccessLevel.NONE)
-    private final Set<String> include = new HashSet<>();
-    /**
-     * 需要排除的表名,允许正则表达式<br/>
-     * 当{@link #enableSqlFilter}为true时,正则表达式无效.
-     */
-    @Setter(AccessLevel.NONE)
-    private final Set<String> exclude = new HashSet<>();
-    /**
-     * 实体是否生成 serialVersionUID
-     */
-    private boolean entitySerialVersionUID = true;
-    /**
-     * 【实体】是否生成字段常量(默认 false)<br>
-     * -----------------------------------<br>
-     * public static final String ID = "test_id";
-     */
-    private boolean entityColumnConstant = false;
-    /**
-     * 【实体】是否为构建者模型(默认 false)<br>
-     * -----------------------------------<br>
-     * public User setName(String name) { this.name = name; return this; }
-     *
-     * @deprecated 3.3.2 {@link #chainModel}
-     */
-    @Deprecated
-    private boolean entityBuilderModel = false;
-
-    /**
-     * 【实体】是否为链式模型(默认 false)<br>
-     * -----------------------------------<br>
-     * public User setName(String name) { this.name = name; return this; }
-     *
-     * @since 3.3.2
-     */
-    private boolean chainModel = false;
-
-    /**
-     * 【实体】是否为lombok模型(默认 false)<br>
-     * <a href="https://projectlombok.org/">document</a>
-     */
-    private boolean entityLombokModel = false;
-    /**
-     * Boolean类型字段是否移除is前缀(默认 false)<br>
-     * 比如 : 数据库字段名称 : 'is_xxx',类型为 : tinyint. 在映射实体的时候则会去掉is,在实体类中映射最终结果为 xxx
-     */
-    private boolean entityBooleanColumnRemoveIsPrefix = false;
-    /**
-     * 生成 <code>@RestController</code> 控制器
-     * <pre>
-     *      <code>@Controller</code> -> <code>@RestController</code>
-     * </pre>
-     */
-    private boolean restControllerStyle = false;
-    /**
-     * 驼峰转连字符
-     * <pre>
-     *      <code>@RequestMapping("/managerUserActionHistory")</code> -> <code>@RequestMapping("/manager-user-action-history")</code>
-     * </pre>
-     */
-    private boolean controllerMappingHyphenStyle = false;
-    /**
-     * 是否生成实体时,生成字段注解
-     */
-    private boolean entityTableFieldAnnotationEnable = false;
-    /**
-     * 乐观锁属性名称
-     */
-    private String versionFieldName;
-    /**
-     * 逻辑删除属性名称
-     */
-    private String logicDeleteFieldName;
-    /**
-     * 表填充字段
-     */
-    private List<TableFill> tableFillList = null;
-    /**
-     * 启用sql过滤,语法不能支持使用sql过滤表的话,可以考虑关闭此开关.
-     *
-     * @since 3.3.1
-     */
-    private boolean enableSqlFilter = true;
-    /**
-     * 包含表名
-     *
-     * @since 3.3.0
-     */
-    private LikeTable likeTable;
-    /**
-     * 不包含表名
-     *
-     * @since 3.3.0
-     */
-    private LikeTable notLikeTable;
-
-    /**
-     * 大写命名、字段符合大写字母数字下划线命名
-     *
-     * @param word 待判断字符串
-     */
-    public boolean isCapitalModeNaming(String word) {
-        return isCapitalMode && StringUtils.isCapitalMode(word);
-    }
-
-    /**
-     * 表名称包含指定前缀
-     *
-     * @param tableName 表名称
-     * @deprecated 3.3.2 {@link #startsWithTablePrefix(String)}
-     */
-    @Deprecated
-    public boolean containsTablePrefix(String tableName) {
-        return getTablePrefix().stream().anyMatch(tableName::contains);
-    }
-
-    /**
-     * 表名称匹配表前缀
-     *
-     * @param tableName 表名称
-     * @since 3.3.2
-     */
-    public boolean startsWithTablePrefix(String tableName) {
-        return getTablePrefix().stream().anyMatch(tableName::startsWith);
-    }
-
-    public NamingStrategy getColumnNaming() {
-        // 未指定以 naming 策略为准
-        return Optional.ofNullable(columnNaming).orElse(naming);
-    }
-
-    public StrategyConfig setTablePrefix(String... tablePrefix) {
-        this.tablePrefix.addAll(Arrays.asList(tablePrefix));
-        return this;
-    }
-
-    public boolean includeSuperEntityColumns(String fieldName) {
-        // 公共字段判断忽略大小写【 部分数据库大小写不敏感 】
-        return superEntityColumns.stream().anyMatch(e -> e.equalsIgnoreCase(fieldName));
-    }
-
-    public StrategyConfig setSuperEntityColumns(String... superEntityColumns) {
-        this.superEntityColumns.addAll(Arrays.asList(superEntityColumns));
-        return this;
-    }
-
-    public StrategyConfig setInclude(String... include) {
-        this.include.addAll(Arrays.asList(include));
-        return this;
-    }
-
-    public StrategyConfig setExclude(String... exclude) {
-        this.exclude.addAll(Arrays.asList(exclude));
-        return this;
-    }
-
-    public StrategyConfig setFieldPrefix(String... fieldPrefixs) {
-        this.fieldPrefix.addAll(Arrays.asList(fieldPrefixs));
-        return this;
-    }
-
-    /**
-     * 设置实体父类
-     *
-     * @param superEntityClass 类全名称
-     * @return this
-     */
-    public StrategyConfig setSuperEntityClass(String superEntityClass) {
-        this.superEntityClass = superEntityClass;
-        return this;
-    }
-
-
-    /**
-     * <p>
-     * 设置实体父类,该设置自动识别公共字段<br/>
-     * 属性 superEntityColumns 改配置无需再次配置
-     * </p>
-     * <p>
-     * 注意!!字段策略要在设置实体父类之前有效
-     * </p>
-     *
-     * @param clazz 实体父类 Class
-     * @return
-     */
-    public StrategyConfig setSuperEntityClass(Class<?> clazz) {
-        this.superEntityClass = clazz.getName();
-        return this;
-    }
-
-    /**
-     * <p>
-     * 设置实体父类,该设置自动识别公共字段<br/>
-     * 属性 superEntityColumns 改配置无需再次配置
-     * </p>
-     *
-     * @param clazz        实体父类 Class
-     * @param columnNaming 字段命名策略
-     * @return
-     */
-    public StrategyConfig setSuperEntityClass(Class<?> clazz, NamingStrategy columnNaming) {
-        this.columnNaming = columnNaming;
-        this.superEntityClass = clazz.getName();
-        return this;
-    }
-
-    public StrategyConfig setSuperServiceClass(Class<?> clazz) {
-        this.superServiceClass = clazz.getName();
-        return this;
-    }
-
-    public StrategyConfig setSuperServiceClass(String superServiceClass) {
-        this.superServiceClass = superServiceClass;
-        return this;
-    }
-
-    public StrategyConfig setSuperServiceImplClass(Class<?> clazz) {
-        this.superServiceImplClass = clazz.getName();
-        return this;
-    }
-
-    public StrategyConfig setSuperServiceImplClass(String superServiceImplClass) {
-        this.superServiceImplClass = superServiceImplClass;
-        return this;
-    }
-
-    public StrategyConfig setSuperControllerClass(Class<?> clazz) {
-        this.superControllerClass = clazz.getName();
-        return this;
-    }
-
-    public StrategyConfig setSuperControllerClass(String superControllerClass) {
-        this.superControllerClass = superControllerClass;
-        return this;
-    }
-
-    /**
-     * <p>
-     * 父类 Class 反射属性转换为公共字段
-     * </p>
-     *
-     * @param clazz 实体父类 Class
-     */
-    protected void convertSuperEntityColumns(Class<?> clazz) {
-        List<Field> fields = TableInfoHelper.getAllFields(clazz);
-        this.superEntityColumns.addAll(fields.stream().map(field -> {
-            TableId tableId = field.getAnnotation(TableId.class);
-            if (tableId != null && StringUtils.isNotBlank(tableId.value())) {
-                return tableId.value();
-            }
-            TableField tableField = field.getAnnotation(TableField.class);
-            if (tableField != null && StringUtils.isNotBlank(tableField.value())) {
-                return tableField.value();
-            }
-            if (null == columnNaming || columnNaming == NamingStrategy.no_change) {
-                return field.getName();
-            }
-            return StringUtils.camelToUnderline(field.getName());
-        }).collect(Collectors.toSet()));
-    }
-
-    /**
-     * 是否为构建者模型
-     *
-     * @return 是否为构建者模型
-     * @deprecated 3.3.2 {@link #isChainModel()}
-     */
-    @Deprecated
-    public boolean isEntityBuilderModel() {
-        return isChainModel();
-    }
-
-    /**
-     * 设置是否为构建者模型
-     *
-     * @param entityBuilderModel 是否为构建者模型
-     * @return this
-     * @deprecated 3.3.2 {@link #setChainModel(boolean)}
-     */
-    @Deprecated
-    public StrategyConfig setEntityBuilderModel(boolean entityBuilderModel) {
-        return setChainModel(entityBuilderModel);
-    }
-
-    public Set<String> getSuperEntityColumns() {
-        if (StringUtils.isNotBlank(this.superEntityClass)) {
-            try {
-                Class<?> superEntity = ClassUtils.toClassConfident(this.superEntityClass);
-                convertSuperEntityColumns(superEntity);
-            } catch (Exception e) {
-                //当父类实体存在类加载器的时候,识别父类实体字段,不存在的情况就只有通过指定superEntityColumns属性了。
-            }
-        }
-        return this.superEntityColumns;
-    }
-}

+ 0 - 84
mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/config/TemplateConfig.java

@@ -1,84 +0,0 @@
-/*
- * Copyright (c) 2011-2020, baomidou (jobob@qq.com).
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.baomidou.mybatisplus.generator.config;
-
-import lombok.AccessLevel;
-import lombok.Data;
-import lombok.Getter;
-import lombok.experimental.Accessors;
-
-/**
- * 模板路径配置项
- *
- * @author tzg hubin
- * @since 2017-06-17
- */
-@Data
-@Accessors(chain = true)
-public class TemplateConfig {
-
-    @Getter(AccessLevel.NONE)
-    private String entity = ConstVal.TEMPLATE_ENTITY_JAVA;
-
-    private String entityKt = ConstVal.TEMPLATE_ENTITY_KT;
-
-    private String service = ConstVal.TEMPLATE_SERVICE;
-
-    private String serviceImpl = ConstVal.TEMPLATE_SERVICE_IMPL;
-
-    private String mapper = ConstVal.TEMPLATE_MAPPER;
-
-    private String xml = ConstVal.TEMPLATE_XML;
-
-    private String controller = ConstVal.TEMPLATE_CONTROLLER;
-
-    public String getEntity(boolean kotlin) {
-        return kotlin ? entityKt : entity;
-    }
-    
-    /**
-     * 禁用模板
-     *
-     * @param templateTypes 模板类型
-     * @return this
-     * @since 3.3.2
-     */
-    public TemplateConfig disable(TemplateType... templateTypes) {
-        if (templateTypes != null && templateTypes.length > 0) {
-            for (TemplateType templateType : templateTypes) {
-                switch (templateType) {
-                    case XML:
-                        setXml(null);
-                        break;
-                    case ENTITY:
-                        setEntity(null).setEntityKt(null);
-                        break;
-                    case MAPPER:
-                        setMapper(null);
-                        break;
-                    case SERVICE:
-                        setService(null).setServiceImpl(null);
-                        break;
-                    case CONTROLLER:
-                        setController(null);
-                        break;
-                }
-            }
-        }
-        return this;
-    }
-    
-}

+ 0 - 28
mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/config/TemplateType.java

@@ -1,28 +0,0 @@
-/*
- * Copyright (c) 2011-2020, baomidou (jobob@qq.com).
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.baomidou.mybatisplus.generator.config;
-
-/**
- * 模板类型
- *
- * @author nieqiurong 2020/4/28.
- * @since 3.3.2
- */
-public enum TemplateType {
-    
-    ENTITY, SERVICE, CONTROLLER, MAPPER, XML
-    
-}

+ 0 - 687
mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/config/builder/ConfigBuilder.java

@@ -1,687 +0,0 @@
-/*
- * Copyright (c) 2011-2020, baomidou (jobob@qq.com).
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.baomidou.mybatisplus.generator.config.builder;
-
-import com.baomidou.mybatisplus.annotation.DbType;
-import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
-import com.baomidou.mybatisplus.core.toolkit.StringPool;
-import com.baomidou.mybatisplus.core.toolkit.StringUtils;
-import com.baomidou.mybatisplus.generator.InjectionConfig;
-import com.baomidou.mybatisplus.generator.config.*;
-import com.baomidou.mybatisplus.generator.config.po.TableField;
-import com.baomidou.mybatisplus.generator.config.po.TableFill;
-import com.baomidou.mybatisplus.generator.config.po.TableInfo;
-import com.baomidou.mybatisplus.generator.config.querys.H2Query;
-import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy;
-
-import java.io.File;
-import java.sql.Connection;
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.util.*;
-import java.util.regex.Pattern;
-import java.util.stream.Collectors;
-
-/**
- * 配置汇总 传递给文件生成工具
- *
- * @author YangHu, tangguo, hubin, Juzi
- * @since 2016-08-30
- */
-public class ConfigBuilder {
-
-    /**
-     * 模板路径配置信息
-     */
-    private final TemplateConfig template;
-    /**
-     * 数据库配置
-     */
-    private final DataSourceConfig dataSourceConfig;
-    /**
-     * SQL连接
-     */
-    private final Connection connection;
-    /**
-     * 数据库表信息
-     */
-    private List<TableInfo> tableInfoList;
-    /**
-     * 包配置详情
-     */
-    private Map<String, String> packageInfo;
-    /**
-     * 路径配置信息
-     */
-    private Map<String, String> pathInfo;
-    /**
-     * 策略配置
-     */
-    private StrategyConfig strategyConfig;
-    /**
-     * 全局配置信息
-     */
-    private GlobalConfig globalConfig;
-    /**
-     * 注入配置信息
-     */
-    private InjectionConfig injectionConfig;
-    /**
-     * 过滤正则
-     */
-    private static final Pattern REGX = Pattern.compile("[~!/@#$%^&*()+\\\\\\[\\]|{};:'\",<.>?]+");
-
-    /**
-     * 在构造器中处理配置
-     *
-     * @param packageConfig    包配置
-     * @param dataSourceConfig 数据源配置
-     * @param strategyConfig   表配置
-     * @param template         模板配置
-     * @param globalConfig     全局配置
-     */
-    public ConfigBuilder(PackageConfig packageConfig, DataSourceConfig dataSourceConfig, StrategyConfig strategyConfig,
-                         TemplateConfig template, GlobalConfig globalConfig) {
-        // 全局配置
-        this.globalConfig = Optional.ofNullable(globalConfig).orElseGet(GlobalConfig::new);
-        // 模板配置
-        this.template = Optional.ofNullable(template).orElseGet(TemplateConfig::new);
-        // 包配置
-        if (null == packageConfig) {
-            handlerPackage(this.template, this.globalConfig.getOutputDir(), new PackageConfig());
-        } else {
-            handlerPackage(this.template, this.globalConfig.getOutputDir(), packageConfig);
-        }
-        this.dataSourceConfig = dataSourceConfig;
-        this.connection = dataSourceConfig.getConn();
-        // 策略配置
-        this.strategyConfig = Optional.ofNullable(strategyConfig).orElseGet(StrategyConfig::new);
-        this.tableInfoList = getTablesInfo(this.strategyConfig);
-    }
-
-    // ************************ 曝露方法 BEGIN*****************************
-
-    /**
-     * 所有包配置信息
-     *
-     * @return 包配置
-     */
-    public Map<String, String> getPackageInfo() {
-        return packageInfo;
-    }
-
-
-    /**
-     * 所有路径配置
-     *
-     * @return 路径配置
-     */
-    public Map<String, String> getPathInfo() {
-        return pathInfo;
-    }
-
-    /**
-     * 表信息
-     *
-     * @return 所有表信息
-     */
-    public List<TableInfo> getTableInfoList() {
-        return tableInfoList;
-    }
-
-    public ConfigBuilder setTableInfoList(List<TableInfo> tableInfoList) {
-        this.tableInfoList = tableInfoList;
-        return this;
-    }
-
-    /**
-     * 模板路径配置信息
-     *
-     * @return 所以模板路径配置信息
-     */
-    public TemplateConfig getTemplate() {
-        return this.template;
-    }
-
-    // ****************************** 曝露方法 END**********************************
-
-    /**
-     * 处理包配置
-     *
-     * @param template  TemplateConfig
-     * @param outputDir
-     * @param config    PackageConfig
-     */
-    private void handlerPackage(TemplateConfig template, String outputDir, PackageConfig config) {
-        // 包信息
-        packageInfo = CollectionUtils.newHashMapWithExpectedSize(7);
-        packageInfo.put(ConstVal.MODULE_NAME, config.getModuleName());
-        packageInfo.put(ConstVal.ENTITY, joinPackage(config.getParent(), config.getEntity()));
-        packageInfo.put(ConstVal.MAPPER, joinPackage(config.getParent(), config.getMapper()));
-        packageInfo.put(ConstVal.XML, joinPackage(config.getParent(), config.getXml()));
-        packageInfo.put(ConstVal.SERVICE, joinPackage(config.getParent(), config.getService()));
-        packageInfo.put(ConstVal.SERVICE_IMPL, joinPackage(config.getParent(), config.getServiceImpl()));
-        packageInfo.put(ConstVal.CONTROLLER, joinPackage(config.getParent(), config.getController()));
-
-        // 自定义路径
-        Map<String, String> configPathInfo = config.getPathInfo();
-        if (null != configPathInfo) {
-            pathInfo = configPathInfo;
-        } else {
-            // 生成路径信息
-            pathInfo = CollectionUtils.newHashMapWithExpectedSize(6);
-            setPathInfo(pathInfo, template.getEntity(getGlobalConfig().isKotlin()), outputDir, ConstVal.ENTITY_PATH, ConstVal.ENTITY);
-            setPathInfo(pathInfo, template.getMapper(), outputDir, ConstVal.MAPPER_PATH, ConstVal.MAPPER);
-            setPathInfo(pathInfo, template.getXml(), outputDir, ConstVal.XML_PATH, ConstVal.XML);
-            setPathInfo(pathInfo, template.getService(), outputDir, ConstVal.SERVICE_PATH, ConstVal.SERVICE);
-            setPathInfo(pathInfo, template.getServiceImpl(), outputDir, ConstVal.SERVICE_IMPL_PATH, ConstVal.SERVICE_IMPL);
-            setPathInfo(pathInfo, template.getController(), outputDir, ConstVal.CONTROLLER_PATH, ConstVal.CONTROLLER);
-        }
-    }
-
-    private void setPathInfo(Map<String, String> pathInfo, String template, String outputDir, String path, String module) {
-        if (StringUtils.isNotBlank(template)) {
-            pathInfo.put(path, joinPath(outputDir, packageInfo.get(module)));
-        }
-    }
-
-    /**
-     * 处理表对应的类名称
-     *
-     * @param tableList 表名称
-     * @param config    策略配置项
-     * @return 补充完整信息后的表
-     */
-    private List<TableInfo> processTable(List<TableInfo> tableList, StrategyConfig config) {
-        for (TableInfo tableInfo : tableList) {
-            String entityName;
-            INameConvert nameConvert = strategyConfig.getNameConvert();
-            if (null != nameConvert) {
-                // 自定义处理实体名称
-                entityName = nameConvert.entityNameConvert(tableInfo);
-            } else {
-                entityName = NamingStrategy.capitalFirst(processName(tableInfo.getName(), config.getNaming(), config.getTablePrefix()));
-            }
-            if (StringUtils.isNotBlank(globalConfig.getEntityName())) {
-                tableInfo.setConvert(true);
-                tableInfo.setEntityName(String.format(globalConfig.getEntityName(), entityName));
-            } else {
-                tableInfo.setEntityName(strategyConfig, entityName);
-            }
-            if (StringUtils.isNotBlank(globalConfig.getMapperName())) {
-                tableInfo.setMapperName(String.format(globalConfig.getMapperName(), entityName));
-            } else {
-                tableInfo.setMapperName(entityName + ConstVal.MAPPER);
-            }
-            if (StringUtils.isNotBlank(globalConfig.getXmlName())) {
-                tableInfo.setXmlName(String.format(globalConfig.getXmlName(), entityName));
-            } else {
-                tableInfo.setXmlName(entityName + ConstVal.MAPPER);
-            }
-            if (StringUtils.isNotBlank(globalConfig.getServiceName())) {
-                tableInfo.setServiceName(String.format(globalConfig.getServiceName(), entityName));
-            } else {
-                tableInfo.setServiceName("I" + entityName + ConstVal.SERVICE);
-            }
-            if (StringUtils.isNotBlank(globalConfig.getServiceImplName())) {
-                tableInfo.setServiceImplName(String.format(globalConfig.getServiceImplName(), entityName));
-            } else {
-                tableInfo.setServiceImplName(entityName + ConstVal.SERVICE_IMPL);
-            }
-            if (StringUtils.isNotBlank(globalConfig.getControllerName())) {
-                tableInfo.setControllerName(String.format(globalConfig.getControllerName(), entityName));
-            } else {
-                tableInfo.setControllerName(entityName + ConstVal.CONTROLLER);
-            }
-            // 检测导入包
-            checkImportPackages(tableInfo);
-        }
-        return tableList;
-    }
-
-    /**
-     * 检测导入包
-     *
-     * @param tableInfo ignore
-     */
-    private void checkImportPackages(TableInfo tableInfo) {
-        if (StringUtils.isNotBlank(strategyConfig.getSuperEntityClass())) {
-            // 自定义父类
-            tableInfo.getImportPackages().add(strategyConfig.getSuperEntityClass());
-        } else if (globalConfig.isActiveRecord()) {
-            // 无父类开启 AR 模式
-            tableInfo.getImportPackages().add(com.baomidou.mybatisplus.extension.activerecord.Model.class.getCanonicalName());
-        }
-        if (null != globalConfig.getIdType() && tableInfo.isHavePrimaryKey()) {
-            // 指定需要 IdType 场景
-            tableInfo.getImportPackages().add(com.baomidou.mybatisplus.annotation.IdType.class.getCanonicalName());
-            tableInfo.getImportPackages().add(com.baomidou.mybatisplus.annotation.TableId.class.getCanonicalName());
-        }
-        if (StringUtils.isNotBlank(strategyConfig.getVersionFieldName())
-            && CollectionUtils.isNotEmpty(tableInfo.getFields())) {
-            tableInfo.getFields().forEach(f -> {
-                if (strategyConfig.getVersionFieldName().equals(f.getName())) {
-                    tableInfo.getImportPackages().add(com.baomidou.mybatisplus.annotation.Version.class.getCanonicalName());
-                }
-            });
-        }
-    }
-
-
-    /**
-     * 获取所有的数据库表信息
-     */
-    private List<TableInfo> getTablesInfo(StrategyConfig config) {
-        boolean isInclude = config.getInclude().size() > 0;
-        boolean isExclude = config.getExclude().size() > 0;
-        if (isInclude && isExclude) {
-            throw new RuntimeException("<strategy> 标签中 <include> 与 <exclude> 只能配置一项!");
-        }
-        if (config.getNotLikeTable() != null && config.getLikeTable() != null) {
-            throw new RuntimeException("<strategy> 标签中 <likeTable> 与 <notLikeTable> 只能配置一项!");
-        }
-        //所有的表信息
-        List<TableInfo> tableList = new ArrayList<>();
-
-        //需要反向生成或排除的表信息
-        List<TableInfo> includeTableList = new ArrayList<>();
-        List<TableInfo> excludeTableList = new ArrayList<>();
-
-        //不存在的表名
-        Set<String> notExistTables = new HashSet<>();
-        DbType dbType = this.dataSourceConfig.getDbType();
-        IDbQuery dbQuery = this.dataSourceConfig.getDbQuery();
-        try {
-            String tablesSql = dataSourceConfig.getDbQuery().tablesSql();
-            if (DbType.POSTGRE_SQL == dbType) {
-                String schema = dataSourceConfig.getSchemaName();
-                if (schema == null) {
-                    //pg 默认 schema=public
-                    schema = "public";
-                    dataSourceConfig.setSchemaName(schema);
-                }
-                //TODO 还原代码后解决PgSchema的问题.
-                this.connection.setSchema(schema);
-                tablesSql = String.format(tablesSql, schema);
-            } else if (DbType.KINGBASE_ES == dbType) {
-                String schema = dataSourceConfig.getSchemaName();
-                if (schema == null) {
-                    //kingbase 默认 schema=PUBLIC
-                    schema = "PUBLIC";
-                    dataSourceConfig.setSchemaName(schema);
-                }
-                tablesSql = String.format(tablesSql, schema);
-            } else if (DbType.DB2 == dbType) {
-                String schema = dataSourceConfig.getSchemaName();
-                if (schema == null) {
-                    //db2 默认 schema=current schema
-                    schema = "current schema";
-                    dataSourceConfig.setSchemaName(schema);
-                }
-                tablesSql = String.format(tablesSql, schema);
-            }
-            //oracle数据库表太多,出现最大游标错误
-            else if (DbType.ORACLE == dbType) {
-                String schema = dataSourceConfig.getSchemaName();
-                //oracle 默认 schema=username
-                if (schema == null) {
-                    schema = dataSourceConfig.getUsername().toUpperCase();
-                    dataSourceConfig.setSchemaName(schema);
-                }
-                tablesSql = String.format(tablesSql, schema);
-            }
-            StringBuilder sql = new StringBuilder(tablesSql);
-            if (config.isEnableSqlFilter()) {
-                if (config.getLikeTable() != null) {
-                    sql.append(" AND ").append(dbQuery.tableName()).append(" LIKE '").append(config.getLikeTable().getValue()).append("'");
-                } else if (config.getNotLikeTable() != null) {
-                    sql.append(" AND ").append(dbQuery.tableName()).append(" NOT LIKE '").append(config.getNotLikeTable().getValue()).append("'");
-                }
-                if (isInclude) {
-                    sql.append(" AND ").append(dbQuery.tableName()).append(" IN (")
-                        .append(config.getInclude().stream().map(tb -> "'" + tb + "'").collect(Collectors.joining(","))).append(")");
-                } else if (isExclude) {
-                    sql.append(" AND ").append(dbQuery.tableName()).append(" NOT IN (")
-                        .append(config.getExclude().stream().map(tb -> "'" + tb + "'").collect(Collectors.joining(","))).append(")");
-                }
-            }
-            TableInfo tableInfo;
-            try (PreparedStatement preparedStatement = connection.prepareStatement(sql.toString());
-                 ResultSet results = preparedStatement.executeQuery()) {
-                while (results.next()) {
-                    final String tableName = results.getString(dbQuery.tableName());
-                    if (StringUtils.isBlank(tableName)) {
-                        System.err.println("当前数据库为空!!!");
-                        continue;
-                    }
-                    tableInfo = new TableInfo();
-                    tableInfo.setName(tableName);
-                    String commentColumn = dbQuery.tableComment();
-                    if (StringUtils.isNotBlank(commentColumn)) {
-                        String tableComment = results.getString(commentColumn);
-                        if (config.isSkipView() && "VIEW".equals(tableComment)) {
-                            // 跳过视图
-                            continue;
-                        }
-                        tableInfo.setComment(formatComment(tableComment));
-                    }
-
-                    if (isInclude) {
-                        for (String includeTable : config.getInclude()) {
-                            // 忽略大小写等于 或 正则 true
-                            if (tableNameMatches(includeTable, tableName)) {
-                                includeTableList.add(tableInfo);
-                            } else {
-                                //过滤正则表名
-                                if (!REGX.matcher(includeTable).find()) {
-                                    notExistTables.add(includeTable);
-                                }
-                            }
-                        }
-                    } else if (isExclude) {
-                        for (String excludeTable : config.getExclude()) {
-                            // 忽略大小写等于 或 正则 true
-                            if (tableNameMatches(excludeTable, tableName)) {
-                                excludeTableList.add(tableInfo);
-                            } else {
-                                //过滤正则表名
-                                if (!REGX.matcher(excludeTable).find()) {
-                                    notExistTables.add(excludeTable);
-                                }
-                            }
-                        }
-                    }
-                    tableList.add(tableInfo);
-                }
-            }
-            // 将已经存在的表移除,获取配置中数据库不存在的表
-            for (TableInfo tabInfo : tableList) {
-                notExistTables.remove(tabInfo.getName());
-            }
-            if (notExistTables.size() > 0) {
-                System.err.println("表 " + notExistTables + " 在数据库中不存在!!!");
-            }
-
-            // 需要反向生成的表信息
-            if (isExclude) {
-                tableList.removeAll(excludeTableList);
-                includeTableList = tableList;
-            }
-            if (!isInclude && !isExclude) {
-                includeTableList = tableList;
-            }
-            // 性能优化,只处理需执行表字段 github issues/219
-            includeTableList.forEach(ti -> convertTableFields(ti, config));
-        } catch (SQLException e) {
-            e.printStackTrace();
-        }
-        return processTable(includeTableList, config);
-    }
-
-
-    /**
-     * 表名匹配
-     *
-     * @param setTableName 设置表名
-     * @param dbTableName  数据库表单
-     * @return ignore
-     */
-    private boolean tableNameMatches(String setTableName, String dbTableName) {
-        return setTableName.equalsIgnoreCase(dbTableName)
-            || StringUtils.matches(setTableName, dbTableName);
-    }
-
-    /**
-     * 将字段信息与表信息关联
-     *
-     * @param tableInfo 表信息
-     * @param config    命名策略
-     * @return ignore
-     */
-    private TableInfo convertTableFields(TableInfo tableInfo, StrategyConfig config) {
-        boolean haveId = false;
-        List<TableField> fieldList = new ArrayList<>();
-        List<TableField> commonFieldList = new ArrayList<>();
-        DbType dbType = this.dataSourceConfig.getDbType();
-        IDbQuery dbQuery = dataSourceConfig.getDbQuery();
-        String tableName = tableInfo.getName();
-        try {
-            String tableFieldsSql = dbQuery.tableFieldsSql();
-            Set<String> h2PkColumns = new HashSet<>();
-            if (DbType.POSTGRE_SQL == dbType) {
-                tableFieldsSql = String.format(tableFieldsSql, tableName);
-            } else if (DbType.KINGBASE_ES == dbType) {
-                tableFieldsSql = String.format(tableFieldsSql, dataSourceConfig.getSchemaName(), tableName);
-            } else if (DbType.DB2 == dbType) {
-                tableFieldsSql = String.format(tableFieldsSql, dataSourceConfig.getSchemaName(), tableName);
-            } else if (DbType.ORACLE == dbType) {
-                tableName = tableName.toUpperCase();
-                tableFieldsSql = String.format(tableFieldsSql.replace("#schema", dataSourceConfig.getSchemaName()), tableName);
-            } else if (DbType.DM == dbType) {
-                tableName = tableName.toUpperCase();
-                tableFieldsSql = String.format(tableFieldsSql, tableName);
-            } else if (DbType.H2 == dbType) {
-                try (PreparedStatement pkQueryStmt = connection.prepareStatement(String.format(H2Query.PK_QUERY_SQL, tableName));
-                     ResultSet pkResults = pkQueryStmt.executeQuery()) {
-                    while (pkResults.next()) {
-                        String primaryKey = pkResults.getString(dbQuery.fieldKey());
-                        if (Boolean.parseBoolean(primaryKey)) {
-                            h2PkColumns.add(pkResults.getString(dbQuery.fieldName()));
-                        }
-                    }
-                }
-                tableFieldsSql = String.format(tableFieldsSql, tableName);
-            } else {
-                tableFieldsSql = String.format(tableFieldsSql, tableName);
-            }
-            try (
-                PreparedStatement preparedStatement = connection.prepareStatement(tableFieldsSql);
-                ResultSet results = preparedStatement.executeQuery()) {
-                while (results.next()) {
-                    TableField field = new TableField();
-                    String columnName = results.getString(dbQuery.fieldName());
-                    // 避免多重主键设置,目前只取第一个找到ID,并放到list中的索引为0的位置
-                    boolean isId;
-                    if (DbType.H2 == dbType) {
-                        isId = h2PkColumns.contains(columnName);
-                    } else {
-                        String key = results.getString(dbQuery.fieldKey());
-                        if (DbType.DB2 == dbType || DbType.SQLITE == dbType) {
-                            isId = StringUtils.isNotBlank(key) && "1".equals(key);
-                        } else {
-                            isId = StringUtils.isNotBlank(key) && "PRI".equals(key.toUpperCase());
-                        }
-                    }
-
-                    // 处理ID
-                    if (isId && !haveId) {
-                        haveId = true;
-                        field.setKeyFlag(true);
-                        tableInfo.setHavePrimaryKey(true);
-                        field.setKeyIdentityFlag(dbQuery.isKeyIdentity(results));
-                    } else {
-                        field.setKeyFlag(false);
-                    }
-                    // 自定义字段查询
-                    String[] fcs = dbQuery.fieldCustom();
-                    if (null != fcs) {
-                        Map<String, Object> customMap = CollectionUtils.newHashMapWithExpectedSize(fcs.length);
-                        for (String fc : fcs) {
-                            customMap.put(fc, results.getObject(fc));
-                        }
-                        field.setCustomMap(customMap);
-                    }
-                    // 处理其它信息
-                    field.setName(columnName);
-                    String newColumnName = columnName;
-                    IKeyWordsHandler keyWordsHandler = dataSourceConfig.getKeyWordsHandler();
-                    if (keyWordsHandler != null && keyWordsHandler.isKeyWords(columnName)) {
-                        System.err.printf("当前表[%s]存在字段[%s]为数据库关键字或保留字!%n", tableName, columnName);
-                        field.setKeyWords(true);
-                        newColumnName = keyWordsHandler.formatColumn(columnName);
-                    }
-                    field.setColumnName(newColumnName);
-                    field.setType(results.getString(dbQuery.fieldType()));
-                    INameConvert nameConvert = strategyConfig.getNameConvert();
-                    if (null != nameConvert) {
-                        field.setPropertyName(nameConvert.propertyNameConvert(field));
-                    } else {
-                        field.setPropertyName(strategyConfig, processName(field.getName(), config.getColumnNaming()));
-                    }
-                    field.setColumnType(dataSourceConfig.getTypeConvert().processTypeConvert(globalConfig, field));
-                    String fieldCommentColumn = dbQuery.fieldComment();
-                    if (StringUtils.isNotBlank(fieldCommentColumn)) {
-                        field.setComment(formatComment(results.getString(fieldCommentColumn)));
-                    }
-                    // 填充逻辑判断
-                    List<TableFill> tableFillList = getStrategyConfig().getTableFillList();
-                    if (null != tableFillList) {
-                        // 忽略大写字段问题
-                        tableFillList.stream().filter(tf -> tf.getFieldName().equalsIgnoreCase(field.getName()))
-                            .findFirst().ifPresent(tf -> field.setFill(tf.getFieldFill().name()));
-                    }
-                    if (strategyConfig.includeSuperEntityColumns(field.getName())) {
-                        // 跳过公共字段
-                        commonFieldList.add(field);
-                        continue;
-                    }
-                    fieldList.add(field);
-                }
-            }
-        } catch (SQLException e) {
-            System.err.println("SQL Exception:" + e.getMessage());
-        }
-        tableInfo.setFields(fieldList);
-        tableInfo.setCommonFields(commonFieldList);
-        return tableInfo;
-    }
-
-
-    /**
-     * 连接路径字符串
-     *
-     * @param parentDir   路径常量字符串
-     * @param packageName 包名
-     * @return 连接后的路径
-     */
-    private String joinPath(String parentDir, String packageName) {
-        if (StringUtils.isBlank(parentDir)) {
-            parentDir = System.getProperty(ConstVal.JAVA_TMPDIR);
-        }
-        if (!StringUtils.endsWith(parentDir, File.separator)) {
-            parentDir += File.separator;
-        }
-        packageName = packageName.replaceAll("\\.", StringPool.BACK_SLASH + File.separator);
-        return parentDir + packageName;
-    }
-
-
-    /**
-     * 连接父子包名
-     *
-     * @param parent     父包名
-     * @param subPackage 子包名
-     * @return 连接后的包名
-     */
-    private String joinPackage(String parent, String subPackage) {
-        return StringUtils.isBlank(parent) ? subPackage : (parent + StringPool.DOT + subPackage);
-    }
-
-
-    /**
-     * 处理字段名称
-     *
-     * @return 根据策略返回处理后的名称
-     */
-    private String processName(String name, NamingStrategy strategy) {
-        return processName(name, strategy, strategyConfig.getFieldPrefix());
-    }
-
-
-    /**
-     * 处理表/字段名称
-     *
-     * @param name     ignore
-     * @param strategy ignore
-     * @param prefix   ignore
-     * @return 根据策略返回处理后的名称
-     */
-    private String processName(String name, NamingStrategy strategy, Set<String> prefix) {
-        String propertyName;
-        if (prefix.size() > 0) {
-            if (strategy == NamingStrategy.underline_to_camel) {
-                // 删除前缀、下划线转驼峰
-                propertyName = NamingStrategy.removePrefixAndCamel(name, prefix);
-            } else {
-                // 删除前缀
-                propertyName = NamingStrategy.removePrefix(name, prefix);
-            }
-        } else if (strategy == NamingStrategy.underline_to_camel) {
-            // 下划线转驼峰
-            propertyName = NamingStrategy.underlineToCamel(name);
-        } else {
-            // 不处理
-            propertyName = name;
-        }
-        return propertyName;
-    }
-
-
-    public StrategyConfig getStrategyConfig() {
-        return strategyConfig;
-    }
-
-
-    public ConfigBuilder setStrategyConfig(StrategyConfig strategyConfig) {
-        this.strategyConfig = strategyConfig;
-        return this;
-    }
-
-
-    public GlobalConfig getGlobalConfig() {
-        return globalConfig;
-    }
-
-
-    public ConfigBuilder setGlobalConfig(GlobalConfig globalConfig) {
-        this.globalConfig = globalConfig;
-        return this;
-    }
-
-
-    public InjectionConfig getInjectionConfig() {
-        return injectionConfig;
-    }
-
-
-    public ConfigBuilder setInjectionConfig(InjectionConfig injectionConfig) {
-        this.injectionConfig = injectionConfig;
-        return this;
-    }
-
-    /**
-     * 格式化数据库注释内容
-     *
-     * @param comment 注释
-     * @return 注释
-     * @since 3.4.0
-     */
-    public String formatComment(String comment) {
-        return StringUtils.isBlank(comment) ? StringPool.EMPTY : comment.replaceAll("\r\n", "\t");
-    }
-
-}

+ 0 - 19
mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/config/builder/package-info.java

@@ -1,19 +0,0 @@
-/*
- * Copyright (c) 2011-2020, baomidou (jobob@qq.com).
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/**
- * 代码生成器,构建类
- */
-package com.baomidou.mybatisplus.generator.config.builder;

+ 0 - 56
mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/config/converts/DB2TypeConvert.java

@@ -1,56 +0,0 @@
-/*
- * Copyright (c) 2011-2020, baomidou (jobob@qq.com).
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.baomidou.mybatisplus.generator.config.converts;
-
-import com.baomidou.mybatisplus.generator.config.GlobalConfig;
-import com.baomidou.mybatisplus.generator.config.ITypeConvert;
-import com.baomidou.mybatisplus.generator.config.rules.IColumnType;
-
-import static com.baomidou.mybatisplus.generator.config.converts.TypeConverts.contains;
-import static com.baomidou.mybatisplus.generator.config.converts.TypeConverts.containsAny;
-import static com.baomidou.mybatisplus.generator.config.rules.DbColumnType.*;
-
-/**
- * DB2 字段类型转换
- *
- * @author zhanyao, hanchunlin
- * @since 2018-05-16
- */
-public class DB2TypeConvert implements ITypeConvert {
-    public static final DB2TypeConvert INSTANCE = new DB2TypeConvert();
-
-    /**
-     * @inheritDoc
-     */
-    @Override
-    public IColumnType processTypeConvert(GlobalConfig config, String fieldType) {
-        return TypeConverts.use(fieldType)
-            .test(containsAny("char", "text", "json", "enum").then(STRING))
-            .test(contains("bigint").then(LONG))
-            .test(contains("smallint").then(BASE_SHORT))
-            .test(contains("int").then(INTEGER))
-            .test(containsAny("date", "time", "year").then(DATE))
-            .test(contains("bit").then(BOOLEAN))
-            .test(contains("decimal").then(BIG_DECIMAL))
-            .test(contains("clob").then(CLOB))
-            .test(contains("blob").then(BLOB))
-            .test(contains("binary").then(BYTE_ARRAY))
-            .test(contains("float").then(FLOAT))
-            .test(contains("double").then(DOUBLE))
-            .or(STRING);
-    }
-
-}

+ 0 - 72
mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/config/converts/DmTypeConvert.java

@@ -1,72 +0,0 @@
-/*
- * Copyright (c) 2011-2020, baomidou (jobob@qq.com).
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.baomidou.mybatisplus.generator.config.converts;
-
-import com.baomidou.mybatisplus.generator.config.GlobalConfig;
-import com.baomidou.mybatisplus.generator.config.ITypeConvert;
-import com.baomidou.mybatisplus.generator.config.rules.IColumnType;
-
-import static com.baomidou.mybatisplus.generator.config.converts.TypeConverts.contains;
-import static com.baomidou.mybatisplus.generator.config.converts.TypeConverts.containsAny;
-import static com.baomidou.mybatisplus.generator.config.rules.DbColumnType.*;
-
-/**
- * DM 字段类型转换
- *
- * @author halower, hanchunlin
- * @since 2019-06-27
- */
-public class DmTypeConvert implements ITypeConvert {
-    public static final DmTypeConvert INSTANCE = new DmTypeConvert();
-
-    /**
-     * 字符数据类型: CHAR,CHARACTER,VARCHAR
-     * <p>
-     * 数值数据类型: NUMERIC,DECIMAL,DEC,MONEY,BIT,BOOL,BOOLEAN,INTEGER,INT,BIGINT,TINYINT,BYTE,SMALLINT,BINARY,
-     * VARBINARY
-     * <p>
-     * 近似数值数据类型: FLOAT
-     * <p>
-     * DOUBLE, DOUBLE PRECISION,REAL
-     * <p>
-     * 日期时间数据类型
-     * <p>
-     * 多媒体数据类型: TEXT,LONGVARCHAR,CLOB,BLOB,IMAGE
-     *
-     * @param config    全局配置
-     * @param fieldType 字段类型
-     * @return 对应的数据类型
-     * @inheritDoc
-     */
-    @Override
-    public IColumnType processTypeConvert(GlobalConfig config, String fieldType) {
-        return TypeConverts.use(fieldType)
-            .test(containsAny("char", "text").then(STRING))
-            .test(containsAny("numeric", "dec", "money").then(BIG_DECIMAL))
-            .test(containsAny("bit", "bool").then(BOOLEAN))
-            .test(contains("bigint").then(BIG_INTEGER))
-            .test(containsAny("int", "byte").then(INTEGER))
-            .test(contains("binary").then(BYTE_ARRAY))
-            .test(contains("float").then(FLOAT))
-            .test(containsAny("double", "real").then(DOUBLE))
-            .test(containsAny("date", "time").then(DATE))
-            .test(contains("clob").then(CLOB))
-            .test(contains("blob").then(BLOB))
-            .test(contains("image").then(BYTE_ARRAY))
-            .or(STRING);
-    }
-
-}

+ 0 - 89
mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/config/converts/FirebirdTypeConvert.java

@@ -1,89 +0,0 @@
-/*
- * Copyright (c) 2011-2020, baomidou (jobob@qq.com).
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.baomidou.mybatisplus.generator.config.converts;
-
-import com.baomidou.mybatisplus.generator.config.GlobalConfig;
-import com.baomidou.mybatisplus.generator.config.ITypeConvert;
-import com.baomidou.mybatisplus.generator.config.rules.DbColumnType;
-import com.baomidou.mybatisplus.generator.config.rules.IColumnType;
-
-import static com.baomidou.mybatisplus.generator.config.converts.TypeConverts.contains;
-import static com.baomidou.mybatisplus.generator.config.converts.TypeConverts.containsAny;
-import static com.baomidou.mybatisplus.generator.config.rules.DbColumnType.*;
-
-/**
- * MYSQL 数据库字段类型转换
- *
- * @author hubin, hanchunlin
- * @since 2017-01-20
- */
-public class FirebirdTypeConvert implements ITypeConvert {
-    public static final FirebirdTypeConvert INSTANCE = new FirebirdTypeConvert();
-
-    /**
-     * @inheritDoc
-     */
-    @Override
-    public IColumnType processTypeConvert(GlobalConfig config, String fieldType) {
-        return TypeConverts.use(fieldType)
-            .test(containsAny("cstring", "text").then(STRING))
-            .test(contains("short").then(SHORT))
-            .test(contains("long").then(LONG))
-            .test(contains("float").then(FLOAT))
-            .test(contains("double").then(DOUBLE))
-            .test(contains("blob").then(BLOB))
-            .test(contains("int64").then(LONG))
-            .test(containsAny("date", "time", "year").then(t -> toDateType(config, t)))
-            .or(STRING);
-    }
-
-    /**
-     * 转换为日期类型
-     *
-     * @param config 配置信息
-     * @param type   类型
-     * @return 返回对应的列类型
-     */
-    public static IColumnType toDateType(GlobalConfig config, String type) {
-        switch (config.getDateType()) {
-            case ONLY_DATE:
-                return DbColumnType.DATE;
-            case SQL_PACK:
-                switch (type) {
-                    case "date":
-                    case "year":
-                        return DbColumnType.DATE_SQL;
-                    case "time":
-                        return DbColumnType.TIME;
-                    default:
-                        return DbColumnType.TIMESTAMP;
-                }
-            case TIME_PACK:
-                switch (type) {
-                    case "date":
-                        return DbColumnType.LOCAL_DATE;
-                    case "time":
-                        return DbColumnType.LOCAL_TIME;
-                    case "year":
-                        return DbColumnType.YEAR;
-                    default:
-                        return DbColumnType.LOCAL_DATE_TIME;
-                }
-        }
-        return STRING;
-    }
-
-}

+ 0 - 89
mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/config/converts/KingbaseESTypeConvert.java

@@ -1,89 +0,0 @@
-/*
- * Copyright (c) 2011-2020, baomidou (jobob@qq.com).
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.baomidou.mybatisplus.generator.config.converts;
-
-import com.baomidou.mybatisplus.generator.config.GlobalConfig;
-import com.baomidou.mybatisplus.generator.config.ITypeConvert;
-import com.baomidou.mybatisplus.generator.config.rules.DateType;
-import com.baomidou.mybatisplus.generator.config.rules.DbColumnType;
-import com.baomidou.mybatisplus.generator.config.rules.IColumnType;
-
-import static com.baomidou.mybatisplus.generator.config.converts.TypeConverts.contains;
-import static com.baomidou.mybatisplus.generator.config.converts.TypeConverts.containsAny;
-import static com.baomidou.mybatisplus.generator.config.rules.DbColumnType.*;
-
-/**
- * KingbaseES 字段类型转换
- *
- * @author kingbase, hanchunlin
- * @since 2019-10-12
- */
-public class KingbaseESTypeConvert implements ITypeConvert {
-    public static final KingbaseESTypeConvert INSTANCE = new KingbaseESTypeConvert();
-
-    /**
-     * @param globalConfig 全局配置
-     * @param fieldType    字段类型
-     * @return 返回对应的字段类型
-     */
-    @Override
-    public IColumnType processTypeConvert(GlobalConfig globalConfig, String fieldType) {
-        return TypeConverts.use(fieldType)
-            .test(containsAny("char", "text", "json", "enum").then(STRING))
-            .test(contains("bigint").then(LONG))
-            .test(contains("int").then(INTEGER))
-            .test(containsAny("date", "time").then(p -> toDateType(globalConfig, p)))
-            .test(containsAny("bit", "boolean").then(BOOLEAN))
-            .test(containsAny("decimal", "numeric").then(BIG_DECIMAL))
-            .test(contains("clob").then(CLOB))
-            .test(contains("blob").then(BYTE_ARRAY))
-            .test(contains("float").then(FLOAT))
-            .test(contains("double").then(DOUBLE))
-            .or(STRING);
-    }
-
-    /**
-     * 转换为日期类型
-     *
-     * @param config 配置信息
-     * @param type   类型
-     * @return 返回对应的列类型
-     */
-    private IColumnType toDateType(GlobalConfig config, String type) {
-        DateType dateType = config.getDateType();
-        if (dateType == DateType.SQL_PACK) {
-            switch (type) {
-                case "date":
-                    return DATE_SQL;
-                case "time":
-                    return TIME;
-                default:
-                    return TIMESTAMP;
-            }
-        } else if (dateType == DateType.TIME_PACK) {
-            switch (type) {
-                case "date":
-                    return LOCAL_DATE;
-                case "time":
-                    return LOCAL_TIME;
-                default:
-                    return LOCAL_DATE_TIME;
-            }
-        }
-        return DbColumnType.DATE;
-    }
-
-}

+ 0 - 92
mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/config/converts/MySqlTypeConvert.java

@@ -1,92 +0,0 @@
-/*
- * Copyright (c) 2011-2020, baomidou (jobob@qq.com).
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.baomidou.mybatisplus.generator.config.converts;
-
-import com.baomidou.mybatisplus.generator.config.GlobalConfig;
-import com.baomidou.mybatisplus.generator.config.ITypeConvert;
-import com.baomidou.mybatisplus.generator.config.rules.DbColumnType;
-import com.baomidou.mybatisplus.generator.config.rules.IColumnType;
-
-import static com.baomidou.mybatisplus.generator.config.converts.TypeConverts.contains;
-import static com.baomidou.mybatisplus.generator.config.converts.TypeConverts.containsAny;
-import static com.baomidou.mybatisplus.generator.config.rules.DbColumnType.*;
-
-/**
- * MYSQL 数据库字段类型转换
- *
- * @author hubin, hanchunlin
- * @since 2017-01-20
- */
-public class MySqlTypeConvert implements ITypeConvert {
-    public static final MySqlTypeConvert INSTANCE = new MySqlTypeConvert();
-
-    /**
-     * @inheritDoc
-     */
-    @Override
-    public IColumnType processTypeConvert(GlobalConfig config, String fieldType) {
-        return TypeConverts.use(fieldType)
-            .test(containsAny("char", "text", "json", "enum").then(STRING))
-            .test(contains("bigint").then(LONG))
-            .test(containsAny("tinyint(1)", "bit").then(BOOLEAN))
-            .test(contains("int").then(INTEGER))
-            .test(contains("decimal").then(BIG_DECIMAL))
-            .test(contains("clob").then(CLOB))
-            .test(contains("blob").then(BLOB))
-            .test(contains("binary").then(BYTE_ARRAY))
-            .test(contains("float").then(FLOAT))
-            .test(contains("double").then(DOUBLE))
-            .test(containsAny("date", "time", "year").then(t -> toDateType(config, t)))
-            .or(STRING);
-    }
-
-    /**
-     * 转换为日期类型
-     *
-     * @param config 配置信息
-     * @param type   类型
-     * @return 返回对应的列类型
-     */
-    public static IColumnType toDateType(GlobalConfig config, String type) {
-        switch (config.getDateType()) {
-            case ONLY_DATE:
-                return DbColumnType.DATE;
-            case SQL_PACK:
-                switch (type) {
-                    case "date":
-                    case "year":
-                        return DbColumnType.DATE_SQL;
-                    case "time":
-                        return DbColumnType.TIME;
-                    default:
-                        return DbColumnType.TIMESTAMP;
-                }
-            case TIME_PACK:
-                switch (type) {
-                    case "date":
-                        return DbColumnType.LOCAL_DATE;
-                    case "time":
-                        return DbColumnType.LOCAL_TIME;
-                    case "year":
-                        return DbColumnType.YEAR;
-                    default:
-                        return DbColumnType.LOCAL_DATE_TIME;
-                }
-        }
-        return STRING;
-    }
-
-}

+ 0 - 96
mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/config/converts/OracleTypeConvert.java

@@ -1,96 +0,0 @@
-/*
- * Copyright (c) 2011-2020, baomidou (jobob@qq.com).
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.baomidou.mybatisplus.generator.config.converts;
-
-import com.baomidou.mybatisplus.generator.config.GlobalConfig;
-import com.baomidou.mybatisplus.generator.config.ITypeConvert;
-import com.baomidou.mybatisplus.generator.config.rules.DbColumnType;
-import com.baomidou.mybatisplus.generator.config.rules.IColumnType;
-
-import static com.baomidou.mybatisplus.generator.config.converts.TypeConverts.contains;
-import static com.baomidou.mybatisplus.generator.config.converts.TypeConverts.containsAny;
-import static com.baomidou.mybatisplus.generator.config.rules.DbColumnType.*;
-
-/**
- * Oracle 数据库生成对应实体类时字段类型转换,跟据 Oracle 中的数据类型,返回对应的 Java 类型
- *
- * @author hubin, hanchunlin
- * @since 2017-01-20
- */
-public class OracleTypeConvert implements ITypeConvert {
-    public static final OracleTypeConvert INSTANCE = new OracleTypeConvert();
-
-    /**
-     * 处理类型转换
-     *
-     * @param config    全局配置
-     * @param fieldType 字段类型
-     * @return 返回的对应的列类型
-     */
-    @Override
-    public IColumnType processTypeConvert(GlobalConfig config, String fieldType) {
-        return TypeConverts.use(fieldType)
-            .test(containsAny("char", "clob").then(STRING))
-            .test(containsAny("date", "timestamp").then(p -> toDateType(config)))
-            .test(contains("number").then(OracleTypeConvert::toNumberType))
-            .test(contains("float").then(FLOAT))
-            .test(contains("blob").then(BLOB))
-            .test(containsAny("binary", "raw").then(BYTE_ARRAY))
-            .or(STRING);
-    }
-
-    /**
-     * 将对应的类型名称转换为对应的 java 类类型
-     * <p>
-     * String.valueOf(Integer.MAX_VALUE).length() == 10
-     * Integer 不一定能装下 10 位的数字
-     * <p>
-     * String.valueOf(Long.MAX_VALUE).length() == 19
-     * Long 不一定能装下 19 位的数字
-     *
-     * @param typeName 类型名称
-     * @return 返回列类型
-     */
-    private static IColumnType toNumberType(String typeName) {
-        if (typeName.matches("number\\([0-9]\\)")) {
-            return DbColumnType.INTEGER;
-        } else if (typeName.matches("number\\(1[0-8]\\)")) {
-            return DbColumnType.LONG;
-        }
-        return DbColumnType.BIG_DECIMAL;
-    }
-
-    /**
-     * 当前时间为字段类型,根据全局配置返回对应的时间类型
-     *
-     * @param config 全局配置
-     * @return 时间类型
-     * @see GlobalConfig#getDateType()
-     */
-    protected static IColumnType toDateType(GlobalConfig config) {
-        switch (config.getDateType()) {
-            case ONLY_DATE:
-                return DbColumnType.DATE;
-            case SQL_PACK:
-                return DbColumnType.TIMESTAMP;
-            case TIME_PACK:
-                return DbColumnType.LOCAL_DATE_TIME;
-            default:
-                return STRING;
-        }
-    }
-
-}

+ 0 - 89
mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/config/converts/OscarTypeConvert.java

@@ -1,89 +0,0 @@
-/*
- * Copyright (c) 2011-2020, baomidou (jobob@qq.com).
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.baomidou.mybatisplus.generator.config.converts;
-
-import com.baomidou.mybatisplus.generator.config.GlobalConfig;
-import com.baomidou.mybatisplus.generator.config.ITypeConvert;
-import com.baomidou.mybatisplus.generator.config.rules.DateType;
-import com.baomidou.mybatisplus.generator.config.rules.DbColumnType;
-import com.baomidou.mybatisplus.generator.config.rules.IColumnType;
-
-import static com.baomidou.mybatisplus.generator.config.converts.TypeConverts.contains;
-import static com.baomidou.mybatisplus.generator.config.converts.TypeConverts.containsAny;
-import static com.baomidou.mybatisplus.generator.config.rules.DbColumnType.*;
-
-/**
- * KingbaseES 字段类型转换
- *
- * @author kingbase, hanchunlin
- * @since 2019-10-12
- */
-public class OscarTypeConvert implements ITypeConvert {
-    public static final OscarTypeConvert INSTANCE = new OscarTypeConvert();
-
-    /**
-     * @param globalConfig 全局配置
-     * @param fieldType    字段类型
-     * @return 返回对应的字段类型
-     */
-    @Override
-    public IColumnType processTypeConvert(GlobalConfig globalConfig, String fieldType) {
-        return TypeConverts.use(fieldType)
-            .test(containsAny("CHARACTER", "char", "varchar", "text", "character varying").then(STRING))
-            .test(containsAny("bigint", "int8").then(LONG))
-            .test(containsAny("int", "int1", "int2", "int3", "int4", "tinyint", "integer").then(INTEGER))
-            .test(containsAny("date", "time", "timestamp").then(p -> toDateType(globalConfig, p)))
-            .test(containsAny("bit", "boolean").then(BOOLEAN))
-            .test(containsAny("decimal", "numeric", "number").then(BIG_DECIMAL))
-            .test(contains("clob").then(CLOB))
-            .test(contains("blob").then(BYTE_ARRAY))
-            .test(contains("float").then(FLOAT))
-            .test(containsAny("double", "real", "float4", "float8").then(DOUBLE))
-            .or(STRING);
-    }
-
-    /**
-     * 转换为日期类型
-     *
-     * @param config 配置信息
-     * @param type   类型
-     * @return 返回对应的列类型
-     */
-    private IColumnType toDateType(GlobalConfig config, String type) {
-        DateType dateType = config.getDateType();
-        if (dateType == DateType.SQL_PACK) {
-            switch (type) {
-                case "date":
-                    return DATE_SQL;
-                case "time":
-                    return TIME;
-                default:
-                    return TIMESTAMP;
-            }
-        } else if (dateType == DateType.TIME_PACK) {
-            switch (type) {
-                case "date":
-                    return LOCAL_DATE;
-                case "time":
-                    return LOCAL_TIME;
-                default:
-                    return LOCAL_DATE_TIME;
-            }
-        }
-        return DbColumnType.DATE;
-    }
-
-}

+ 0 - 87
mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/config/converts/PostgreSqlTypeConvert.java

@@ -1,87 +0,0 @@
-/*
- * Copyright (c) 2011-2020, baomidou (jobob@qq.com).
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.baomidou.mybatisplus.generator.config.converts;
-
-import com.baomidou.mybatisplus.generator.config.GlobalConfig;
-import com.baomidou.mybatisplus.generator.config.ITypeConvert;
-import com.baomidou.mybatisplus.generator.config.rules.DbColumnType;
-import com.baomidou.mybatisplus.generator.config.rules.IColumnType;
-
-import static com.baomidou.mybatisplus.generator.config.converts.TypeConverts.contains;
-import static com.baomidou.mybatisplus.generator.config.converts.TypeConverts.containsAny;
-import static com.baomidou.mybatisplus.generator.config.rules.DbColumnType.*;
-
-/**
- * PostgreSQL 字段类型转换
- *
- * @author hubin, hanchunlin
- * @since 2017-01-20
- */
-public class PostgreSqlTypeConvert implements ITypeConvert {
-    public static final PostgreSqlTypeConvert INSTANCE = new PostgreSqlTypeConvert();
-
-    /**
-     * @inheritDoc
-     */
-    @Override
-    public IColumnType processTypeConvert(GlobalConfig config, String fieldType) {
-        return TypeConverts.use(fieldType)
-            .test(containsAny("char", "text", "json", "enum").then(STRING))
-            .test(contains("bigint").then(LONG))
-            .test(contains("int").then(INTEGER))
-            .test(containsAny("date", "time").then(t -> toDateType(config, t)))
-            .test(contains("bit").then(BOOLEAN))
-            .test(containsAny("decimal", "numeric").then(BIG_DECIMAL))
-            .test(contains("clob").then(CLOB))
-            .test(contains("blob").then(BYTE_ARRAY))
-            .test(contains("float").then(FLOAT))
-            .test(contains("double").then(DOUBLE))
-            .test(contains("boolean").then(BOOLEAN))
-            .or(STRING);
-    }
-
-    /**
-     * 转换为日期类型
-     *
-     * @param config 配置信息
-     * @param type   类型
-     * @return 返回对应的列类型
-     */
-    public static IColumnType toDateType(GlobalConfig config, String type) {
-        switch (config.getDateType()) {
-            case SQL_PACK:
-                switch (type) {
-                    case "date":
-                        return DbColumnType.DATE_SQL;
-                    case "time":
-                        return DbColumnType.TIME;
-                    default:
-                        return DbColumnType.TIMESTAMP;
-                }
-            case TIME_PACK:
-                switch (type) {
-                    case "date":
-                        return DbColumnType.LOCAL_DATE;
-                    case "time":
-                        return DbColumnType.LOCAL_TIME;
-                    default:
-                        return DbColumnType.LOCAL_DATE_TIME;
-                }
-            default:
-                return DbColumnType.DATE;
-        }
-    }
-}

+ 0 - 85
mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/config/converts/SqlServerTypeConvert.java

@@ -1,85 +0,0 @@
-/*
- * Copyright (c) 2011-2020, baomidou (jobob@qq.com).
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.baomidou.mybatisplus.generator.config.converts;
-
-import com.baomidou.mybatisplus.generator.config.GlobalConfig;
-import com.baomidou.mybatisplus.generator.config.ITypeConvert;
-import com.baomidou.mybatisplus.generator.config.rules.IColumnType;
-
-import static com.baomidou.mybatisplus.generator.config.converts.TypeConverts.contains;
-import static com.baomidou.mybatisplus.generator.config.converts.TypeConverts.containsAny;
-import static com.baomidou.mybatisplus.generator.config.rules.DbColumnType.*;
-
-/**
- * SQLServer 字段类型转换
- *
- * @author hubin, hanchunlin
- * @since 2017-01-20
- */
-public class SqlServerTypeConvert implements ITypeConvert {
-
-    public static final SqlServerTypeConvert INSTANCE = new SqlServerTypeConvert();
-
-    /**
-     * @inheritDoc
-     */
-    @Override
-    public IColumnType processTypeConvert(GlobalConfig config, String fieldType) {
-        return TypeConverts.use(fieldType)
-            .test(containsAny("char", "xml", "text").then(STRING))
-            .test(contains("bigint").then(LONG))
-            .test(contains("int").then(INTEGER))
-            .test(containsAny("date", "time").then(t -> toDateType(config, t)))
-            .test(contains("bit").then(BOOLEAN))
-            .test(containsAny("decimal", "numeric").then(DOUBLE))
-            .test(contains("money").then(BIG_DECIMAL))
-            .test(containsAny("binary", "image").then(BYTE_ARRAY))
-            .test(containsAny("float", "real").then(FLOAT))
-            .or(STRING);
-    }
-
-    /**
-     * 转换为日期类型
-     *
-     * @param config 配置信息
-     * @param type   类型
-     * @return 返回对应的列类型
-     */
-    public static IColumnType toDateType(GlobalConfig config, String type) {
-        switch (config.getDateType()) {
-            case SQL_PACK:
-                switch (type) {
-                    case "date":
-                        return DATE_SQL;
-                    case "time":
-                        return TIME;
-                    default:
-                        return TIMESTAMP;
-                }
-            case TIME_PACK:
-                switch (type) {
-                    case "date":
-                        return LOCAL_DATE;
-                    case "time":
-                        return LOCAL_TIME;
-                    default:
-                        return LOCAL_DATE_TIME;
-                }
-            default:
-                return DATE;
-        }
-    }
-}

+ 0 - 57
mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/config/converts/SqliteTypeConvert.java

@@ -1,57 +0,0 @@
-/*
- * Copyright (c) 2011-2020, baomidou (jobob@qq.com).
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.baomidou.mybatisplus.generator.config.converts;
-
-import com.baomidou.mybatisplus.generator.config.GlobalConfig;
-import com.baomidou.mybatisplus.generator.config.ITypeConvert;
-import com.baomidou.mybatisplus.generator.config.rules.DbColumnType;
-import com.baomidou.mybatisplus.generator.config.rules.IColumnType;
-
-import static com.baomidou.mybatisplus.generator.config.converts.MySqlTypeConvert.toDateType;
-import static com.baomidou.mybatisplus.generator.config.converts.TypeConverts.contains;
-import static com.baomidou.mybatisplus.generator.config.converts.TypeConverts.containsAny;
-import static com.baomidou.mybatisplus.generator.config.rules.DbColumnType.*;
-
-/**
- * SQLite 字段类型转换
- *
- * @author chen_wj, hanchunlin
- * @since 2019-05-08
- */
-public class SqliteTypeConvert implements ITypeConvert {
-    public static final SqliteTypeConvert INSTANCE = new SqliteTypeConvert();
-
-    /**
-     * @inheritDoc
-     * @see MySqlTypeConvert#toDateType(GlobalConfig, String)
-     */
-    @Override
-    public IColumnType processTypeConvert(GlobalConfig config, String fieldType) {
-        return TypeConverts.use(fieldType)
-            .test(contains("bigint").then(LONG))
-            .test(containsAny("tinyint(1)", "boolean").then(BOOLEAN))
-            .test(contains("int").then(INTEGER))
-            .test(containsAny("text", "char", "enum").then(STRING))
-            .test(containsAny("decimal", "numeric").then(BIG_DECIMAL))
-            .test(contains("clob").then(CLOB))
-            .test(contains("blob").then(BLOB))
-            .test(contains("float").then(FLOAT))
-            .test(contains("double").then(DOUBLE))
-            .test(containsAny("date", "time", "year").then(t -> toDateType(config, t)))
-            .or(DbColumnType.STRING);
-    }
-
-}

+ 0 - 99
mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/config/converts/TypeConverts.java

@@ -1,99 +0,0 @@
-/*
- * Copyright (c) 2011-2020, baomidou (jobob@qq.com).
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.baomidou.mybatisplus.generator.config.converts;
-
-import com.baomidou.mybatisplus.annotation.DbType;
-import com.baomidou.mybatisplus.generator.config.ITypeConvert;
-import com.baomidou.mybatisplus.generator.config.converts.select.BranchBuilder;
-import com.baomidou.mybatisplus.generator.config.converts.select.Selector;
-import com.baomidou.mybatisplus.generator.config.rules.IColumnType;
-
-/**
- * 该注册器负责注册并查询类型注册器
- *
- * @author nieqiuqiu, hanchunlin
- * @since 3.3.1
- */
-public class TypeConverts {
-
-    /**
-     * 查询数据库类型对应的类型转换器
-     *
-     * @param dbType 数据库类型
-     * @return 返回转换器
-     */
-    public static ITypeConvert getTypeConvert(DbType dbType) {
-        switch (dbType) {
-            case ORACLE:
-                return OracleTypeConvert.INSTANCE;
-            case DB2:
-                return DB2TypeConvert.INSTANCE;
-            case DM:
-            case GAUSS:
-                return DmTypeConvert.INSTANCE;
-            case KINGBASE_ES:
-                return KingbaseESTypeConvert.INSTANCE;
-            case OSCAR:
-                return OscarTypeConvert.INSTANCE;
-            case MYSQL:
-            case MARIADB:
-                return MySqlTypeConvert.INSTANCE;
-            case POSTGRE_SQL:
-                return PostgreSqlTypeConvert.INSTANCE;
-            case SQLITE:
-                return SqliteTypeConvert.INSTANCE;
-            case SQL_SERVER:
-                return SqlServerTypeConvert.INSTANCE;
-            case FIREBIRD:
-                return FirebirdTypeConvert.INSTANCE;
-        }
-        return null;
-    }
-
-    /**
-     * 使用指定参数构建一个选择器
-     *
-     * @param param 参数
-     * @return 返回选择器
-     */
-    static Selector<String, IColumnType> use(String param) {
-        return new Selector<>(param.toLowerCase());
-    }
-
-    /**
-     * 这个分支构建器用于构建用于支持 {@link String#contains(CharSequence)} 的分支
-     *
-     * @param value 分支的值
-     * @return 返回分支构建器
-     * @see #containsAny(CharSequence...)
-     */
-    static BranchBuilder<String, IColumnType> contains(CharSequence value) {
-        return BranchBuilder.of(s -> s.contains(value));
-    }
-
-    /**
-     * @see #contains(CharSequence)
-     */
-    static BranchBuilder<String, IColumnType> containsAny(CharSequence... values) {
-        return BranchBuilder.of(s -> {
-            for (CharSequence value : values) {
-                if (s.contains(value)) return true;
-            }
-            return false;
-        });
-    }
-
-}

+ 0 - 16
mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/config/converts/package-info.java

@@ -1,16 +0,0 @@
-/*
- * Copyright (c) 2011-2020, baomidou (jobob@qq.com).
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.baomidou.mybatisplus.generator.config.converts;

+ 0 - 64
mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/config/converts/select/Branch.java

@@ -1,64 +0,0 @@
-/*
- * Copyright (c) 2011-2020, baomidou (jobob@qq.com).
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.baomidou.mybatisplus.generator.config.converts.select;
-
-import java.util.function.Function;
-import java.util.function.Predicate;
-
-/**
- * 分支提供者
- *
- * @author hanchunlin
- * Created at 2020/6/11 17:19
- * @see BranchBuilder
- */
-public interface Branch<P, T> {
-
-    /**
-     * @return 分支进入条件
-     */
-    Predicate<P> tester();
-
-    /**
-     * @return 值工厂
-     */
-    Function<P, T> factory();
-
-    /**
-     * 工厂方法,快速创建分支
-     *
-     * @param tester  测试器
-     * @param factory 值工厂
-     * @param <P>     参数类型
-     * @param <T>     值类型
-     * @return 返回一个新的分支
-     */
-    static <P, T> Branch<P, T> of(Predicate<P> tester, Function<P, T> factory) {
-        return new Branch<P, T>() {
-
-            @Override
-            public Predicate<P> tester() {
-                return tester;
-            }
-
-            @Override
-            public Function<P, T> factory() {
-                return factory;
-            }
-
-        };
-    }
-}

+ 0 - 59
mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/config/converts/select/BranchBuilder.java

@@ -1,59 +0,0 @@
-/*
- * Copyright (c) 2011-2020, baomidou (jobob@qq.com).
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.baomidou.mybatisplus.generator.config.converts.select;
-
-import java.util.function.Function;
-import java.util.function.Predicate;
-
-/**
- * 分支构建者
- *
- * @author hanchunlin
- * Created at 2020/6/11 17:22
- */
-public interface BranchBuilder<P, T> {
-
-    /**
-     * 使用一个值工厂构造出一个分支
-     *
-     * @param factory 值工厂
-     * @return 返回分支
-     */
-    Branch<P, T> then(Function<P, T> factory);
-
-    /**
-     * 从值构建出一个分支
-     *
-     * @param value 值
-     * @return 返回一个分支
-     */
-    default Branch<P, T> then(T value) {
-        return then(p -> value);
-    }
-
-    /**
-     * 工厂函数,用于创建分支构建者
-     *
-     * @param tester 测试器
-     * @param <P>    参数类型
-     * @param <T>    返回值类型
-     * @return 返回一个分支创建者
-     */
-    static <P, T> BranchBuilder<P, T> of(Predicate<P> tester) {
-        return factory -> Branch.of(tester, factory);
-    }
-
-}

+ 0 - 110
mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/config/converts/select/Selector.java

@@ -1,110 +0,0 @@
-/*
- * Copyright (c) 2011-2020, baomidou (jobob@qq.com).
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.baomidou.mybatisplus.generator.config.converts.select;
-
-import java.util.function.Function;
-import java.util.function.Supplier;
-
-/**
- * 分支结果选择器
- * <p>
- * 当前选择器会从给定的分支中选择第一个匹配的分支,并返回其结果
- * <p>
- * 一旦结果被选择,其他的分支将不再被调用
- *
- * @author hanchunlin
- * Created at 2020/6/11 16:55
- */
-public class Selector<P, T> {
-    private boolean selected = false;
-    private Function<P, T> factory;
-
-    /**
-     * 选择器参数,该参数会在进行条件判断和结果获取时会被当做条件传入
-     */
-    private final P param;
-
-    /**
-     * @param param 参数
-     */
-    public Selector(P param) {
-        this.param = param;
-    }
-
-    /**
-     * 使用指定的参数创建选择器
-     *
-     * @param param 参数
-     * @param <P>   参数类型
-     * @param <T>   返回值类型
-     * @return 返回新的选择器
-     */
-    public static <P, T> Selector<P, T> param(P param) {
-        return new Selector<>(param);
-    }
-
-    /**
-     * 传入一个新的分支,如果这个分支满足条件
-     *
-     * @param branch 则当前选择器将接受当前分支的结果并完成
-     * @return 选择器自身
-     */
-    public Selector<P, T> test(Branch<P, T> branch) {
-        if (!selected) {
-            boolean pass = branch.tester().test(param);
-            if (pass) {
-                selected = true;
-                factory = branch.factory();
-            }
-        }
-        return this;
-    }
-
-    /**
-     * 获取结果,如果当前选择器没有击中任何条件分支,则从给定的提供者中获取结果;
-     * 否则将使用当前选择器选中的分支
-     *
-     * @param supplier 默认值提供者
-     * @return 如果有分支被击中,则返回分支值,否则返回参数提供的值
-     */
-    public T or(Supplier<T> supplier) {
-        return selected ? this.factory.apply(param) : supplier.get();
-    }
-
-    /**
-     * @param t 给定默认值
-     * @return 如果有分支被击中,则返回分支值,否则返回参数
-     * @see #or(Supplier)
-     */
-    public T or(T t) {
-        return or(() -> t);
-    }
-
-    /**
-     * 当前选择器是否已经选择分支
-     *
-     * @return 如果已经存在分支被击中,则返回 true;否则返回 false
-     */
-    public boolean isSelected() {
-        return selected;
-    }
-
-    @Override
-    public String toString() {
-        return String.format("Selector{success=%s}", selected);
-    }
-
-}

+ 0 - 19
mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/config/package-info.java

@@ -1,19 +0,0 @@
-/*
- * Copyright (c) 2011-2020, baomidou (jobob@qq.com).
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/**
- * 代码生成器,配置相关类
- */
-package com.baomidou.mybatisplus.generator.config;

+ 0 - 52
mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/config/po/LikeTable.java

@@ -1,52 +0,0 @@
-/*
- * Copyright (c) 2011-2020, baomidou (jobob@qq.com).
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.baomidou.mybatisplus.generator.config.po;
-
-import com.baomidou.mybatisplus.core.enums.SqlLike;
-import com.baomidou.mybatisplus.core.toolkit.sql.SqlUtils;
-
-/**
- * 表名拼接
- *
- * @author nieqiuqiu
- * @date 2019-11-26
- * @since 3.3.0
- */
-public class LikeTable {
-
-    private String value;
-
-    private SqlLike like = SqlLike.DEFAULT;
-
-    public LikeTable(String value) {
-        this.value = value;
-    }
-
-    public LikeTable(String value, SqlLike like) {
-        this.value = value;
-        this.like = like;
-    }
-
-    @Override
-    public String toString() {
-        return getValue();
-    }
-
-    public String getValue() {
-        return SqlUtils.concatLike(this.value, like);
-    }
-
-}

+ 0 - 138
mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/config/po/TableField.java

@@ -1,138 +0,0 @@
-/*
- * Copyright (c) 2011-2020, baomidou (jobob@qq.com).
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.baomidou.mybatisplus.generator.config.po;
-
-import com.baomidou.mybatisplus.core.toolkit.StringUtils;
-import com.baomidou.mybatisplus.generator.config.StrategyConfig;
-import com.baomidou.mybatisplus.generator.config.rules.IColumnType;
-import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy;
-import lombok.Data;
-import lombok.experimental.Accessors;
-
-import java.util.Map;
-
-/**
- * 表字段信息
- *
- * @author YangHu
- * @since 2016-12-03
- */
-@Data
-@Accessors(chain = true)
-public class TableField {
-    private boolean convert;
-    private boolean keyFlag;
-    /**
-     * 主键是否为自增类型
-     */
-    private boolean keyIdentityFlag;
-    private String name;
-    private String type;
-    private String propertyName;
-    private IColumnType columnType;
-    private String comment;
-    private String fill;
-    /**
-     * 是否关键字
-     *
-     * @since 3.3.2
-     */
-    private boolean keyWords;
-    /**
-     * 数据库字段(关键字含转义符号)
-     *
-     * @since 3.3.2
-     */
-    private String columnName;
-    /**
-     * 自定义查询字段列表
-     */
-    private Map<String, Object> customMap;
-
-    public TableField setConvert(boolean convert) {
-        this.convert = convert;
-        return this;
-    }
-
-    protected TableField setConvert(StrategyConfig strategyConfig) {
-        if (strategyConfig.isEntityTableFieldAnnotationEnable() || isKeyWords()) {
-            this.convert = true;
-            return this;
-        }
-        if (strategyConfig.isCapitalModeNaming(name)) {
-            this.convert = false;
-        } else {
-            // 转换字段
-            if (NamingStrategy.underline_to_camel == strategyConfig.getColumnNaming()) {
-                // 包含大写处理
-                if (StringUtils.containsUpperCase(name)) {
-                    this.convert = true;
-                }
-            } else if (!name.equals(propertyName)) {
-                this.convert = true;
-            }
-        }
-        return this;
-    }
-
-    public TableField setPropertyName(StrategyConfig strategyConfig, String propertyName) {
-        this.propertyName = propertyName;
-        this.setConvert(strategyConfig);
-        return this;
-    }
-
-    public String getPropertyType() {
-        if (null != columnType) {
-            return columnType.getType();
-        }
-        return null;
-    }
-
-    /**
-     * 按 JavaBean 规则来生成 get 和 set 方法后面的属性名称
-     * 需要处理一下特殊情况:
-     * <p>
-     * 1、如果只有一位,转换为大写形式
-     * 2、如果多于 1 位,只有在第二位是小写的情况下,才会把第一位转为小写
-     * <p>
-     * 我们并不建议在数据库对应的对象中使用基本类型,因此这里不会考虑基本类型的情况
-     */
-    public String getCapitalName() {
-        if (propertyName.length() == 1) {
-            return propertyName.toUpperCase();
-        }
-        if (Character.isLowerCase(propertyName.charAt(1))) {
-            return Character.toUpperCase(propertyName.charAt(0)) + propertyName.substring(1);
-        }
-        return propertyName;
-    }
-
-    /**
-     * 获取注解字段名称
-     *
-     * @return 字段
-     * @since 3.3.2
-     */
-    public String getAnnotationColumnName() {
-        if (keyWords) {
-            if (columnName.startsWith("\"")) {
-                return String.format("\\\"%s\\\"", name);
-            }
-        }
-        return columnName;
-    }
-
-}

+ 0 - 43
mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/config/po/TableFill.java

@@ -1,43 +0,0 @@
-/*
- * Copyright (c) 2011-2020, baomidou (jobob@qq.com).
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.baomidou.mybatisplus.generator.config.po;
-
-import com.baomidou.mybatisplus.annotation.FieldFill;
-import lombok.Data;
-
-/**
- * 字段填充
- *
- * @author hubin
- * @since 2017-06-26
- */
-@Data
-public class TableFill {
-
-    /**
-     * 字段名称
-     */
-    private String fieldName;
-    /**
-     * 忽略类型
-     */
-    private FieldFill fieldFill;
-
-    public TableFill(String fieldName, FieldFill ignore) {
-        this.fieldName = fieldName;
-        this.fieldFill = ignore;
-    }
-}

+ 0 - 161
mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/config/po/TableInfo.java

@@ -1,161 +0,0 @@
-/*
- * Copyright (c) 2011-2020, baomidou (jobob@qq.com).
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.baomidou.mybatisplus.generator.config.po;
-
-import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
-import com.baomidou.mybatisplus.core.toolkit.StringUtils;
-import com.baomidou.mybatisplus.generator.config.StrategyConfig;
-import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy;
-import lombok.Data;
-import lombok.experimental.Accessors;
-
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-import java.util.stream.IntStream;
-
-/**
- * 表信息,关联到当前字段信息
- *
- * @author YangHu
- * @since 2016/8/30
- */
-@Data
-@Accessors(chain = true)
-public class TableInfo {
-
-    private final Set<String> importPackages = new HashSet<>();
-    private boolean convert;
-    private String name;
-    private String comment;
-    private String entityName;
-    private String mapperName;
-    private String xmlName;
-    private String serviceName;
-    private String serviceImplName;
-    private String controllerName;
-    private List<TableField> fields;
-    private boolean havePrimaryKey;
-    /**
-     * 公共字段
-     */
-    private List<TableField> commonFields;
-    private String fieldNames;
-
-    public TableInfo setConvert(boolean convert) {
-        this.convert = convert;
-        return this;
-    }
-
-    protected TableInfo setConvert(StrategyConfig strategyConfig) {
-        if (strategyConfig.startsWithTablePrefix(name) || strategyConfig.isEntityTableFieldAnnotationEnable()) {
-            // 包含前缀
-            this.convert = true;
-        } else if (strategyConfig.isCapitalModeNaming(name)) {
-            // 包含
-            this.convert = false;
-        } else {
-            // 转换字段
-            if (NamingStrategy.underline_to_camel == strategyConfig.getColumnNaming()) {
-                // 包含大写处理
-                if (StringUtils.containsUpperCase(name)) {
-                    this.convert = true;
-                }
-            } else if (!entityName.equalsIgnoreCase(name)) {
-                this.convert = true;
-            }
-        }
-        return this;
-    }
-
-    public String getEntityPath() {
-        return entityName.substring(0, 1).toLowerCase() + entityName.substring(1);
-    }
-
-    public TableInfo setEntityName(StrategyConfig strategyConfig, String entityName) {
-        this.entityName = entityName;
-        this.setConvert(strategyConfig);
-        return this;
-    }
-
-    public TableInfo setFields(List<TableField> fields) {
-        this.fields = fields;
-        if (CollectionUtils.isNotEmpty(fields)) {
-            // 收集导入包信息
-            for (TableField field : fields) {
-                if (null != field.getColumnType() && null != field.getColumnType().getPkg()) {
-                    importPackages.add(field.getColumnType().getPkg());
-                }
-                if (field.isKeyFlag()) {
-                    // 主键
-                    if (field.isConvert() || field.isKeyIdentityFlag()) {
-                        importPackages.add(com.baomidou.mybatisplus.annotation.TableId.class.getCanonicalName());
-                    }
-                    // 自增
-                    if (field.isKeyIdentityFlag()) {
-                        importPackages.add(com.baomidou.mybatisplus.annotation.IdType.class.getCanonicalName());
-                    }
-                } else if (field.isConvert()) {
-                    // 普通字段
-                    importPackages.add(com.baomidou.mybatisplus.annotation.TableField.class.getCanonicalName());
-                }
-                if (null != field.getFill()) {
-                    // 填充字段
-                    importPackages.add(com.baomidou.mybatisplus.annotation.TableField.class.getCanonicalName());
-                    importPackages.add(com.baomidou.mybatisplus.annotation.FieldFill.class.getCanonicalName());
-                }
-            }
-        }
-        return this;
-    }
-
-    public TableInfo setImportPackages(String pkg) {
-        if (importPackages.contains(pkg)) {
-            return this;
-        } else {
-            importPackages.add(pkg);
-            return this;
-        }
-    }
-
-    /**
-     * 逻辑删除
-     */
-    public boolean isLogicDelete(String logicDeletePropertyName) {
-        return fields.parallelStream().anyMatch(tf -> tf.getName().equals(logicDeletePropertyName));
-    }
-
-    /**
-     * 转换filed实体为 xml mapper 中的 base column 字符串信息
-     */
-    public String getFieldNames() {
-        if (StringUtils.isBlank(fieldNames)
-            && CollectionUtils.isNotEmpty(fields)) {
-            StringBuilder names = new StringBuilder();
-            IntStream.range(0, fields.size()).forEach(i -> {
-                TableField fd = fields.get(i);
-                if (i == fields.size() - 1) {
-                    names.append(fd.getColumnName());
-                } else {
-                    names.append(fd.getColumnName()).append(", ");
-                }
-            });
-            fieldNames = names.toString();
-        }
-        return fieldNames;
-    }
-
-}

+ 0 - 19
mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/config/po/package-info.java

@@ -1,19 +0,0 @@
-/*
- * Copyright (c) 2011-2020, baomidou (jobob@qq.com).
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/**
- * 代码生成器,输出相关类
- */
-package com.baomidou.mybatisplus.generator.config.po;

+ 0 - 42
mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/config/querys/AbstractDbQuery.java

@@ -1,42 +0,0 @@
-/*
- * Copyright (c) 2011-2020, baomidou (jobob@qq.com).
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.baomidou.mybatisplus.generator.config.querys;
-
-import com.baomidou.mybatisplus.generator.config.IDbQuery;
-
-import java.sql.ResultSet;
-import java.sql.SQLException;
-
-/**
- * 表数据查询抽象类
- *
- * @author hubin
- * @since 2018-01-16
- */
-public abstract class AbstractDbQuery implements IDbQuery {
-
-
-    @Override
-    public boolean isKeyIdentity(ResultSet results) throws SQLException {
-        return false;
-    }
-
-
-    @Override
-    public String[] fieldCustom() {
-        return null;
-    }
-}

+ 0 - 73
mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/config/querys/DB2Query.java

@@ -1,73 +0,0 @@
-/*
- * Copyright (c) 2011-2020, baomidou (jobob@qq.com).
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.baomidou.mybatisplus.generator.config.querys;
-
-/**
- * DB2 表数据查询
- *
- * @author zhanyao
- * @since 2018-05-16
- */
-public class DB2Query extends AbstractDbQuery {
-
-    @Override
-    public String tablesSql() {
-        return "SELECT * FROM SYSCAT.TABLES where tabschema=%s";
-    }
-
-
-    @Override
-    public String tableFieldsSql() {
-        return "SELECT * FROM syscat.columns WHERE tabschema=%s AND tabname='%s'";
-    }
-
-
-    @Override
-    public String tableName() {
-        return "TABNAME";
-    }
-
-
-    @Override
-    public String tableComment() {
-        return "REMARKS";
-    }
-
-
-    @Override
-    public String fieldName() {
-        return "COLNAME";
-    }
-
-
-    @Override
-    public String fieldType() {
-        return "TYPENAME";
-    }
-
-
-    @Override
-    public String fieldComment() {
-        return "REMARKS";
-    }
-
-
-    @Override
-    public String fieldKey() {
-        return "IDENTITY";
-    }
-
-}

+ 0 - 78
mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/config/querys/DMQuery.java

@@ -1,78 +0,0 @@
-/*
- * Copyright (c) 2011-2020, baomidou (jobob@qq.com).
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.baomidou.mybatisplus.generator.config.querys;
-
-/**
- * DM 表数据查询
- *
- * @author halower
- * @since 2019-06-27
- */
-public class DMQuery extends AbstractDbQuery {
-
-    @Override
-    public String tablesSql() {
-        return "SELECT * FROM (SELECT DISTINCT T1.TABLE_NAME AS TABLE_NAME,T2.COMMENTS AS TABLE_COMMENT FROM USER_TAB_COLUMNS T1 " +
-            "INNER JOIN USER_TAB_COMMENTS T2 ON T1.TABLE_NAME = T2.TABLE_NAME) WHERE 1=1 ";
-    }
-
-    @Override
-    public String tableFieldsSql() {
-        return
-            "SELECT T2.COLUMN_NAME,T1.COMMENTS,T2.DATA_TYPE ," +
-                "CASE WHEN CONSTRAINT_TYPE='P' THEN 'PRI' END AS KEY " +
-                "FROM USER_COL_COMMENTS T1, USER_TAB_COLUMNS T2, " +
-                "(SELECT T4.TABLE_NAME, T4.COLUMN_NAME ,T5.CONSTRAINT_TYPE " +
-                "FROM USER_CONS_COLUMNS T4, USER_CONSTRAINTS T5 " +
-                "WHERE T4.CONSTRAINT_NAME = T5.CONSTRAINT_NAME " +
-                "AND T5.CONSTRAINT_TYPE = 'P')T3 " +
-                "WHERE T1.TABLE_NAME = T2.TABLE_NAME AND " +
-                "T1.COLUMN_NAME=T2.COLUMN_NAME AND " +
-                "T1.TABLE_NAME = T3.TABLE_NAME(+) AND " +
-                "T1.COLUMN_NAME=T3.COLUMN_NAME(+)   AND " +
-                "T1.TABLE_NAME = '%s' " +
-                "ORDER BY T2.TABLE_NAME,T2.COLUMN_ID";
-    }
-
-    @Override
-    public String tableName() {
-        return "TABLE_NAME";
-    }
-    @Override
-    public String tableComment() {
-        return "TABLE_COMMENT";
-    }
-
-    @Override
-    public String fieldName() {
-        return "COLUMN_NAME";
-    }
-
-    @Override
-    public String fieldType() {
-        return "DATA_TYPE";
-    }
-
-    @Override
-    public String fieldComment() {
-        return "COMMENTS";
-    }
-
-    @Override
-    public String fieldKey() {
-        return "KEY";
-    }
-}

+ 0 - 53
mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/config/querys/DbQueryRegistry.java

@@ -1,53 +0,0 @@
-/*
- * Copyright (c) 2011-2020, baomidou (jobob@qq.com).
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.baomidou.mybatisplus.generator.config.querys;
-
-import com.baomidou.mybatisplus.annotation.DbType;
-import com.baomidou.mybatisplus.generator.config.IDbQuery;
-
-import java.util.EnumMap;
-import java.util.Map;
-
-/**
- * @author nieqiuqiu
- * @date 2020-01-09
- * @since 3.3.1
- */
-public class DbQueryRegistry {
-
-    private final Map<DbType, IDbQuery> db_query_enum_map = new EnumMap<>(DbType.class);
-
-    public DbQueryRegistry() {
-        db_query_enum_map.put(DbType.ORACLE, new OracleQuery());
-        db_query_enum_map.put(DbType.SQL_SERVER, new SqlServerQuery());
-        db_query_enum_map.put(DbType.POSTGRE_SQL, new PostgreSqlQuery());
-        db_query_enum_map.put(DbType.DB2, new DB2Query());
-        db_query_enum_map.put(DbType.MARIADB, new MariadbQuery());
-        db_query_enum_map.put(DbType.H2, new H2Query());
-        db_query_enum_map.put(DbType.SQLITE, new SqliteQuery());
-        db_query_enum_map.put(DbType.DM, new DMQuery());
-        db_query_enum_map.put(DbType.KINGBASE_ES, new KingbaseESQuery());
-        db_query_enum_map.put(DbType.MYSQL, new MySqlQuery());
-        db_query_enum_map.put(DbType.GAUSS, new GaussQuery());
-        db_query_enum_map.put(DbType.OSCAR, new OscarQuery());
-        db_query_enum_map.put(DbType.FIREBIRD, new FirebirdQuery());
-        db_query_enum_map.put(DbType.XU_GU, new XuguQuery());
-    }
-
-    public IDbQuery getDbQuery(DbType dbType) {
-        return db_query_enum_map.get(dbType);
-    }
-}

+ 0 - 95
mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/config/querys/FirebirdQuery.java

@@ -1,95 +0,0 @@
-/*
- * Copyright (c) 2011-2020, baomidou (jobob@qq.com).
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.baomidou.mybatisplus.generator.config.querys;
-
-/**
- * MySql 表数据查询
- *
- * @author steven ma
- * @since 2020-08-20
- */
-public class FirebirdQuery extends AbstractDbQuery {
-
-    @Override
-    public String tablesSql() {
-        return "select trim(rdb$relation_name) as rdb$relation_name " +
-            "from rdb$relations " +
-            "where rdb$view_blr is null " +
-            "and (rdb$system_flag is null or rdb$system_flag = 0)";
-    }
-
-
-    @Override
-    public String tableFieldsSql() {
-        return "select trim(f.rdb$relation_name) AS rdb$relation_name, " +
-            "trim(f.rdb$field_name) AS FIELD, t.rdb$type_name AS  TYPE, " +
-            "(CASE WHEN ( " +
-            "   SELECT count(*) " +
-            "   FROM RDB$RELATION_CONSTRAINTS RC " +
-            "   LEFT JOIN RDB$INDICES I ON (I.RDB$INDEX_NAME = RC.RDB$INDEX_NAME) " +
-            "   LEFT JOIN RDB$INDEX_SEGMENTS S ON (S.RDB$INDEX_NAME = I.RDB$INDEX_NAME) " +
-            "   WHERE (RC.RDB$CONSTRAINT_TYPE = 'PRIMARY KEY') " +
-            "   AND (I.RDB$RELATION_NAME = f.rdb$relation_name  ) " +
-            "   AND (S.RDB$FIELD_NAME = f.rdb$field_name) " +
-            ") > 0 THEN 'PRI' ELSE '' END) AS pk " +
-            "from rdb$relation_fields f " +
-            "join rdb$relations r on f.rdb$relation_name = r.rdb$relation_name " +
-            "JOIN rdb$fields fs ON f.rdb$field_source = fs.rdb$field_name " +
-            "JOIN rdb$types  t ON fs.rdb$field_type = t.rdb$type " +
-            "and r.rdb$view_blr is NULL " +
-            "AND t.rdb$field_name = 'RDB$FIELD_TYPE' " +
-            "and (r.rdb$system_flag is null or r.rdb$system_flag = 0) " +
-            "AND f.rdb$relation_name = '%s' " +
-            "order by 1, f.rdb$field_position";
-    }
-
-
-    @Override
-    public String tableName() {
-        return "rdb$relation_name";
-    }
-
-
-    @Override
-    public String tableComment() {
-        return "";
-    }
-
-
-    @Override
-    public String fieldName() {
-        return "FIELD";
-    }
-
-
-    @Override
-    public String fieldType() {
-        return "TYPE";
-    }
-
-
-    @Override
-    public String fieldComment() {
-        return "";
-    }
-
-
-    @Override
-    public String fieldKey() {
-        return "PK";
-    }
-
-}

+ 0 - 77
mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/config/querys/GaussQuery.java

@@ -1,77 +0,0 @@
-/*
- * Copyright (c) 2011-2020, baomidou (jobob@qq.com).
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.baomidou.mybatisplus.generator.config.querys;
-
-/**
- * Gauss 表数据查询
- *
- * @author halower
- * @since 2019-06-27
- */
-public class GaussQuery extends AbstractDbQuery {
-
-    @Override
-    public String tablesSql() {
-        return "SELECT * FROM (SELECT DISTINCT T1.TABLE_NAME,T2.COMMENTS AS TABLE_COMMENT FROM USER_TAB_COLUMNS T1 " +
-            "LEFT JOIN USER_TAB_COMMENTS T2 ON T1.TABLE_NAME = T2.TABLE_NAME ) a WHERE 1=1 ";
-    }
-
-    @Override
-    public String tableFieldsSql() {
-        return
-            "SELECT T1.COLUMN_NAME,T2.COMMENTS,T1.DATA_TYPE," +
-                "CASE WHEN CONSTRAINT_TYPE='P' THEN 'PRI' END AS KEY " +
-                "FROM USER_TAB_COLUMNS T1 " +
-                "LEFT JOIN USER_COL_COMMENTS T2 ON " +
-                "(T1.TABLE_NAME = T2.TABLE_NAME AND T1.COLUMN_NAME = T2.COLUMN_NAME) " +
-                "LEFT JOIN (" +
-                "SELECT T4.TABLE_NAME,T4.COLUMN_NAME,T5.CONSTRAINT_TYPE FROM USER_CONS_COLUMNS T4,USER_CONSTRAINTS T5 " +
-                "WHERE T4.CONSTRAINT_NAME = T5.CONSTRAINT_NAME AND T5.CONSTRAINT_TYPE = 'P'" +
-                ")T3 ON (T1.TABLE_NAME = T3.TABLE_NAME AND T1.COLUMN_NAME = T3.COLUMN_NAME) " +
-                "WHERE T1.TABLE_NAME = '%s' " +
-                "ORDER BY T1.TABLE_NAME,T1.COLUMN_ID";
-    }
-
-    @Override
-    public String tableName() {
-        return "TABLE_NAME";
-    }
-
-    @Override
-    public String tableComment() {
-        return "TABLE_COMMENT";
-    }
-
-    @Override
-    public String fieldName() {
-        return "COLUMN_NAME";
-    }
-
-    @Override
-    public String fieldType() {
-        return "DATA_TYPE";
-    }
-
-    @Override
-    public String fieldComment() {
-        return "COMMENTS";
-    }
-
-    @Override
-    public String fieldKey() {
-        return "KEY";
-    }
-}

+ 0 - 83
mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/config/querys/H2Query.java

@@ -1,83 +0,0 @@
-/*
- * Copyright (c) 2011-2020, baomidou (jobob@qq.com).
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.baomidou.mybatisplus.generator.config.querys;
-
-import java.sql.ResultSet;
-import java.sql.SQLException;
-
-/**
- * H2Database 表数据查询
- *
- * @author yuxiaobin
- * @since 2019-01-8
- */
-public class H2Query extends AbstractDbQuery {
-
-    public static final String PK_QUERY_SQL = "select * from INFORMATION_SCHEMA.INDEXES WHERE TABLE_NAME = '%s'";
-
-    @Override
-    public String tablesSql() {
-        return "SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE 1=1 ";
-    }
-
-
-    @Override
-    public String tableFieldsSql() {
-        return "SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME= '%s' ";
-    }
-
-
-    @Override
-    public String tableName() {
-        return "TABLE_NAME";
-    }
-
-
-    @Override
-    public String tableComment() {
-        return "REMARKS";
-    }
-
-
-    @Override
-    public String fieldName() {
-        return "COLUMN_NAME";
-    }
-
-
-    @Override
-    public String fieldType() {
-        return "TYPE_NAME";
-    }
-
-
-    @Override
-    public String fieldComment() {
-        return "REMARKS";
-    }
-
-
-    @Override
-    public String fieldKey() {
-        return "PRIMARY_KEY";
-    }
-
-
-    @Override
-    public boolean isKeyIdentity(ResultSet results) throws SQLException {
-        return results.getString("SEQUENCE_NAME") != null;
-    }
-}

+ 0 - 75
mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/config/querys/KingbaseESQuery.java

@@ -1,75 +0,0 @@
-/*
- * Copyright (c) 2011-2020, baomidou (jobob@qq.com).
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.baomidou.mybatisplus.generator.config.querys;
-
-/**
- * KingbaseES 表数据查询
- *
- * @author kingbase
- * @since 2019-10-12
- */
-public class KingbaseESQuery extends AbstractDbQuery {
-
-    @Override
-    public String tablesSql() {
-        return "SELECT A.tablename, obj_description(relfilenode, 'sys_class') AS comments FROM sys_tables A, sys_class B WHERE A.schemaname='%s' AND A.tablename = B.relname";
-    }
-
-
-    @Override
-    public String tableFieldsSql() {
-        return "SELECT A.attname AS name, format_type(A.atttypid, A.atttypmod) AS type,col_description(A.attrelid, A.attnum) AS comment, (CASE C.contype WHEN 'p' THEN 'PRI' ELSE '' END) AS key " +
-            "FROM sys_attribute A LEFT JOIN sys_constraint C ON A.attnum = C.conkey[1] AND A.attrelid = C.conrelid " +
-            "WHERE  A.attrelid = '%s.%s'::regclass AND A.attnum > 0 AND NOT A.attisdropped ORDER  BY A.attnum";
-    }
-
-
-    @Override
-    public String tableName() {
-        return "tablename";
-    }
-
-
-    @Override
-    public String tableComment() {
-        return "comments";
-    }
-
-
-    @Override
-    public String fieldName() {
-        return "name";
-    }
-
-
-    @Override
-    public String fieldType() {
-        return "type";
-    }
-
-
-    @Override
-    public String fieldComment() {
-        return "comment";
-    }
-
-
-    @Override
-    public String fieldKey() {
-        return "key";
-    }
-
-}

+ 0 - 81
mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/config/querys/MariadbQuery.java

@@ -1,81 +0,0 @@
-/*
- * Copyright (c) 2011-2020, baomidou (jobob@qq.com).
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.baomidou.mybatisplus.generator.config.querys;
-
-import java.sql.ResultSet;
-import java.sql.SQLException;
-
-/**
- * MySql 表数据查询
- *
- * @author hubin
- * @since 2018-01-16
- */
-public class MariadbQuery extends AbstractDbQuery {
-
-    @Override
-    public String tablesSql() {
-        return "show table status WHERE 1=1 ";
-    }
-
-
-    @Override
-    public String tableFieldsSql() {
-        return "show full fields from `%s`";
-    }
-
-
-    @Override
-    public String tableName() {
-        return "NAME";
-    }
-
-
-    @Override
-    public String tableComment() {
-        return "COMMENT";
-    }
-
-
-    @Override
-    public String fieldName() {
-        return "FIELD";
-    }
-
-
-    @Override
-    public String fieldType() {
-        return "TYPE";
-    }
-
-
-    @Override
-    public String fieldComment() {
-        return "COMMENT";
-    }
-
-
-    @Override
-    public String fieldKey() {
-        return "KEY";
-    }
-
-
-    @Override
-    public boolean isKeyIdentity(ResultSet results) throws SQLException {
-        return "auto_increment".equals(results.getString("Extra"));
-    }
-}

+ 0 - 81
mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/config/querys/MySqlQuery.java

@@ -1,81 +0,0 @@
-/*
- * Copyright (c) 2011-2020, baomidou (jobob@qq.com).
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.baomidou.mybatisplus.generator.config.querys;
-
-import java.sql.ResultSet;
-import java.sql.SQLException;
-
-/**
- * MySql 表数据查询
- *
- * @author hubin
- * @since 2018-01-16
- */
-public class MySqlQuery extends AbstractDbQuery {
-
-    @Override
-    public String tablesSql() {
-        return "show table status WHERE 1=1 ";
-    }
-
-
-    @Override
-    public String tableFieldsSql() {
-        return "show full fields from `%s`";
-    }
-
-
-    @Override
-    public String tableName() {
-        return "NAME";
-    }
-
-
-    @Override
-    public String tableComment() {
-        return "COMMENT";
-    }
-
-
-    @Override
-    public String fieldName() {
-        return "FIELD";
-    }
-
-
-    @Override
-    public String fieldType() {
-        return "TYPE";
-    }
-
-
-    @Override
-    public String fieldComment() {
-        return "COMMENT";
-    }
-
-
-    @Override
-    public String fieldKey() {
-        return "KEY";
-    }
-
-
-    @Override
-    public boolean isKeyIdentity(ResultSet results) throws SQLException {
-        return "auto_increment".equals(results.getString("Extra"));
-    }
-}

+ 0 - 82
mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/config/querys/OracleQuery.java

@@ -1,82 +0,0 @@
-/*
- * Copyright (c) 2011-2020, baomidou (jobob@qq.com).
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.baomidou.mybatisplus.generator.config.querys;
-
-/**
- * Oracle 表数据查询
- *
- * @author hubin
- * @since 2018-01-16
- */
-public class OracleQuery extends AbstractDbQuery {
-
-    @Override
-    public String tablesSql() {
-        return "SELECT * FROM ALL_TAB_COMMENTS WHERE OWNER='%s'";
-    }
-
-
-    @Override
-    public String tableFieldsSql() {
-        return "SELECT A.COLUMN_NAME, CASE WHEN A.DATA_TYPE='NUMBER' THEN "
-            + "(CASE WHEN A.DATA_PRECISION IS NULL THEN A.DATA_TYPE "
-            + "WHEN NVL(A.DATA_SCALE, 0) > 0 THEN A.DATA_TYPE||'('||A.DATA_PRECISION||','||A.DATA_SCALE||')' "
-            + "ELSE A.DATA_TYPE||'('||A.DATA_PRECISION||')' END) "
-            + "ELSE A.DATA_TYPE END DATA_TYPE, B.COMMENTS,DECODE(C.POSITION, '1', 'PRI') KEY "
-            + "FROM ALL_TAB_COLUMNS A "
-            + " INNER JOIN ALL_COL_COMMENTS B ON A.TABLE_NAME = B.TABLE_NAME AND A.COLUMN_NAME = B.COLUMN_NAME AND B.OWNER = '#schema'"
-            + " LEFT JOIN ALL_CONSTRAINTS D ON D.TABLE_NAME = A.TABLE_NAME AND D.CONSTRAINT_TYPE = 'P' AND D.OWNER = '#schema'"
-            + " LEFT JOIN ALL_CONS_COLUMNS C ON C.CONSTRAINT_NAME = D.CONSTRAINT_NAME AND C.COLUMN_NAME=A.COLUMN_NAME AND C.OWNER = '#schema'"
-            + "WHERE A.OWNER = '#schema' AND A.TABLE_NAME = '%s' ORDER BY A.COLUMN_ID ";
-    }
-
-
-    @Override
-    public String tableName() {
-        return "TABLE_NAME";
-    }
-
-
-    @Override
-    public String tableComment() {
-        return "COMMENTS";
-    }
-
-
-    @Override
-    public String fieldName() {
-        return "COLUMN_NAME";
-    }
-
-
-    @Override
-    public String fieldType() {
-        return "DATA_TYPE";
-    }
-
-
-    @Override
-    public String fieldComment() {
-        return "COMMENTS";
-    }
-
-
-    @Override
-    public String fieldKey() {
-        return "KEY";
-    }
-
-}

+ 0 - 81
mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/config/querys/OscarQuery.java

@@ -1,81 +0,0 @@
-/*
- * Copyright (c) 2011-2020, baomidou (jobob@qq.com).
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.baomidou.mybatisplus.generator.config.querys;
-
-/**
- * <p>Oscar(神通数据库) 表数据查询</p>
- *
- * @author whli
- * @version 1.0.0
- * @since 2020/7/28 18:54
- */
-public class OscarQuery extends AbstractDbQuery {
-
-    @Override
-    public String tablesSql() {
-        return "SELECT * FROM (SELECT " +
-            "a.TABLE_NAME, " +
-            "b.COMMENTS " +
-            "FROM USER_TABLES a " +
-            "INNER JOIN USER_TAB_COMMENTS b ON (b.TABLE_TYPE = 'TABLE' AND a.TABLE_NAME = b.TABLE_NAME)) a WHERE 1=1 ";
-    }
-
-    @Override
-    public String tableFieldsSql() {
-        return "SELECT " +
-            "T1.COLUMN_NAME, " +
-            "T1.DATA_TYPE, " +
-            "T2.COMMENTS, " +
-            "CASE WHEN T3.CONSTRAINT_TYPE = 'P' THEN 'PRI' " +
-            "ELSE '' END KEY " +
-            "FROM USER_TAB_COLUMNS T1 " +
-            "INNER JOIN USER_COL_COMMENTS T2 ON (T1.COLUMN_NAME = T2.COLUMN_NAME) " +
-            "LEFT JOIN(SELECT a.TABLE_NAME,b.COLUMN_NAME,a.CONSTRAINT_TYPE FROM USER_CONSTRAINTS a, USER_IND_COLUMNS b " +
-            "WHERE a.CONSTRAINT_TYPE = 'P' AND a.INDEX_NAME = b.INDEX_NAME) T3 ON (T1.TABLE_NAME = T3.TABLE_NAME AND T1.COLUMN_NAME = T3.COLUMN_NAME) " +
-            "WHERE T1.TABLE_NAME = '%s' " +
-            "GROUP BY T1.COLUMN_NAME,T1.DATA_TYPE,T2.COMMENTS,T3.CONSTRAINT_TYPE ";
-    }
-
-    @Override
-    public String tableName() {
-        return "TABLE_NAME";
-    }
-
-    @Override
-    public String tableComment() {
-        return "COMMENTS";
-    }
-
-    @Override
-    public String fieldName() {
-        return "COLUMN_NAME";
-    }
-
-    @Override
-    public String fieldType() {
-        return "DATA_TYPE";
-    }
-
-    @Override
-    public String fieldComment() {
-        return "COMMENTS";
-    }
-
-    @Override
-    public String fieldKey() {
-        return "KEY";
-    }
-}

+ 0 - 75
mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/config/querys/PostgreSqlQuery.java

@@ -1,75 +0,0 @@
-/*
- * Copyright (c) 2011-2020, baomidou (jobob@qq.com).
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.baomidou.mybatisplus.generator.config.querys;
-
-/**
- * PostgreSql 表数据查询
- *
- * @author hubin
- * @since 2018-01-16
- */
-public class PostgreSqlQuery extends AbstractDbQuery {
-
-    @Override
-    public String tablesSql() {
-        return "SELECT A.tablename, obj_description(relfilenode, 'pg_class') AS comments FROM pg_tables A, pg_class B WHERE A.schemaname='%s' AND A.tablename = B.relname";
-    }
-
-
-    @Override
-    public String tableFieldsSql() {
-        return "SELECT A.attname AS name,format_type (A.atttypid,A.atttypmod) AS type,col_description (A.attrelid,A.attnum) AS comment,\n" +
-            "(CASE WHEN (SELECT COUNT (*) FROM pg_constraint AS PC WHERE A.attnum = PC.conkey[1] AND PC.contype = 'p') > 0 THEN 'PRI' ELSE '' END) AS key \n" +
-            "FROM pg_class AS C,pg_attribute AS A WHERE A.attrelid='\"%s\"'::regclass AND A.attrelid= C.oid AND A.attnum> 0 AND NOT A.attisdropped ORDER  BY A.attnum";
-    }
-
-
-    @Override
-    public String tableName() {
-        return "tablename";
-    }
-
-
-    @Override
-    public String tableComment() {
-        return "comments";
-    }
-
-
-    @Override
-    public String fieldName() {
-        return "name";
-    }
-
-
-    @Override
-    public String fieldType() {
-        return "type";
-    }
-
-
-    @Override
-    public String fieldComment() {
-        return "comment";
-    }
-
-
-    @Override
-    public String fieldKey() {
-        return "key";
-    }
-
-}

+ 0 - 97
mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/config/querys/SqlServerQuery.java

@@ -1,97 +0,0 @@
-/*
- * Copyright (c) 2011-2020, baomidou (jobob@qq.com).
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.baomidou.mybatisplus.generator.config.querys;
-
-import java.sql.ResultSet;
-import java.sql.SQLException;
-
-/**
- * SqlServer 表数据查询
- *
- * @author hubin
- * @since 2018-01-16
- */
-public class SqlServerQuery extends AbstractDbQuery {
-    
-    @Override
-    public String tablesSql() {
-        return "select * from (select cast(so.name as varchar(500)) as TABLE_NAME, " +
-            "cast(sep.value as varchar(500)) as COMMENTS from sysobjects so " +
-            "left JOIN sys.extended_properties sep on sep.major_id=so.id and sep.minor_id=0 " +
-            "where (xtype='U' or xtype='v')) a where 1=1 ";
-    }
-
-
-    @Override
-    public String tableFieldsSql() {
-        return "SELECT  cast(a.name AS VARCHAR(500)) AS TABLE_NAME,cast(b.name AS VARCHAR(500)) AS COLUMN_NAME, "
-            + "cast(c.VALUE AS NVARCHAR(500)) AS COMMENTS,cast(sys.types.name AS VARCHAR (500)) AS DATA_TYPE,"
-            + "(" + " SELECT CASE count(1) WHEN 1 then 'PRI' ELSE '' END"
-            + " FROM syscolumns,sysobjects,sysindexes,sysindexkeys,systypes "
-            + " WHERE syscolumns.xusertype = systypes.xusertype AND syscolumns.id = object_id (a.name) AND sysobjects.xtype = 'PK'"
-            + " AND sysobjects.parent_obj = syscolumns.id " + " AND sysindexes.id = syscolumns.id "
-            + " AND sysobjects.name = sysindexes.name AND sysindexkeys.id = syscolumns.id "
-            + " AND sysindexkeys.indid = sysindexes.indid "
-            + " AND syscolumns.colid = sysindexkeys.colid AND syscolumns.name = b.name) as 'KEY',"
-            + "  b.is_identity isIdentity "
-            + " FROM ( select name,object_id from sys.tables UNION all select name,object_id from sys.views ) a "
-            + " INNER JOIN sys.columns b ON b.object_id = a.object_id "
-            + " LEFT JOIN sys.types ON b.user_type_id = sys.types.user_type_id   "
-            + " LEFT JOIN sys.extended_properties c ON c.major_id = b.object_id AND c.minor_id = b.column_id "
-            + " WHERE a.name = '%s' and sys.types.name !='sysname' ";
-    }
-
-    @Override
-    public String tableName() {
-        return "TABLE_NAME";
-    }
-
-
-    @Override
-    public String tableComment() {
-        return "COMMENTS";
-    }
-
-
-    @Override
-    public String fieldName() {
-        return "COLUMN_NAME";
-    }
-
-
-    @Override
-    public String fieldType() {
-        return "DATA_TYPE";
-    }
-
-
-    @Override
-    public String fieldComment() {
-        return "COMMENTS";
-    }
-
-
-    @Override
-    public String fieldKey() {
-        return "KEY";
-    }
-
-
-    @Override
-    public boolean isKeyIdentity(ResultSet results) throws SQLException {
-        return 1 == results.getInt("isIdentity");
-    }
-}

+ 0 - 72
mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/config/querys/SqliteQuery.java

@@ -1,72 +0,0 @@
-/*
- * Copyright (c) 2011-2020, baomidou (jobob@qq.com).
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.baomidou.mybatisplus.generator.config.querys;
-
-/**
- * Sqlite 表数据查询
- *
- * @author chen
- * @since 2019-05-08
- */
-public class SqliteQuery extends AbstractDbQuery {
-
-    @Override
-    public String tablesSql() {
-        return "select * from sqlite_master where type='table'";
-    }
-
-
-    @Override
-    public String tableFieldsSql() {
-        return "pragma table_info('%s');";
-    }
-
-
-    @Override
-    public String tableName() {
-        return "name";
-    }
-
-
-    @Override
-    public String tableComment() {
-        return "";
-    }
-
-
-    @Override
-    public String fieldName() {
-        return "name";
-    }
-
-
-    @Override
-    public String fieldType() {
-        return "type";
-    }
-
-
-    @Override
-    public String fieldComment() {
-        return "";
-    }
-
-
-    @Override
-    public String fieldKey() {
-        return "pk";
-    }
-}

+ 0 - 67
mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/config/querys/XuguQuery.java

@@ -1,67 +0,0 @@
-/*
- * Copyright (c) 2011-2020, baomidou (jobob@qq.com).
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.baomidou.mybatisplus.generator.config.querys;
-
-/**
- * <p>
- * Xugu 表数据查询
- * </p>
- *
- * @author unique1319 lanjerry
- * @since 2020-10-26
- */
-public class XuguQuery extends AbstractDbQuery {
-
-    @Override
-    public String tablesSql() {
-        return "SELECT * FROM ALL_TABLES WHERE 1 = 1";
-    }
-
-    @Override
-    public String tableFieldsSql() {
-        return "SELECT B.COL_NAME,B.TYPE_NAME,B.COMMENTS, '' AS KEY FROM ALL_TABLES A INNER JOIN ALL_COLUMNS B ON A.TABLE_ID = B.TABLE_ID WHERE A.TABLE_NAME = '%s'";
-    }
-
-    @Override
-    public String tableName() {
-        return "TABLE_NAME";
-    }
-
-    @Override
-    public String tableComment() {
-        return "COMMENTS";
-    }
-
-    @Override
-    public String fieldName() {
-        return "COL_NAME";
-    }
-
-    @Override
-    public String fieldType() {
-        return "TYPE_NAME";
-    }
-
-    @Override
-    public String fieldComment() {
-        return "COMMENTS";
-    }
-
-    @Override
-    public String fieldKey() {
-        return "KEY";
-    }
-}

+ 0 - 19
mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/config/querys/package-info.java

@@ -1,19 +0,0 @@
-/*
- * Copyright (c) 2011-2020, baomidou (jobob@qq.com).
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/**
- * 代码生成器,数据库查询相关类
- */
-package com.baomidou.mybatisplus.generator.config.querys;

+ 0 - 38
mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/config/rules/DateType.java

@@ -1,38 +0,0 @@
-/*
- * Copyright (c) 2011-2020, baomidou (jobob@qq.com).
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.baomidou.mybatisplus.generator.config.rules;
-
-/**
- * 数据库时间类型 到 实体类时间类型 对应策略
- *
- * @author miemie
- * @since 2018/5/22
- */
-public enum DateType {
-    /**
-     * 只使用 java.util.date 代替
-     */
-    ONLY_DATE,
-    /**
-     * 使用 java.sql 包下的
-     */
-    SQL_PACK,
-    /**
-     * 使用 java.time 包下的
-     * <p>java8 新的时间类型</p>
-     */
-    TIME_PACK
-}

+ 0 - 92
mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/config/rules/DbColumnType.java

@@ -1,92 +0,0 @@
-/*
- * Copyright (c) 2011-2020, baomidou (jobob@qq.com).
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.baomidou.mybatisplus.generator.config.rules;
-
-/**
- * 表字段类型
- *
- * @author hubin
- * @since 2017-01-11
- */
-public enum DbColumnType implements IColumnType {
-    // 基本类型
-    BASE_BYTE("byte", null),
-    BASE_SHORT("short", null),
-    BASE_CHAR("char", null),
-    BASE_INT("int", null),
-    BASE_LONG("long", null),
-    BASE_FLOAT("float", null),
-    BASE_DOUBLE("double", null),
-    BASE_BOOLEAN("boolean", null),
-
-    // 包装类型
-    BYTE("Byte", null),
-    SHORT("Short", null),
-    CHARACTER("Character", null),
-    INTEGER("Integer", null),
-    LONG("Long", null),
-    FLOAT("Float", null),
-    DOUBLE("Double", null),
-    BOOLEAN("Boolean", null),
-    STRING("String", null),
-
-    // sql 包下数据类型
-    DATE_SQL("Date", "java.sql.Date"),
-    TIME("Time", "java.sql.Time"),
-    TIMESTAMP("Timestamp", "java.sql.Timestamp"),
-    BLOB("Blob", "java.sql.Blob"),
-    CLOB("Clob", "java.sql.Clob"),
-
-    // java8 新时间类型
-    LOCAL_DATE("LocalDate", "java.time.LocalDate"),
-    LOCAL_TIME("LocalTime", "java.time.LocalTime"),
-    YEAR("Year", "java.time.Year"),
-    YEAR_MONTH("YearMonth", "java.time.YearMonth"),
-    LOCAL_DATE_TIME("LocalDateTime", "java.time.LocalDateTime"),
-    INSTANT("Instant", "java.time.Instant"),
-
-    // 其他杂类
-    BYTE_ARRAY("byte[]", null),
-    OBJECT("Object", null),
-    DATE("Date", "java.util.Date"),
-    BIG_INTEGER("BigInteger", "java.math.BigInteger"),
-    BIG_DECIMAL("BigDecimal", "java.math.BigDecimal");
-
-    /**
-     * 类型
-     */
-    private final String type;
-
-    /**
-     * 包路径
-     */
-    private final String pkg;
-
-    DbColumnType(final String type, final String pkg) {
-        this.type = type;
-        this.pkg = pkg;
-    }
-
-    @Override
-    public String getType() {
-        return type;
-    }
-
-    @Override
-    public String getPkg() {
-        return pkg;
-    }
-}

+ 0 - 32
mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/config/rules/FileType.java

@@ -1,32 +0,0 @@
-/*
- * Copyright (c) 2011-2020, baomidou (jobob@qq.com).
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.baomidou.mybatisplus.generator.config.rules;
-
-/**
- * 生成文件类型
- *
- * @author hubin
- * @since 2018-08-07
- */
-public enum FileType {
-    ENTITY,
-    MAPPER,
-    XML,
-    SERVICE,
-    SERVICE_IMPL,
-    CONTROLLER,
-    OTHER
-}

+ 0 - 39
mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/config/rules/IColumnType.java

@@ -1,39 +0,0 @@
-/*
- * Copyright (c) 2011-2020, baomidou (jobob@qq.com).
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.baomidou.mybatisplus.generator.config.rules;
-
-/**
- * 获取实体类字段属性类信息接口
- *
- * @author miemie
- * @since 2018-08-22
- */
-public interface IColumnType {
-
-    /**
-     * 获取字段类型
-     *
-     * @return 字段类型
-     */
-    String getType();
-
-    /**
-     * 获取字段类型完整名
-     *
-     * @return 字段类型完整名
-     */
-    String getPkg();
-}

+ 0 - 145
mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/config/rules/NamingStrategy.java

@@ -1,145 +0,0 @@
-/*
- * Copyright (c) 2011-2020, baomidou (jobob@qq.com).
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.baomidou.mybatisplus.generator.config.rules;
-
-import com.baomidou.mybatisplus.core.toolkit.StringPool;
-import com.baomidou.mybatisplus.core.toolkit.StringUtils;
-import com.baomidou.mybatisplus.generator.config.ConstVal;
-
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.Set;
-
-/**
- * 从数据库表到文件的命名策略
- *
- * @author YangHu, tangguo
- * @since 2016/8/30
- */
-public enum NamingStrategy {
-    /**
-     * 不做任何改变,原样输出
-     */
-    no_change,
-    /**
-     * 下划线转驼峰命名
-     */
-    underline_to_camel;
-
-    public static String underlineToCamel(String name) {
-        // 快速检查
-        if (StringUtils.isBlank(name)) {
-            // 没必要转换
-            return StringPool.EMPTY;
-        }
-        String tempName = name;
-        // 大写数字下划线组成转为小写 , 允许混合模式转为小写
-        if (StringUtils.isCapitalMode(name) || StringUtils.isMixedMode(name)) {
-            tempName = name.toLowerCase();
-        }
-        StringBuilder result = new StringBuilder();
-        // 用下划线将原始字符串分割
-        String[] camels = tempName.split(ConstVal.UNDERLINE);
-        // 跳过原始字符串中开头、结尾的下换线或双重下划线
-        // 处理真正的驼峰片段
-        Arrays.stream(camels).filter(camel -> !StringUtils.isBlank(camel)).forEach(camel -> {
-            if (result.length() == 0) {
-                // 第一个驼峰片段,全部字母都小写
-                result.append(camel.toLowerCase());
-            } else {
-                // 其他的驼峰片段,首字母大写
-                result.append(capitalFirst(camel));
-            }
-        });
-        return result.toString();
-    }
-
-    /**
-     * 去掉指定的前缀
-     *
-     * @param name   ignore
-     * @param prefix ignore
-     * @return ignore
-     * @see #removePrefix(String, Set)
-     * @deprecated 3.4.1
-     */
-    @Deprecated
-    public static String removePrefix(String name, String... prefix) {
-        Set<String> set = new HashSet<>(Arrays.asList(prefix));
-        return removePrefix(name, set);
-    }
-
-    public static String removePrefix(String name, Set<String> prefix) {
-        if (StringUtils.isBlank(name)) {
-            return StringPool.EMPTY;
-        }
-        if (null != prefix) {
-            // 判断是否有匹配的前缀,然后截取前缀
-            // 删除前缀
-            return prefix.stream().filter(pf -> name.toLowerCase()
-                .matches(StringPool.HAT + pf.toLowerCase() + ".*"))
-                .findFirst().map(pf -> name.substring(pf.length())).orElse(name);
-        }
-        return name;
-    }
-
-    /**
-     * 判断是否包含prefix
-     *
-     * @param name   ignore
-     * @param prefix ignore
-     * @return ignore
-     */
-    public static boolean isPrefixContained(String name, String... prefix) {
-        if (null == prefix || StringUtils.isBlank(name)) {
-            return false;
-        }
-        return Arrays.stream(prefix).anyMatch(pf -> name.toLowerCase().matches(StringPool.HAT + pf.toLowerCase() + ".*"));
-    }
-
-    /**
-     * 去掉下划线前缀且将后半部分转成驼峰格式
-     *
-     * @param name        ignore
-     * @param tablePrefix ignore
-     * @return ignore
-     * @see #removePrefix(String, Set)
-     * @deprecated 3.4.1
-     */
-    @Deprecated
-    public static String removePrefixAndCamel(String name, String[] tablePrefix) {
-        return underlineToCamel(removePrefix(name, tablePrefix));
-    }
-
-    public static String removePrefixAndCamel(String name, Set<String> tablePrefix) {
-        return underlineToCamel(removePrefix(name, tablePrefix));
-    }
-
-
-    /**
-     * 实体首字母大写
-     *
-     * @param name 待转换的字符串
-     * @return 转换后的字符串
-     */
-    public static String capitalFirst(String name) {
-        if (StringUtils.isNotBlank(name)) {
-            return name.substring(0, 1).toUpperCase() + name.substring(1);
-        }
-        return StringPool.EMPTY;
-    }
-
-}

+ 0 - 19
mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/config/rules/package-info.java

@@ -1,19 +0,0 @@
-/*
- * Copyright (c) 2011-2020, baomidou (jobob@qq.com).
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/**
- * 代码生成器,规则相关类
- */
-package com.baomidou.mybatisplus.generator.config.rules;

+ 0 - 315
mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/engine/AbstractTemplateEngine.java

@@ -1,315 +0,0 @@
-/*
- * Copyright (c) 2011-2020, baomidou (jobob@qq.com).
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.baomidou.mybatisplus.generator.engine;
-
-import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
-import com.baomidou.mybatisplus.core.toolkit.StringPool;
-import com.baomidou.mybatisplus.core.toolkit.StringUtils;
-import com.baomidou.mybatisplus.generator.InjectionConfig;
-import com.baomidou.mybatisplus.generator.config.ConstVal;
-import com.baomidou.mybatisplus.generator.config.FileOutConfig;
-import com.baomidou.mybatisplus.generator.config.GlobalConfig;
-import com.baomidou.mybatisplus.generator.config.TemplateConfig;
-import com.baomidou.mybatisplus.generator.config.builder.ConfigBuilder;
-import com.baomidou.mybatisplus.generator.config.po.TableInfo;
-import com.baomidou.mybatisplus.generator.config.rules.FileType;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.File;
-import java.io.IOException;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
-
-
-/**
- * 模板引擎抽象类
- *
- * @author hubin
- * @since 2018-01-10
- */
-public abstract class AbstractTemplateEngine {
-
-    protected static final Logger logger = LoggerFactory.getLogger(AbstractTemplateEngine.class);
-    /**
-     * 配置信息
-     */
-    private ConfigBuilder configBuilder;
-
-
-    /**
-     * 模板引擎初始化
-     */
-    public AbstractTemplateEngine init(ConfigBuilder configBuilder) {
-        this.configBuilder = configBuilder;
-        return this;
-    }
-
-
-    /**
-     * 输出 java xml 文件
-     */
-    public AbstractTemplateEngine batchOutput() {
-        try {
-            List<TableInfo> tableInfoList = getConfigBuilder().getTableInfoList();
-            for (TableInfo tableInfo : tableInfoList) {
-                Map<String, Object> objectMap = getObjectMap(tableInfo);
-                Map<String, String> pathInfo = getConfigBuilder().getPathInfo();
-                TemplateConfig template = getConfigBuilder().getTemplate();
-                // 自定义内容
-                InjectionConfig injectionConfig = getConfigBuilder().getInjectionConfig();
-                if (null != injectionConfig) {
-                    injectionConfig.initTableMap(tableInfo);
-                    objectMap.put("cfg", injectionConfig.getMap());
-                    List<FileOutConfig> focList = injectionConfig.getFileOutConfigList();
-                    if (CollectionUtils.isNotEmpty(focList)) {
-                        for (FileOutConfig foc : focList) {
-                            if (isCreate(FileType.OTHER, foc.outputFile(tableInfo))) {
-                                writerFile(objectMap, foc.getTemplatePath(), foc.outputFile(tableInfo));
-                            }
-                        }
-                    }
-                }
-                // Mp.java
-                String entityName = tableInfo.getEntityName();
-                if (null != entityName && null != pathInfo.get(ConstVal.ENTITY_PATH)) {
-                    String entityFile = String.format((pathInfo.get(ConstVal.ENTITY_PATH) + File.separator + "%s" + suffixJavaOrKt()), entityName);
-                    if (isCreate(FileType.ENTITY, entityFile)) {
-                        writerFile(objectMap, templateFilePath(template.getEntity(getConfigBuilder().getGlobalConfig().isKotlin())), entityFile);
-                    }
-                }
-                // MpMapper.java
-                if (null != tableInfo.getMapperName() && null != pathInfo.get(ConstVal.MAPPER_PATH)) {
-                    String mapperFile = String.format((pathInfo.get(ConstVal.MAPPER_PATH) + File.separator + tableInfo.getMapperName() + suffixJavaOrKt()), entityName);
-                    if (isCreate(FileType.MAPPER, mapperFile)) {
-                        writerFile(objectMap, templateFilePath(template.getMapper()), mapperFile);
-                    }
-                }
-                // MpMapper.xml
-                if (null != tableInfo.getXmlName() && null != pathInfo.get(ConstVal.XML_PATH)) {
-                    String xmlFile = String.format((pathInfo.get(ConstVal.XML_PATH) + File.separator + tableInfo.getXmlName() + ConstVal.XML_SUFFIX), entityName);
-                    if (isCreate(FileType.XML, xmlFile)) {
-                        writerFile(objectMap, templateFilePath(template.getXml()), xmlFile);
-                    }
-                }
-                // IMpService.java
-                if (null != tableInfo.getServiceName() && null != pathInfo.get(ConstVal.SERVICE_PATH)) {
-                    String serviceFile = String.format((pathInfo.get(ConstVal.SERVICE_PATH) + File.separator + tableInfo.getServiceName() + suffixJavaOrKt()), entityName);
-                    if (isCreate(FileType.SERVICE, serviceFile)) {
-                        writerFile(objectMap, templateFilePath(template.getService()), serviceFile);
-                    }
-                }
-                // MpServiceImpl.java
-                if (null != tableInfo.getServiceImplName() && null != pathInfo.get(ConstVal.SERVICE_IMPL_PATH)) {
-                    String implFile = String.format((pathInfo.get(ConstVal.SERVICE_IMPL_PATH) + File.separator + tableInfo.getServiceImplName() + suffixJavaOrKt()), entityName);
-                    if (isCreate(FileType.SERVICE_IMPL, implFile)) {
-                        writerFile(objectMap, templateFilePath(template.getServiceImpl()), implFile);
-                    }
-                }
-                // MpController.java
-                if (null != tableInfo.getControllerName() && null != pathInfo.get(ConstVal.CONTROLLER_PATH)) {
-                    String controllerFile = String.format((pathInfo.get(ConstVal.CONTROLLER_PATH) + File.separator + tableInfo.getControllerName() + suffixJavaOrKt()), entityName);
-                    if (isCreate(FileType.CONTROLLER, controllerFile)) {
-                        writerFile(objectMap, templateFilePath(template.getController()), controllerFile);
-                    }
-                }
-            }
-        } catch (Exception e) {
-            logger.error("无法创建文件,请检查配置信息!", e);
-        }
-        return this;
-    }
-
-    protected void writerFile(Map<String, Object> objectMap, String templatePath, String outputFile) throws Exception {
-        if (StringUtils.isNotBlank(templatePath)) this.writer(objectMap, templatePath, outputFile);
-    }
-
-    /**
-     * 将模板转化成为文件
-     *
-     * @param objectMap    渲染对象 MAP 信息
-     * @param templatePath 模板文件
-     * @param outputFile   文件生成的目录
-     */
-    public abstract void writer(Map<String, Object> objectMap, String templatePath, String outputFile) throws Exception;
-
-    /**
-     * 处理输出目录
-     */
-    public AbstractTemplateEngine mkdirs() {
-        getConfigBuilder().getPathInfo().forEach((key, value) -> {
-            File dir = new File(value);
-            if (!dir.exists()) {
-                boolean result = dir.mkdirs();
-                if (result) {
-                    logger.debug("创建目录: [" + value + "]");
-                }
-            }
-        });
-        return this;
-    }
-
-
-    /**
-     * 打开输出目录
-     */
-    public void open() {
-        String outDir = getConfigBuilder().getGlobalConfig().getOutputDir();
-        if (getConfigBuilder().getGlobalConfig().isOpen()
-            && StringUtils.isNotBlank(outDir)) {
-            try {
-                String osName = System.getProperty("os.name");
-                if (osName != null) {
-                    if (osName.contains("Mac")) {
-                        Runtime.getRuntime().exec("open " + outDir);
-                    } else if (osName.contains("Windows")) {
-                        Runtime.getRuntime().exec("cmd /c start " + outDir);
-                    } else {
-                        logger.debug("文件输出目录:" + outDir);
-                    }
-                }
-            } catch (IOException e) {
-                e.printStackTrace();
-            }
-        }
-    }
-
-
-    /**
-     * 渲染对象 MAP 信息
-     *
-     * @param tableInfo 表信息对象
-     * @return ignore
-     */
-    public Map<String, Object> getObjectMap(TableInfo tableInfo) {
-        Map<String, Object> objectMap;
-        ConfigBuilder config = getConfigBuilder();
-        if (config.getStrategyConfig().isControllerMappingHyphenStyle()) {
-            objectMap = CollectionUtils.newHashMapWithExpectedSize(33);
-            objectMap.put("controllerMappingHyphenStyle", config.getStrategyConfig().isControllerMappingHyphenStyle());
-            objectMap.put("controllerMappingHyphen", StringUtils.camelToHyphen(tableInfo.getEntityPath()));
-        } else {
-            objectMap = CollectionUtils.newHashMapWithExpectedSize(31);
-        }
-        objectMap.put("restControllerStyle", config.getStrategyConfig().isRestControllerStyle());
-        objectMap.put("config", config);
-        objectMap.put("package", config.getPackageInfo());
-        GlobalConfig globalConfig = config.getGlobalConfig();
-        objectMap.put("author", globalConfig.getAuthor());
-        objectMap.put("idType", globalConfig.getIdType() == null ? null : globalConfig.getIdType().toString());
-        objectMap.put("logicDeleteFieldName", config.getStrategyConfig().getLogicDeleteFieldName());
-        objectMap.put("versionFieldName", config.getStrategyConfig().getVersionFieldName());
-        objectMap.put("activeRecord", globalConfig.isActiveRecord());
-        objectMap.put("kotlin", globalConfig.isKotlin());
-        objectMap.put("swagger2", globalConfig.isSwagger2());
-        objectMap.put("date", new SimpleDateFormat("yyyy-MM-dd").format(new Date()));
-        objectMap.put("table", tableInfo);
-        objectMap.put("enableCache", globalConfig.isEnableCache());
-        objectMap.put("baseResultMap", globalConfig.isBaseResultMap());
-        objectMap.put("baseColumnList", globalConfig.isBaseColumnList());
-        objectMap.put("entity", tableInfo.getEntityName());
-        objectMap.put("entitySerialVersionUID", config.getStrategyConfig().isEntitySerialVersionUID());
-        objectMap.put("entityColumnConstant", config.getStrategyConfig().isEntityColumnConstant());
-        objectMap.put("entityBuilderModel", config.getStrategyConfig().isEntityBuilderModel());
-        objectMap.put("chainModel", config.getStrategyConfig().isChainModel());
-        objectMap.put("entityLombokModel", config.getStrategyConfig().isEntityLombokModel());
-        objectMap.put("entityBooleanColumnRemoveIsPrefix", config.getStrategyConfig().isEntityBooleanColumnRemoveIsPrefix());
-        objectMap.put("superEntityClass", getSuperClassName(config.getStrategyConfig().getSuperEntityClass()));
-        objectMap.put("superMapperClassPackage", config.getStrategyConfig().getSuperMapperClass());
-        objectMap.put("superMapperClass", getSuperClassName(config.getStrategyConfig().getSuperMapperClass()));
-        objectMap.put("superServiceClassPackage", config.getStrategyConfig().getSuperServiceClass());
-        objectMap.put("superServiceClass", getSuperClassName(config.getStrategyConfig().getSuperServiceClass()));
-        objectMap.put("superServiceImplClassPackage", config.getStrategyConfig().getSuperServiceImplClass());
-        objectMap.put("superServiceImplClass", getSuperClassName(config.getStrategyConfig().getSuperServiceImplClass()));
-        objectMap.put("superControllerClassPackage", verifyClassPacket(config.getStrategyConfig().getSuperControllerClass()));
-        objectMap.put("superControllerClass", getSuperClassName(config.getStrategyConfig().getSuperControllerClass()));
-        return Objects.isNull(config.getInjectionConfig()) ? objectMap : config.getInjectionConfig().prepareObjectMap(objectMap);
-    }
-
-    /**
-     * 用于渲染对象MAP信息 {@link #getObjectMap(TableInfo)} 时的superClassPacket非空校验
-     *
-     * @param classPacket ignore
-     * @return ignore
-     */
-    private String verifyClassPacket(String classPacket) {
-        return StringUtils.isBlank(classPacket) ? null : classPacket;
-    }
-
-    /**
-     * 获取类名
-     *
-     * @param classPath ignore
-     * @return ignore
-     */
-    private String getSuperClassName(String classPath) {
-        if (StringUtils.isBlank(classPath)) {
-            return null;
-        }
-        return classPath.substring(classPath.lastIndexOf(StringPool.DOT) + 1);
-    }
-
-
-    /**
-     * 模板真实文件路径
-     *
-     * @param filePath 文件路径
-     * @return ignore
-     */
-    public abstract String templateFilePath(String filePath);
-
-
-    /**
-     * 检测文件是否存在
-     *
-     * @return 文件是否存在
-     */
-    protected boolean isCreate(FileType fileType, String filePath) {
-        ConfigBuilder cb = getConfigBuilder();
-        // 自定义判断
-        InjectionConfig ic = cb.getInjectionConfig();
-        if (null != ic && null != ic.getFileCreate()) {
-            return ic.getFileCreate().isCreate(cb, fileType, filePath);
-        }
-        // 全局判断【默认】
-        File file = new File(filePath);
-        boolean exist = file.exists();
-        if (!exist) {
-            file.getParentFile().mkdirs();
-        }
-        return !exist || getConfigBuilder().getGlobalConfig().isFileOverride();
-    }
-
-    /**
-     * 文件后缀
-     */
-    protected String suffixJavaOrKt() {
-        return getConfigBuilder().getGlobalConfig().isKotlin() ? ConstVal.KT_SUFFIX : ConstVal.JAVA_SUFFIX;
-    }
-
-
-    public ConfigBuilder getConfigBuilder() {
-        return configBuilder;
-    }
-
-    public AbstractTemplateEngine setConfigBuilder(ConfigBuilder configBuilder) {
-        this.configBuilder = configBuilder;
-        return this;
-    }
-}

+ 0 - 80
mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/engine/BeetlTemplateEngine.java

@@ -1,80 +0,0 @@
-/*
- * Copyright (c) 2011-2020, baomidou (jobob@qq.com).
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.baomidou.mybatisplus.generator.engine;
-
-import com.baomidou.mybatisplus.generator.config.builder.ConfigBuilder;
-import org.beetl.core.Configuration;
-import org.beetl.core.GroupTemplate;
-import org.beetl.core.Template;
-import org.beetl.core.resource.ClasspathResourceLoader;
-
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.lang.reflect.Method;
-import java.util.Map;
-
-/**
- * Beetl 模板引擎实现文件输出
- *
- * @author yandixuan
- * @since 2018-12-16
- */
-public class BeetlTemplateEngine extends AbstractTemplateEngine {
-
-    private static Method method;
-
-    static {
-        try {
-            method = GroupTemplate.class.getDeclaredMethod("getTemplate", Object.class);
-        } catch (NoSuchMethodException e) {
-            try {
-                //3.2.x 方法签名修改成了object,其他低版本为string
-                method = GroupTemplate.class.getDeclaredMethod("getTemplate", String.class);
-            } catch (NoSuchMethodException exception) {
-                throw new RuntimeException(exception);
-            }
-        }
-    }
-
-    private GroupTemplate groupTemplate;
-
-    @Override
-    public AbstractTemplateEngine init(ConfigBuilder configBuilder) {
-        super.init(configBuilder);
-        try {
-            Configuration cfg = Configuration.defaultConfiguration();
-            groupTemplate = new GroupTemplate(new ClasspathResourceLoader("/"), cfg);
-        } catch (IOException e) {
-            logger.error(e.getMessage(), e);
-        }
-        return this;
-    }
-
-    @Override
-    public void writer(Map<String, Object> objectMap, String templatePath, String outputFile) throws Exception {
-        Template template = (Template) method.invoke(groupTemplate, templatePath);
-        try (FileOutputStream fileOutputStream = new FileOutputStream(outputFile)) {
-            template.binding(objectMap);
-            template.renderTo(fileOutputStream);
-        }
-        logger.debug("模板:" + templatePath + ";  文件:" + outputFile);
-    }
-
-    @Override
-    public String templateFilePath(String filePath) {
-        return filePath + ".btl";
-    }
-}

+ 0 - 62
mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/engine/FreemarkerTemplateEngine.java

@@ -1,62 +0,0 @@
-/*
- * Copyright (c) 2011-2020, baomidou (jobob@qq.com).
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.baomidou.mybatisplus.generator.engine;
-
-import com.baomidou.mybatisplus.core.toolkit.StringPool;
-import com.baomidou.mybatisplus.generator.config.ConstVal;
-import com.baomidou.mybatisplus.generator.config.builder.ConfigBuilder;
-import freemarker.template.Configuration;
-import freemarker.template.Template;
-
-import java.io.FileOutputStream;
-import java.io.OutputStreamWriter;
-import java.util.Map;
-
-/**
- * Freemarker 模板引擎实现文件输出
- *
- * @author nieqiurong
- * @since 2018-01-11
- */
-public class FreemarkerTemplateEngine extends AbstractTemplateEngine {
-
-    private Configuration configuration;
-
-    @Override
-    public FreemarkerTemplateEngine init(ConfigBuilder configBuilder) {
-        super.init(configBuilder);
-        configuration = new Configuration(Configuration.DEFAULT_INCOMPATIBLE_IMPROVEMENTS);
-        configuration.setDefaultEncoding(ConstVal.UTF8);
-        configuration.setClassForTemplateLoading(FreemarkerTemplateEngine.class, StringPool.SLASH);
-        return this;
-    }
-
-
-    @Override
-    public void writer(Map<String, Object> objectMap, String templatePath, String outputFile) throws Exception {
-        Template template = configuration.getTemplate(templatePath);
-        try (FileOutputStream fileOutputStream = new FileOutputStream(outputFile)) {
-            template.process(objectMap, new OutputStreamWriter(fileOutputStream, ConstVal.UTF8));
-        }
-        logger.debug("模板:" + templatePath + ";  文件:" + outputFile);
-    }
-
-
-    @Override
-    public String templateFilePath(String filePath) {
-        return filePath + ".ftl";
-    }
-}

+ 0 - 78
mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/engine/VelocityTemplateEngine.java

@@ -1,78 +0,0 @@
-/*
- * Copyright (c) 2011-2020, baomidou (jobob@qq.com).
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.baomidou.mybatisplus.generator.engine;
-
-import com.baomidou.mybatisplus.core.toolkit.StringPool;
-import com.baomidou.mybatisplus.generator.config.ConstVal;
-import com.baomidou.mybatisplus.generator.config.builder.ConfigBuilder;
-import org.apache.velocity.Template;
-import org.apache.velocity.VelocityContext;
-import org.apache.velocity.app.Velocity;
-import org.apache.velocity.app.VelocityEngine;
-
-import java.io.BufferedWriter;
-import java.io.FileOutputStream;
-import java.io.OutputStreamWriter;
-import java.util.Map;
-import java.util.Properties;
-
-/**
- * Velocity 模板引擎实现文件输出
- *
- * @author hubin
- * @since 2018-01-10
- */
-public class VelocityTemplateEngine extends AbstractTemplateEngine {
-
-    private static final String DOT_VM = ".vm";
-    private VelocityEngine velocityEngine;
-
-    @Override
-    public VelocityTemplateEngine init(ConfigBuilder configBuilder) {
-        super.init(configBuilder);
-        if (null == velocityEngine) {
-            Properties p = new Properties();
-            p.setProperty(ConstVal.VM_LOAD_PATH_KEY, ConstVal.VM_LOAD_PATH_VALUE);
-            p.setProperty(Velocity.FILE_RESOURCE_LOADER_PATH, StringPool.EMPTY);
-            p.setProperty(Velocity.ENCODING_DEFAULT, ConstVal.UTF8);
-            p.setProperty(Velocity.INPUT_ENCODING, ConstVal.UTF8);
-            p.setProperty("file.resource.loader.unicode", StringPool.TRUE);
-            velocityEngine = new VelocityEngine(p);
-        }
-        return this;
-    }
-
-
-    @Override
-    public void writer(Map<String, Object> objectMap, String templatePath, String outputFile) throws Exception {
-        Template template = velocityEngine.getTemplate(templatePath, ConstVal.UTF8);
-        try (FileOutputStream fos = new FileOutputStream(outputFile);
-             OutputStreamWriter ow = new OutputStreamWriter(fos, ConstVal.UTF8);
-             BufferedWriter writer = new BufferedWriter(ow)) {
-            template.merge(new VelocityContext(objectMap), writer);
-        }
-        logger.debug("模板:" + templatePath + ";  文件:" + outputFile);
-    }
-
-
-    @Override
-    public String templateFilePath(String filePath) {
-        if (null == filePath || filePath.contains(DOT_VM)) {
-            return filePath;
-        }
-        return filePath + DOT_VM;
-    }
-}

+ 0 - 45
mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/keywords/BaseKeyWordsHandler.java

@@ -1,45 +0,0 @@
-/*
- * Copyright (c) 2011-2020, baomidou (jobob@qq.com).
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.baomidou.mybatisplus.generator.keywords;
-
-import com.baomidou.mybatisplus.generator.config.IKeyWordsHandler;
-
-import java.util.List;
-import java.util.Locale;
-
-/**
- * 基类关键字处理
- *
- * @author nieqiurong 2020/5/8.
- * @since 3.3.2
- */
-public abstract class BaseKeyWordsHandler implements IKeyWordsHandler {
-    
-    public List<String> keyWords;
-    
-    public BaseKeyWordsHandler(List<String> keyWords) {
-        this.keyWords = keyWords;
-    }
-    
-    @Override
-    public List<String> getKeyWords() {
-        return keyWords;
-    }
-    
-    public boolean isKeyWords(String columnName) {
-        return getKeyWords().contains(columnName.toUpperCase(Locale.ENGLISH));
-    }
-}

+ 0 - 127
mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/keywords/H2KeyWordsHandler.java

@@ -1,127 +0,0 @@
-/*
- * Copyright (c) 2011-2020, baomidou (jobob@qq.com).
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.baomidou.mybatisplus.generator.keywords;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-/**
- * h2数据库关键字处理
- * http://www.h2database.com/html/advanced.html#keywords
- *
- * @author nieqiurong 2020/5/7.
- * @since 3.3.2
- */
-public class H2KeyWordsHandler extends BaseKeyWordsHandler {
-    
-    private static List<String> KEY_WORDS = new ArrayList<>(Arrays.asList(
-        "ALL",
-        "AND",
-        "ARRAY",
-        "AS",
-        "BETWEEN",
-        "BOTH",
-        "CASE",
-        "CHECK",
-        "CONSTRAINT",
-        "CROSS",
-        "CURRENT_CATALOG",
-        "CURRENT_DATE",
-        "CURRENT_SCHEMA",
-        "CURRENT_TIME",
-        "CURRENT_TIMESTAMP",
-        "CURRENT_USER",
-        "DISTINCT",
-        "EXCEPT",
-        "EXISTS",
-        "FALSE",
-        "FETCH",
-        "FILTER",
-        "FOR",
-        "FOREIGN",
-        "FROM",
-        "FULL",
-        "GROUP",
-        "GROUPS",
-        "HAVING",
-        "IF",
-        "ILIKE",
-        "IN",
-        "INNER",
-        "INTERSECT",
-        "INTERSECTS",
-        "INTERVAL",
-        "IS",
-        "JOIN",
-        "LEADING",
-        "LEFT",
-        "LIKE",
-        "LIMIT",
-        "LOCALTIME",
-        "LOCALTIMESTAMP",
-        "MINUS",
-        "NATURAL",
-        "NOT",
-        "NULL",
-        "OFFSET",
-        "ON",
-        "OR",
-        "ORDER",
-        "OVER",
-        "PARTITION",
-        "PRIMARY",
-        "QUALIFY",
-        "RANGE",
-        "REGEXP",
-        "RIGHT",
-        "ROW",
-        "_ROWID_",
-        "ROWNUM",
-        "ROWS",
-        "SELECT",
-        "SYSDATE",
-        "SYSTIME",
-        "SYSTIMESTAMP",
-        "TABLE",
-        "TODAY",
-        "TOP",
-        "TRAILING",
-        "TRUE",
-        "UNION",
-        "UNIQUE",
-        "UNKNOWN",
-        "USING",
-        "VALUES",
-        "WHERE",
-        "WINDOW",
-        "WITH"
-    ));
-    
-    public H2KeyWordsHandler() {
-        super(KEY_WORDS);
-    }
-    
-    public H2KeyWordsHandler(List<String> keyWords) {
-        super(keyWords);
-    }
-    
-    @Override
-    public String formatStyle() {
-        return "\"%s\"";
-    }
-    
-}

+ 0 - 668
mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/keywords/MySqlKeyWordsHandler.java

@@ -1,668 +0,0 @@
-/*
- * Copyright (c) 2011-2020, baomidou (jobob@qq.com).
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.baomidou.mybatisplus.generator.keywords;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-/**
- * mysql关键字处理
- * 这里选取了mysql5.7文档中的关键字和保留字(含移除)https://dev.mysql.com/doc/refman/5.7/en/keywords.html
- *
- * @author nieqiurong 2020/5/7.
- * @since 3.3.2
- */
-public class MySqlKeyWordsHandler extends BaseKeyWordsHandler {
-    
-    private static List<String> KEY_WORDS = new ArrayList<>(Arrays.asList(
-        "ACCESSIBLE",
-        "ACCOUNT",
-        "ACTION",
-        "ADD",
-        "AFTER",
-        "AGAINST",
-        "AGGREGATE",
-        "ALGORITHM",
-        "ALL",
-        "ALTER",
-        "ALWAYS",
-        "ANALYSE",
-        "ANALYZE",
-        "AND",
-        "ANY",
-        "AS",
-        "ASC",
-        "ASCII",
-        "ASENSITIVE",
-        "AT",
-        "AUTOEXTEND_SIZE",
-        "AUTO_INCREMENT",
-        "AVG",
-        "AVG_ROW_LENGTH",
-        "BACKUP",
-        "BEFORE",
-        "BEGIN",
-        "BETWEEN",
-        "BIGINT",
-        "BINARY",
-        "BINLOG",
-        "BIT",
-        "BLOB",
-        "BLOCK",
-        "BOOL",
-        "BOOLEAN",
-        "BOTH",
-        "BTREE",
-        "BY",
-        "BYTE",
-        "CACHE",
-        "CALL",
-        "CASCADE",
-        "CASCADED",
-        "CASE",
-        "CATALOG_NAME",
-        "CHAIN",
-        "CHANGE",
-        "CHANGED",
-        "CHANNEL",
-        "CHAR",
-        "CHARACTER",
-        "CHARSET",
-        "CHECK",
-        "CHECKSUM",
-        "CIPHER",
-        "CLASS_ORIGIN",
-        "CLIENT",
-        "CLOSE",
-        "COALESCE",
-        "CODE",
-        "COLLATE",
-        "COLLATION",
-        "COLUMN",
-        "COLUMNS",
-        "COLUMN_FORMAT",
-        "COLUMN_NAME",
-        "COMMENT",
-        "COMMIT",
-        "COMMITTED",
-        "COMPACT",
-        "COMPLETION",
-        "COMPRESSED",
-        "COMPRESSION",
-        "CONCURRENT",
-        "CONDITION",
-        "CONNECTION",
-        "CONSISTENT",
-        "CONSTRAINT",
-        "CONSTRAINT_CATALOG",
-        "CONSTRAINT_NAME",
-        "CONSTRAINT_SCHEMA",
-        "CONTAINS",
-        "CONTEXT",
-        "CONTINUE",
-        "CONVERT",
-        "CPU",
-        "CREATE",
-        "CROSS",
-        "CUBE",
-        "CURRENT",
-        "CURRENT_DATE",
-        "CURRENT_TIME",
-        "CURRENT_TIMESTAMP",
-        "CURRENT_USER",
-        "CURSOR",
-        "CURSOR_NAME",
-        "DATA",
-        "DATABASE",
-        "DATABASES",
-        "DATAFILE",
-        "DATE",
-        "DATETIME",
-        "DAY",
-        "DAY_HOUR",
-        "DAY_MICROSECOND",
-        "DAY_MINUTE",
-        "DAY_SECOND",
-        "DEALLOCATE",
-        "DEC",
-        "DECIMAL",
-        "DECLARE",
-        "DEFAULT",
-        "DEFAULT_AUTH",
-        "DEFINER",
-        "DELAYED",
-        "DELAY_KEY_WRITE",
-        "DELETE",
-        "DESC",
-        "DESCRIBE",
-        "DES_KEY_FILE",
-        "DETERMINISTIC",
-        "DIAGNOSTICS",
-        "DIRECTORY",
-        "DISABLE",
-        "DISCARD",
-        "DISK",
-        "DISTINCT",
-        "DISTINCTROW",
-        "DIV",
-        "DO",
-        "DOUBLE",
-        "DROP",
-        "DUAL",
-        "DUMPFILE",
-        "DUPLICATE",
-        "DYNAMIC",
-        "EACH",
-        "ELSE",
-        "ELSEIF",
-        "ENABLE",
-        "ENCLOSED",
-        "ENCRYPTION",
-        "END",
-        "ENDS",
-        "ENGINE",
-        "ENGINES",
-        "ENUM",
-        "ERROR",
-        "ERRORS",
-        "ESCAPE",
-        "ESCAPED",
-        "EVENT",
-        "EVENTS",
-        "EVERY",
-        "EXCHANGE",
-        "EXECUTE",
-        "EXISTS",
-        "EXIT",
-        "EXPANSION",
-        "EXPIRE",
-        "EXPLAIN",
-        "EXPORT",
-        "EXTENDED",
-        "EXTENT_SIZE",
-        "FALSE",
-        "FAST",
-        "FAULTS",
-        "FETCH",
-        "FIELDS",
-        "FILE",
-        "FILE_BLOCK_SIZE",
-        "FILTER",
-        "FIRST",
-        "FIXED",
-        "FLOAT",
-        "FLOAT4",
-        "FLOAT8",
-        "FLUSH",
-        "FOLLOWS",
-        "FOR",
-        "FORCE",
-        "FOREIGN",
-        "FORMAT",
-        "FOUND",
-        "FROM",
-        "FULL",
-        "FULLTEXT",
-        "FUNCTION",
-        "GENERAL",
-        "GENERATED",
-        "GEOMETRY",
-        "GEOMETRYCOLLECTION",
-        "GET",
-        "GET_FORMAT",
-        "GLOBAL",
-        "GRANT",
-        "GRANTS",
-        "GROUP",
-        "GROUP_REPLICATION",
-        "HANDLER",
-        "HASH",
-        "HAVING",
-        "HELP",
-        "HIGH_PRIORITY",
-        "HOST",
-        "HOSTS",
-        "HOUR",
-        "HOUR_MICROSECOND",
-        "HOUR_MINUTE",
-        "HOUR_SECOND",
-        "IDENTIFIED",
-        "IF",
-        "IGNORE",
-        "IGNORE_SERVER_IDS",
-        "IMPORT",
-        "IN",
-        "INDEX",
-        "INDEXES",
-        "INFILE",
-        "INITIAL_SIZE",
-        "INNER",
-        "INOUT",
-        "INSENSITIVE",
-        "INSERT",
-        "INSERT_METHOD",
-        "INSTALL",
-        "INSTANCE",
-        "INT",
-        "INT1",
-        "INT2",
-        "INT3",
-        "INT4",
-        "INT8",
-        "INTEGER",
-        "INTERVAL",
-        "INTO",
-        "INVOKER",
-        "IO",
-        "IO_AFTER_GTIDS",
-        "IO_BEFORE_GTIDS",
-        "IO_THREAD",
-        "IPC",
-        "IS",
-        "ISOLATION",
-        "ISSUER",
-        "ITERATE",
-        "JOIN",
-        "JSON",
-        "KEY",
-        "KEYS",
-        "KEY_BLOCK_SIZE",
-        "KILL",
-        "LANGUAGE",
-        "LAST",
-        "LEADING",
-        "LEAVE",
-        "LEAVES",
-        "LEFT",
-        "LESS",
-        "LEVEL",
-        "LIKE",
-        "LIMIT",
-        "LINEAR",
-        "LINES",
-        "LINESTRING",
-        "LIST",
-        "LOAD",
-        "LOCAL",
-        "LOCALTIME",
-        "LOCALTIMESTAMP",
-        "LOCK",
-        "LOCKS",
-        "LOGFILE",
-        "LOGS",
-        "LONG",
-        "LONGBLOB",
-        "LONGTEXT",
-        "LOOP",
-        "LOW_PRIORITY",
-        "MASTER",
-        "MASTER_AUTO_POSITION",
-        "MASTER_BIND",
-        "MASTER_CONNECT_RETRY",
-        "MASTER_DELAY",
-        "MASTER_HEARTBEAT_PERIOD",
-        "MASTER_HOST",
-        "MASTER_LOG_FILE",
-        "MASTER_LOG_POS",
-        "MASTER_PASSWORD",
-        "MASTER_PORT",
-        "MASTER_RETRY_COUNT",
-        "MASTER_SERVER_ID",
-        "MASTER_SSL",
-        "MASTER_SSL_CA",
-        "MASTER_SSL_CAPATH",
-        "MASTER_SSL_CERT",
-        "MASTER_SSL_CIPHER",
-        "MASTER_SSL_CRL",
-        "MASTER_SSL_CRLPATH",
-        "MASTER_SSL_KEY",
-        "MASTER_SSL_VERIFY_SERVER_CERT",
-        "MASTER_TLS_VERSION",
-        "MASTER_USER",
-        "MATCH",
-        "MAXVALUE",
-        "MAX_CONNECTIONS_PER_HOUR",
-        "MAX_QUERIES_PER_HOUR",
-        "MAX_ROWS",
-        "MAX_SIZE",
-        "MAX_STATEMENT_TIME",
-        "MAX_UPDATES_PER_HOUR",
-        "MAX_USER_CONNECTIONS",
-        "MEDIUM",
-        "MEDIUMBLOB",
-        "MEDIUMINT",
-        "MEDIUMTEXT",
-        "MEMORY",
-        "MERGE",
-        "MESSAGE_TEXT",
-        "MICROSECOND",
-        "MIDDLEINT",
-        "MIGRATE",
-        "MINUTE",
-        "MINUTE_MICROSECOND",
-        "MINUTE_SECOND",
-        "MIN_ROWS",
-        "MOD",
-        "MODE",
-        "MODIFIES",
-        "MODIFY",
-        "MONTH",
-        "MULTILINESTRING",
-        "MULTIPOINT",
-        "MULTIPOLYGON",
-        "MUTEX",
-        "MYSQL_ERRNO",
-        "NAME",
-        "NAMES",
-        "NATIONAL",
-        "NATURAL",
-        "NCHAR",
-        "NDB",
-        "NDBCLUSTER",
-        "NEVER",
-        "NEW",
-        "NEXT",
-        "NO",
-        "NODEGROUP",
-        "NONBLOCKING",
-        "NONE",
-        "NOT",
-        "NO_WAIT",
-        "NO_WRITE_TO_BINLOG",
-        "NULL",
-        "NUMBER",
-        "NUMERIC",
-        "NVARCHAR",
-        "OFFSET",
-        "OLD_PASSWORD",
-        "ON",
-        "ONE",
-        "ONLY",
-        "OPEN",
-        "OPTIMIZE",
-        "OPTIMIZER_COSTS",
-        "OPTION",
-        "OPTIONALLY",
-        "OPTIONS",
-        "OR",
-        "ORDER",
-        "OUT",
-        "OUTER",
-        "OUTFILE",
-        "OWNER",
-        "PACK_KEYS",
-        "PAGE",
-        "PARSER",
-        "PARSE_GCOL_EXPR",
-        "PARTIAL",
-        "PARTITION",
-        "PARTITIONING",
-        "PARTITIONS",
-        "PASSWORD",
-        "PHASE",
-        "PLUGIN",
-        "PLUGINS",
-        "PLUGIN_DIR",
-        "POINT",
-        "POLYGON",
-        "PORT",
-        "PRECEDES",
-        "PRECISION",
-        "PREPARE",
-        "PRESERVE",
-        "PREV",
-        "PRIMARY",
-        "PRIVILEGES",
-        "PROCEDURE",
-        "PROCESSLIST",
-        "PROFILE",
-        "PROFILES",
-        "PROXY",
-        "PURGE",
-        "QUARTER",
-        "QUERY",
-        "QUICK",
-        "RANGE",
-        "READ",
-        "READS",
-        "READ_ONLY",
-        "READ_WRITE",
-        "REAL",
-        "REBUILD",
-        "RECOVER",
-        "REDOFILE",
-        "REDO_BUFFER_SIZE",
-        "REDUNDANT",
-        "REFERENCES",
-        "REGEXP",
-        "RELAY",
-        "RELAYLOG",
-        "RELAY_LOG_FILE",
-        "RELAY_LOG_POS",
-        "RELAY_THREAD",
-        "RELEASE",
-        "RELOAD",
-        "REMOVE",
-        "RENAME",
-        "REORGANIZE",
-        "REPAIR",
-        "REPEAT",
-        "REPEATABLE",
-        "REPLACE",
-        "REPLICATE_DO_DB",
-        "REPLICATE_DO_TABLE",
-        "REPLICATE_IGNORE_DB",
-        "REPLICATE_IGNORE_TABLE",
-        "REPLICATE_REWRITE_DB",
-        "REPLICATE_WILD_DO_TABLE",
-        "REPLICATE_WILD_IGNORE_TABLE",
-        "REPLICATION",
-        "REQUIRE",
-        "RESET",
-        "RESIGNAL",
-        "RESTORE",
-        "RESTRICT",
-        "RESUME",
-        "RETURN",
-        "RETURNED_SQLSTATE",
-        "RETURNS",
-        "REVERSE",
-        "REVOKE",
-        "RIGHT",
-        "RLIKE",
-        "ROLLBACK",
-        "ROLLUP",
-        "ROTATE",
-        "ROUTINE",
-        "ROW",
-        "ROWS",
-        "ROW_COUNT",
-        "ROW_FORMAT",
-        "RTREE",
-        "SAVEPOINT",
-        "SCHEDULE",
-        "SCHEMA",
-        "SCHEMAS",
-        "SCHEMA_NAME",
-        "SECOND",
-        "SECOND_MICROSECOND",
-        "SECURITY",
-        "SELECT",
-        "SENSITIVE",
-        "SEPARATOR",
-        "SERIAL",
-        "SERIALIZABLE",
-        "SERVER",
-        "SESSION",
-        "SET",
-        "SHARE",
-        "SHOW",
-        "SHUTDOWN",
-        "SIGNAL",
-        "SIGNED",
-        "SIMPLE",
-        "SLAVE",
-        "SLOW",
-        "SMALLINT",
-        "SNAPSHOT",
-        "SOCKET",
-        "SOME",
-        "SONAME",
-        "SOUNDS",
-        "SOURCE",
-        "SPATIAL",
-        "SPECIFIC",
-        "SQL",
-        "SQLEXCEPTION",
-        "SQLSTATE",
-        "SQLWARNING",
-        "SQL_AFTER_GTIDS",
-        "SQL_AFTER_MTS_GAPS",
-        "SQL_BEFORE_GTIDS",
-        "SQL_BIG_RESULT",
-        "SQL_BUFFER_RESULT",
-        "SQL_CACHE",
-        "SQL_CALC_FOUND_ROWS",
-        "SQL_NO_CACHE",
-        "SQL_SMALL_RESULT",
-        "SQL_THREAD",
-        "SQL_TSI_DAY",
-        "SQL_TSI_HOUR",
-        "SQL_TSI_MINUTE",
-        "SQL_TSI_MONTH",
-        "SQL_TSI_QUARTER",
-        "SQL_TSI_SECOND",
-        "SQL_TSI_WEEK",
-        "SQL_TSI_YEAR",
-        "SSL",
-        "STACKED",
-        "START",
-        "STARTING",
-        "STARTS",
-        "STATS_AUTO_RECALC",
-        "STATS_PERSISTENT",
-        "STATS_SAMPLE_PAGES",
-        "STATUS",
-        "STOP",
-        "STORAGE",
-        "STORED",
-        "STRAIGHT_JOIN",
-        "STRING",
-        "SUBCLASS_ORIGIN",
-        "SUBJECT",
-        "SUBPARTITION",
-        "SUBPARTITIONS",
-        "SUPER",
-        "SUSPEND",
-        "SWAPS",
-        "SWITCHES",
-        "TABLE",
-        "TABLES",
-        "TABLESPACE",
-        "TABLE_CHECKSUM",
-        "TABLE_NAME",
-        "TEMPORARY",
-        "TEMPTABLE",
-        "TERMINATED",
-        "TEXT",
-        "THAN",
-        "THEN",
-        "TIME",
-        "TIMESTAMP",
-        "TIMESTAMPADD",
-        "TIMESTAMPDIFF",
-        "TINYBLOB",
-        "TINYINT",
-        "TINYTEXT",
-        "TO",
-        "TRAILING",
-        "TRANSACTION",
-        "TRIGGER",
-        "TRIGGERS",
-        "TRUE",
-        "TRUNCATE",
-        "TYPE",
-        "TYPES",
-        "UNCOMMITTED",
-        "UNDEFINED",
-        "UNDO",
-        "UNDOFILE",
-        "UNDO_BUFFER_SIZE",
-        "UNICODE",
-        "UNINSTALL",
-        "UNION",
-        "UNIQUE",
-        "UNKNOWN",
-        "UNLOCK",
-        "UNSIGNED",
-        "UNTIL",
-        "UPDATE",
-        "UPGRADE",
-        "USAGE",
-        "USE",
-        "USER",
-        "USER_RESOURCES",
-        "USE_FRM",
-        "USING",
-        "UTC_DATE",
-        "UTC_TIME",
-        "UTC_TIMESTAMP",
-        "VALIDATION",
-        "VALUE",
-        "VALUES",
-        "VARBINARY",
-        "VARCHAR",
-        "VARCHARACTER",
-        "VARIABLES",
-        "VARYING",
-        "VIEW",
-        "VIRTUAL",
-        "WAIT",
-        "WARNINGS",
-        "WEEK",
-        "WEIGHT_STRING",
-        "WHEN",
-        "WHERE",
-        "WHILE",
-        "WITH",
-        "WITHOUT",
-        "WORK",
-        "WRAPPER",
-        "WRITE",
-        "X509",
-        "XA",
-        "XID",
-        "XML",
-        "XOR",
-        "YEAR",
-        "YEAR_MONTH",
-        "ZEROFILL"));
-    
-    public MySqlKeyWordsHandler() {
-        super(KEY_WORDS);
-    }
-    
-    public MySqlKeyWordsHandler(List<String> keyWords) {
-        super(keyWords);
-    }
-    
-    @Override
-    public String formatStyle() {
-        return "`%s`";
-    }
-    
-}

+ 0 - 147
mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/keywords/PostgreSqlKeyWordsHandler.java

@@ -1,147 +0,0 @@
-/*
- * Copyright (c) 2011-2020, baomidou (jobob@qq.com).
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.baomidou.mybatisplus.generator.keywords;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-/**
- * postgresql关键字处理
- * https://www.postgresql.org/docs/11/sql-keywords-appendix.html
- *
- * @author nieqiurong 2020/5/9.
- * @since 3.3.2
- */
-public class PostgreSqlKeyWordsHandler extends BaseKeyWordsHandler {
-    
-    private static List<String> KEY_WORDS = new ArrayList<>(Arrays.asList(
-        "ALL",
-        "ANALYSE",
-        "ANALYZE",
-        "AND",
-        "ANY",
-        "ARRAY",
-        "AS",
-        "ASC",
-        "ASYMMETRIC",
-        "AUTHORIZATION",
-        "BINARY",
-        "BOTH",
-        "CASE",
-        "CAST",
-        "CHECK",
-        "COLLATE",
-        "COLLATION",
-        "COLUMN",
-        "CONCURRENTLY",
-        "CONSTRAINT",
-        "CREATE",
-        "CROSS",
-        "CURRENT_CATALOG",
-        "CURRENT_DATE",
-        "CURRENT_ROLE",
-        "CURRENT_SCHEMA",
-        "CURRENT_TIME",
-        "CURRENT_TIMESTAMP",
-        "CURRENT_USER",
-        "DEFAULT",
-        "DEFERRABLE",
-        "DESC",
-        "DISTINCT",
-        "DO",
-        "ELSE",
-        "END",
-        "EXCEPT",
-        "FALSE",
-        "FETCH",
-        "FOR",
-        "FOREIGN",
-        "FREEZE",
-        "FROM",
-        "FULL",
-        "GRANT",
-        "GROUP",
-        "HAVING",
-        "ILIKE",
-        "IN",
-        "INITIALLY",
-        "INNER",
-        "INTERSECT",
-        "INTO",
-        "IS",
-        "ISNULL",
-        "JOIN",
-        "LATERAL",
-        "LEADING",
-        "LEFT",
-        "LIKE",
-        "LIMIT",
-        "LOCALTIME",
-        "LOCALTIMESTAMP",
-        "NATURAL",
-        "NOT",
-        "NOTNULL",
-        "NULL",
-        "OFFSET",
-        "ON",
-        "ONLY",
-        "OR",
-        "ORDER",
-        "OUTER",
-        "OVERLAPS",
-        "PLACING",
-        "PRIMARY",
-        "REFERENCES",
-        "RETURNING",
-        "RIGHT",
-        "SELECT",
-        "SESSION_USER",
-        "SIMILAR",
-        "SOME",
-        "SYMMETRIC",
-        "TABLE",
-        "TABLESAMPLE",
-        "THEN",
-        "TO",
-        "TRAILING",
-        "TRUE",
-        "UNION",
-        "UNIQUE",
-        "USER",
-        "USING",
-        "VARIADIC",
-        "VERBOSE",
-        "WHEN",
-        "WHERE",
-        "WINDOW",
-        "WITH"
-    ));
-    
-    public PostgreSqlKeyWordsHandler() {
-        super(KEY_WORDS);
-    }
-    
-    public PostgreSqlKeyWordsHandler(List<String> keyWords) {
-        super(keyWords);
-    }
-    
-    @Override
-    public String formatStyle() {
-        return "\"%s\"";
-    }
-    
-}

+ 0 - 23
mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/keywords/package-info.java

@@ -1,23 +0,0 @@
-/*
- * Copyright (c) 2011-2020, baomidou (jobob@qq.com).
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/**
- * 数据库关键字处理
- * 由于只是生成代码上简单使用,目前简单的实现一下。<br/>
- * 随着数据库版本的不同,关键字会有新增或移除,建议去查询对应数据库版本文档来制订关键字集合。
- *
- * @author nieqiurong 2020/5/8.
- */
-package com.baomidou.mybatisplus.generator.keywords;

+ 0 - 19
mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/package-info.java

@@ -1,19 +0,0 @@
-/*
- * Copyright (c) 2011-2020, baomidou (jobob@qq.com).
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/**
- * 代码生成器相关类
- */
-package com.baomidou.mybatisplus.generator;

+ 0 - 39
mybatis-plus-generator/src/main/resources/templates/controller.java.btl

@@ -1,39 +0,0 @@
-package ${package.Controller};
-
-
-import org.springframework.web.bind.annotation.RequestMapping;
-
-<% if(restControllerStyle){ %>
-import org.springframework.web.bind.annotation.RestController;
-<% }else{ %>
-import org.springframework.stereotype.Controller;
-<% } %>
-<% if(isNotEmpty(superControllerClassPackage)){ %>
-import ${superControllerClassPackage};
-<% } %>
-
-/**
- * <p>
- * ${table.comment!} 前端控制器
- * </p>
- *
- * @author ${author}
- * @since ${date}
- */
-<% if(restControllerStyle){ %>
-@RestController
-<% }else{ %>
-@Controller
-<% } %>
-@RequestMapping("<% if(isNotEmpty(package.ModuleName)){ %>/${package.ModuleName}<% } %>/<% if(isNotEmpty(controllerMappingHyphenStyle)){ %>${controllerMappingHyphen}<% }else{ %>${table.entityPath}<% } %>")
-<% if(kotlin){ %>
-class ${table.controllerName}<% if(isNotEmpty(superControllerClass)){ %> : ${superControllerClass}()<% } %>
-<% }else{ %>
-    <% if(isNotEmpty(superControllerClass)){ %>
-public class ${table.controllerName} extends ${superControllerClass} {
-    <% }else{ %>
-public class ${table.controllerName} {
-    <% } %>
-
-}
-<% } %>

+ 0 - 39
mybatis-plus-generator/src/main/resources/templates/controller.java.ftl

@@ -1,39 +0,0 @@
-package ${package.Controller};
-
-
-import org.springframework.web.bind.annotation.RequestMapping;
-
-<#if restControllerStyle>
-import org.springframework.web.bind.annotation.RestController;
-<#else>
-import org.springframework.stereotype.Controller;
-</#if>
-<#if superControllerClassPackage??>
-import ${superControllerClassPackage};
-</#if>
-
-/**
- * <p>
- * ${table.comment!} 前端控制器
- * </p>
- *
- * @author ${author}
- * @since ${date}
- */
-<#if restControllerStyle>
-@RestController
-<#else>
-@Controller
-</#if>
-@RequestMapping("<#if package.ModuleName?? && package.ModuleName != "">/${package.ModuleName}</#if>/<#if controllerMappingHyphenStyle??>${controllerMappingHyphen}<#else>${table.entityPath}</#if>")
-<#if kotlin>
-class ${table.controllerName}<#if superControllerClass??> : ${superControllerClass}()</#if>
-<#else>
-<#if superControllerClass??>
-public class ${table.controllerName} extends ${superControllerClass} {
-<#else>
-public class ${table.controllerName} {
-</#if>
-
-}
-</#if>

+ 0 - 41
mybatis-plus-generator/src/main/resources/templates/controller.java.vm

@@ -1,41 +0,0 @@
-package ${package.Controller};
-
-
-import org.springframework.web.bind.annotation.RequestMapping;
-
-#if(${restControllerStyle})
-import org.springframework.web.bind.annotation.RestController;
-#else
-import org.springframework.stereotype.Controller;
-#end
-#if(${superControllerClassPackage})
-import ${superControllerClassPackage};
-#end
-
-/**
- * <p>
- * $!{table.comment} 前端控制器
- * </p>
- *
- * @author ${author}
- * @since ${date}
- */
-#if(${restControllerStyle})
-@RestController
-#else
-@Controller
-#end
-@RequestMapping("#if(${package.ModuleName})/${package.ModuleName}#end/#if(${controllerMappingHyphenStyle})${controllerMappingHyphen}#else${table.entityPath}#end")
-#if(${kotlin})
-class ${table.controllerName}#if(${superControllerClass}) : ${superControllerClass}()#end
-
-#else
-#if(${superControllerClass})
-public class ${table.controllerName} extends ${superControllerClass} {
-#else
-public class ${table.controllerName} {
-#end
-
-}
-
-#end

+ 0 - 166
mybatis-plus-generator/src/main/resources/templates/entity.java.btl

@@ -1,166 +0,0 @@
-package ${package.Entity};
-<% for(pkg in table.importPackages){ %>
-import ${pkg};
-<% } %>
-<% if(swagger2){ %>
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-<% } %>
-<% if(entityLombokModel){ %>
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-<% if(chainModel){ %>
-import lombok.experimental.Accessors;
-<% } %>
-<% } %>
-/**
- * <p>
- * ${table.comment!}
- * </p>
- *
- * @author ${author}
- * @since ${date}
- */
-<% if(entityLombokModel){ %>
-@Data
-    <% if(isNotEmpty(superEntityClass)){ %>
-@EqualsAndHashCode(callSuper = true)
-    <% }else{ %>
-@EqualsAndHashCode(callSuper = false)
-    <% } %>
-    <% if(chainModel){ %>
-@Accessors(chain = true)
-    <% } %>
-<% } %>
-<% if(table.convert){ %>
-@TableName("${table.name}")
-<% } %>
-<% if(swagger2){ %>
-@ApiModel(value="${entity}对象", description="${table.comment!''}")
-<% } %>
-<% if(isNotEmpty(superEntityClass)){ %>
-public class ${entity} extends ${superEntityClass}<% if(activeRecord){ %><${entity}><%}%>{
-<% }else if(activeRecord){ %>
-public class ${entity} extends Model<${entity}> {
-<% }else{ %>
-public class ${entity} implements Serializable {
-<% } %>
-
-<% if(entitySerialVersionUID){ %>
-    private static final long serialVersionUID = 1L;
-<% } %>
-<% /** -----------BEGIN 字段循环遍历----------- **/ %>
-<% for(field in table.fields){ %>
-    <%
-    if(field.keyFlag){
-        var keyPropertyName = field.propertyName;
-    }
-    %>
-
-    <% if(isNotEmpty(field.comment)){ %>
-        <% if(swagger2){ %>
-    @ApiModelProperty(value = "${field.comment}")
-        <% }else{ %>
-    /**
-     * ${field.comment}
-     */
-        <% } %>
-    <% } %>
-    <% if(field.keyFlag){ %>
-    <%
-    /*主键*/
-    %>
-        <% if(field.keyIdentityFlag){ %>
-    @TableId(value = "${field.annotationColumnName}", type = IdType.AUTO)
-        <% }else if(isNotEmpty(idType)){ %>
-    @TableId(value = "${field.annotationColumnName}", type = IdType.${idType})
-        <% }else if(field.convert){ %>
-    @TableId("${field.annotationColumnName}")
-         <% } %>
-    <%
-    /*普通字段*/
-    %>
-    <% }else if(isNotEmpty(field.fill)){ %>
-        <% if(field.convert){ %>
-    @TableField(value = "${field.annotationColumnName}", fill = FieldFill.${field.fill})
-        <% }else{ %>
-    @TableField(fill = FieldFill.${field.fill})
-        <% } %>
-    <% }else if(field.convert){ %>
-    @TableField("${field.annotationColumnName}")
-    <% } %>
-    <%
-    /*乐观锁注解*/
-    %>
-    <% if(versionFieldName!'' == field.name){ %>
-    @Version
-    <% } %>
-    <%
-    /*逻辑删除注解*/
-    %>
-    <% if(logicDeleteFieldName!'' == field.name){ %>
-    @TableLogic
-    <% } %>
-    private ${field.propertyType} ${field.propertyName};
-<% } %>
-<% /** -----------END 字段循环遍历----------- **/ %>
-
-<% if(!entityLombokModel){ %>
-    <% for(field in table.fields){ %>
-        <%
-        var getprefix ='';
-        if(field.propertyType=='boolean'){
-            getprefix='is';
-        }else{
-            getprefix='get';
-        }
-        %>
-    public ${field.propertyType} ${getprefix}${field.capitalName}() {
-        return ${field.propertyName};
-    }
-
-        <% if(chainModel){ %>
-    public ${entity} set${field.capitalName}(${field.propertyType} ${field.propertyName}) {
-        <% }else{ %>
-    public void set${field.capitalName}(${field.propertyType} ${field.propertyName}) {
-        <% } %>
-        this.${field.propertyName} = ${field.propertyName};
-        <% if(chainModel){ %>
-        return this;
-        <% } %>
-    }
-
-    <% } %>
-<% } %>
-<% if(entityColumnConstant){ %>
-   <% for(field in table.fields){ %>
-    public static final String ${strutil.toUpperCase(field.name)} = "${field.name}";
-
-   <% } %>
-<% } %>
-<% if(activeRecord){ %>
-    @Override
-    protected Serializable pkVal() {
-    <% if(isNotEmpty(keyPropertyName)){ %>
-        return this.${keyPropertyName};
-    <% }else{ %>
-        return null;
-    <% } %>
-    }
-
-<% } %>
-<% if(!entityLombokModel){ %>
-    @Override
-    public String toString() {
-        return "${entity}{" +
-    <% for(field in table.fields){ %>
-       <% if(fieldLP.index==0){ %>
-        "${field.propertyName}=" + ${field.propertyName} +
-       <% }else{ %>
-        ", ${field.propertyName}=" + ${field.propertyName} +
-       <% } %>
-    <% } %>
-        "}";
-    }
-<% } %>
-}

+ 0 - 156
mybatis-plus-generator/src/main/resources/templates/entity.java.ftl

@@ -1,156 +0,0 @@
-package ${package.Entity};
-
-<#list table.importPackages as pkg>
-import ${pkg};
-</#list>
-<#if swagger2>
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-</#if>
-<#if entityLombokModel>
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-    <#if chainModel>
-import lombok.experimental.Accessors;
-    </#if>
-</#if>
-
-/**
- * <p>
- * ${table.comment!}
- * </p>
- *
- * @author ${author}
- * @since ${date}
- */
-<#if entityLombokModel>
-@Data
-    <#if superEntityClass??>
-@EqualsAndHashCode(callSuper = true)
-    <#else>
-@EqualsAndHashCode(callSuper = false)
-    </#if>
-    <#if chainModel>
-@Accessors(chain = true)
-    </#if>
-</#if>
-<#if table.convert>
-@TableName("${table.name}")
-</#if>
-<#if swagger2>
-@ApiModel(value="${entity}对象", description="${table.comment!}")
-</#if>
-<#if superEntityClass??>
-public class ${entity} extends ${superEntityClass}<#if activeRecord><${entity}></#if> {
-<#elseif activeRecord>
-public class ${entity} extends Model<${entity}> {
-<#else>
-public class ${entity} implements Serializable {
-</#if>
-
-<#if entitySerialVersionUID>
-    private static final long serialVersionUID = 1L;
-</#if>
-<#-- ----------  BEGIN 字段循环遍历  ---------->
-<#list table.fields as field>
-    <#if field.keyFlag>
-        <#assign keyPropertyName="${field.propertyName}"/>
-    </#if>
-
-    <#if field.comment!?length gt 0>
-        <#if swagger2>
-    @ApiModelProperty(value = "${field.comment}")
-        <#else>
-    /**
-     * ${field.comment}
-     */
-        </#if>
-    </#if>
-    <#if field.keyFlag>
-        <#-- 主键 -->
-        <#if field.keyIdentityFlag>
-    @TableId(value = "${field.annotationColumnName}", type = IdType.AUTO)
-        <#elseif idType??>
-    @TableId(value = "${field.annotationColumnName}", type = IdType.${idType})
-        <#elseif field.convert>
-    @TableId("${field.annotationColumnName}")
-        </#if>
-        <#-- 普通字段 -->
-    <#elseif field.fill??>
-    <#-- -----   存在字段填充设置   ----->
-        <#if field.convert>
-    @TableField(value = "${field.annotationColumnName}", fill = FieldFill.${field.fill})
-        <#else>
-    @TableField(fill = FieldFill.${field.fill})
-        </#if>
-    <#elseif field.convert>
-    @TableField("${field.annotationColumnName}")
-    </#if>
-    <#-- 乐观锁注解 -->
-    <#if (versionFieldName!"") == field.name>
-    @Version
-    </#if>
-    <#-- 逻辑删除注解 -->
-    <#if (logicDeleteFieldName!"") == field.name>
-    @TableLogic
-    </#if>
-    private ${field.propertyType} ${field.propertyName};
-</#list>
-<#------------  END 字段循环遍历  ---------->
-
-<#if !entityLombokModel>
-    <#list table.fields as field>
-        <#if field.propertyType == "boolean">
-            <#assign getprefix="is"/>
-        <#else>
-            <#assign getprefix="get"/>
-        </#if>
-    public ${field.propertyType} ${getprefix}${field.capitalName}() {
-        return ${field.propertyName};
-    }
-
-    <#if chainModel>
-    public ${entity} set${field.capitalName}(${field.propertyType} ${field.propertyName}) {
-    <#else>
-    public void set${field.capitalName}(${field.propertyType} ${field.propertyName}) {
-    </#if>
-        this.${field.propertyName} = ${field.propertyName};
-        <#if chainModel>
-        return this;
-        </#if>
-    }
-    </#list>
-</#if>
-
-<#if entityColumnConstant>
-    <#list table.fields as field>
-    public static final String ${field.name?upper_case} = "${field.name}";
-
-    </#list>
-</#if>
-<#if activeRecord>
-    @Override
-    protected Serializable pkVal() {
-    <#if keyPropertyName??>
-        return this.${keyPropertyName};
-    <#else>
-        return null;
-    </#if>
-    }
-
-</#if>
-<#if !entityLombokModel>
-    @Override
-    public String toString() {
-        return "${entity}{" +
-    <#list table.fields as field>
-        <#if field_index==0>
-            "${field.propertyName}=" + ${field.propertyName} +
-        <#else>
-            ", ${field.propertyName}=" + ${field.propertyName} +
-        </#if>
-    </#list>
-        "}";
-    }
-</#if>
-}

+ 0 - 159
mybatis-plus-generator/src/main/resources/templates/entity.java.vm

@@ -1,159 +0,0 @@
-package ${package.Entity};
-
-#foreach($pkg in ${table.importPackages})
-import ${pkg};
-#end
-#if(${swagger2})
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-#end
-#if(${entityLombokModel})
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-#if(${chainModel})
-import lombok.experimental.Accessors;
-#end
-#end
-
-/**
- * <p>
- * $!{table.comment}
- * </p>
- *
- * @author ${author}
- * @since ${date}
- */
-#if(${entityLombokModel})
-@Data
-  #if(${superEntityClass})
-@EqualsAndHashCode(callSuper = true)
-  #else
-@EqualsAndHashCode(callSuper = false)
-  #end
-  #if(${chainModel})
-@Accessors(chain = true)
-  #end
-#end
-#if(${table.convert})
-@TableName("${table.name}")
-#end
-#if(${swagger2})
-@ApiModel(value="${entity}对象", description="$!{table.comment}")
-#end
-#if(${superEntityClass})
-public class ${entity} extends ${superEntityClass}#if(${activeRecord})<${entity}>#end {
-#elseif(${activeRecord})
-public class ${entity} extends Model<${entity}> {
-#else
-public class ${entity} implements Serializable {
-#end
-
-#if(${entitySerialVersionUID})
-    private static final long serialVersionUID = 1L;
-#end
-## ----------  BEGIN 字段循环遍历  ----------
-#foreach($field in ${table.fields})
-
-#if(${field.keyFlag})
-#set($keyPropertyName=${field.propertyName})
-#end
-#if("$!field.comment" != "")
-  #if(${swagger2})
-    @ApiModelProperty(value = "${field.comment}")
-  #else
-    /**
-     * ${field.comment}
-     */
-  #end
-#end
-#if(${field.keyFlag})
-## 主键
-  #if(${field.keyIdentityFlag})
-    @TableId(value = "${field.annotationColumnName}", type = IdType.AUTO)
-  #elseif(!$null.isNull(${idType}) && "$!idType" != "")
-    @TableId(value = "${field.annotationColumnName}", type = IdType.${idType})
-  #elseif(${field.convert})
-    @TableId("${field.annotationColumnName}")
-  #end
-## 普通字段
-#elseif(${field.fill})
-## -----   存在字段填充设置   -----
-  #if(${field.convert})
-    @TableField(value = "${field.annotationColumnName}", fill = FieldFill.${field.fill})
-  #else
-    @TableField(fill = FieldFill.${field.fill})
-  #end
-#elseif(${field.convert})
-    @TableField("${field.annotationColumnName}")
-#end
-## 乐观锁注解
-#if(${versionFieldName}==${field.name})
-    @Version
-#end
-## 逻辑删除注解
-#if(${logicDeleteFieldName}==${field.name})
-    @TableLogic
-#end
-    private ${field.propertyType} ${field.propertyName};
-#end
-## ----------  END 字段循环遍历  ----------
-
-#if(!${entityLombokModel})
-#foreach($field in ${table.fields})
-  #if(${field.propertyType.equals("boolean")})
-    #set($getprefix="is")
-  #else
-    #set($getprefix="get")
-  #end
-
-    public ${field.propertyType} ${getprefix}${field.capitalName}() {
-        return ${field.propertyName};
-    }
-
-  #if(${chainModel})
-    public ${entity} set${field.capitalName}(${field.propertyType} ${field.propertyName}) {
-  #else
-    public void set${field.capitalName}(${field.propertyType} ${field.propertyName}) {
-  #end
-        this.${field.propertyName} = ${field.propertyName};
-  #if(${chainModel})
-        return this;
-  #end
-    }
-#end
-## --foreach end---
-#end
-## --end of #if(!${entityLombokModel})--
-
-#if(${entityColumnConstant})
-  #foreach($field in ${table.fields})
-    public static final String ${field.name.toUpperCase()} = "${field.name}";
-
-  #end
-#end
-#if(${activeRecord})
-    @Override
-    protected Serializable pkVal() {
-  #if(${keyPropertyName})
-        return this.${keyPropertyName};
-  #else
-        return null;
-  #end
-    }
-
-#end
-#if(!${entityLombokModel})
-    @Override
-    public String toString() {
-        return "${entity}{" +
-  #foreach($field in ${table.fields})
-    #if($!{foreach.index}==0)
-        "${field.propertyName}=" + ${field.propertyName} +
-    #else
-        ", ${field.propertyName}=" + ${field.propertyName} +
-    #end
-  #end
-        "}";
-    }
-#end
-}

+ 0 - 124
mybatis-plus-generator/src/main/resources/templates/entity.kt.btl

@@ -1,124 +0,0 @@
-package ${package.Entity}
-<% for(pkg in table.importPackages){ %>
-import ${pkg}
-<% } %>
-<% if(swagger2){ %>
-import io.swagger.annotations.ApiModel
-import io.swagger.annotations.ApiModelProperty
-<% } %>
-/**
- * <p>
- * ${table.comment!}
- * </p>
- *
- * @author ${author}
- * @since ${date}
- */
-<% if(table.convert){ %>
-@TableName("${table.name}")
-<% } %>
-<% if(swagger2){ %>
-@ApiModel(value="${entity}对象", description="${table.comment!''}")
-<% } %>
-<% if(isNotEmpty(superEntityClass)){ %>
-class ${entity} : ${superEntityClass}<% if(activeRecord){ %><${entity}><%}%>{
-<% }else if(activeRecord){ %>
-class ${entity} : Model<${entity}> {
-<% }else{ %>
-class ${entity} : Serializable {
-<% } %>
-
-<% /** -----------BEGIN 字段循环遍历----------- **/ %>
-<% for(field in table.fields){ %>
-    <%
-    if(field.keyFlag){
-        var keyPropertyName = field.propertyName;
-    }
-    %>
-
-    <% if(isNotEmpty(field.comment)){ %>
-        <% if(swagger2){ %>
-    @ApiModelProperty(value = "${field.comment}")
-        <% }else{ %>
-    /**
-     * ${field.comment}
-     */
-        <% } %>
-    <% } %>
-    <% if(field.keyFlag){ %>
-    <%
-    /*主键*/
-    %>
-        <% if(field.keyIdentityFlag){ %>
-    @TableId(value = "${field.annotationColumnName}", type = IdType.AUTO)
-        <% }else if(isNotEmpty(idType)){ %>
-    @TableId(value = "${field.annotationColumnName}", type = IdType.${idType})
-        <% }else if(field.convert){ %>
-    @TableId("${field.columnName}")
-         <% } %>
-    <%
-    /*普通字段*/
-    %>
-    <% }else if(isNotEmpty(field.fill)){ %>
-        <% if(field.convert){ %>
-    @TableField(value = "${field.annotationColumnName}", fill = FieldFill.${field.fill})
-        <% }else{ %>
-    @TableField(fill = FieldFill.${field.fill})
-        <% } %>
-    <% }else if(field.convert){ %>
-    @TableField("${field.annotationColumnName}")
-    <% } %>
-    <%
-    /*乐观锁注解*/
-    %>
-    <% if(versionFieldName!'' == field.name){ %>
-    @Version
-    <% } %>
-    <%
-    /*逻辑删除注解*/
-    %>
-    <% if(logicDeleteFieldName!'' == field.name){ %>
-    @TableLogic
-    <% } %>
-    <% if(field.propertyType == 'Integer'){ %>
-    var ${field.propertyName}: Int ? = null
-    <% }else{ %>
-    var ${field.propertyName}: ${field.propertyType} ? = null
-    <% } %>
-<% } %>
-<% /** -----------END 字段循环遍历----------- **/ %>
-
-<% if(entityColumnConstant){ %>
-    companion object {
-   <% for(field in table.fields){ %>
-    const val ${strutil.toUpperCase(field.name)} : String = "${field.name}"
-   <% } %>
-    }
-<% } %>
-<% if(activeRecord){ %>
-    @Override
-    override fun pkVal(): Serializable? {
-    <% if(isNotEmpty(keyPropertyName)){ %>
-        return this.${keyPropertyName}
-    <% }else{ %>
-        return null;
-    <% } %>
-    }
-
-<% } %>
-
-<% if(!entityLombokModel){ %>
-    @Override
-    override fun toString(): String  {
-        return "${entity}{" +
-    <% for(field in table.fields){ %>
-       <% if(fieldLP.index==0){ %>
-        "${field.propertyName}=" + ${field.propertyName} +
-       <% }else{ %>
-        ", ${field.propertyName}=" + ${field.propertyName} +
-       <% } %>
-    <% } %>
-        "}"
-    }
-<% } %>
-}

+ 0 - 115
mybatis-plus-generator/src/main/resources/templates/entity.kt.ftl

@@ -1,115 +0,0 @@
-package ${package.Entity}
-
-<#list table.importPackages as pkg>
-import ${pkg}
-</#list>
-<#if swagger2>
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-</#if>
-/**
- * <p>
- * ${table.comment}
- * </p>
- *
- * @author ${author}
- * @since ${date}
- */
-<#if table.convert>
-@TableName("${table.name}")
-</#if>
-<#if swagger2>
-@ApiModel(value="${entity}对象", description="${table.comment!}")
-</#if>
-<#if superEntityClass??>
-class ${entity} : ${superEntityClass}<#if activeRecord><${entity}></#if> {
-<#elseif activeRecord>
-class ${entity} : Model<${entity}>() {
-<#else>
-class ${entity} : Serializable {
-</#if>
-
-<#-- ----------  BEGIN 字段循环遍历  ---------->
-<#list table.fields as field>
-<#if field.keyFlag>
-    <#assign keyPropertyName="${field.propertyName}"/>
-</#if>
-
-<#if field.comment!?length gt 0>
-<#if swagger2>
-        @ApiModelProperty(value = "${field.comment}")
-<#else>
-    /**
-     * ${field.comment}
-     */
-</#if>
-</#if>
-<#if field.keyFlag>
-<#-- 主键 -->
-<#if field.keyIdentityFlag>
-    @TableId(value = "${field.annotationColumnName}", type = IdType.AUTO)
-<#elseif idType ??>
-    @TableId(value = "${field.annotationColumnName}", type = IdType.${idType})
-<#elseif field.convert>
-    @TableId("${field.annotationColumnName}")
-</#if>
-<#-- 普通字段 -->
-<#elseif field.fill??>
-<#-- -----   存在字段填充设置   ----->
-<#if field.convert>
-    @TableField(value = "${field.annotationColumnName}", fill = FieldFill.${field.fill})
-<#else>
-    @TableField(fill = FieldFill.${field.fill})
-</#if>
-<#elseif field.convert>
-    @TableField("${field.annotationColumnName}")
-</#if>
-<#-- 乐观锁注解 -->
-<#if (versionFieldName!"") == field.name>
-    @Version
-</#if>
-<#-- 逻辑删除注解 -->
-<#if (logicDeleteFieldName!"") == field.name>
-    @TableLogic
-</#if>
-    <#if field.propertyType == "Integer">
-    var ${field.propertyName}: Int? = null
-    <#else>
-    var ${field.propertyName}: ${field.propertyType}? = null
-    </#if>
-</#list>
-<#-- ----------  END 字段循环遍历  ---------->
-
-
-<#if entityColumnConstant>
-    companion object {
-<#list table.fields as field>
-
-        const val ${field.name?upper_case} : String = "${field.name}"
-
-</#list>
-    }
-
-</#if>
-<#if activeRecord>
-    override fun pkVal(): Serializable? {
-<#if keyPropertyName??>
-        return ${keyPropertyName}
-<#else>
-        return null
-</#if>
-    }
-
-</#if>
-    override fun toString(): String {
-        return "${entity}{" +
-<#list table.fields as field>
-<#if field_index==0>
-        "${field.propertyName}=" + ${field.propertyName} +
-<#else>
-        ", ${field.propertyName}=" + ${field.propertyName} +
-</#if>
-</#list>
-        "}"
-    }
-}

+ 0 - 114
mybatis-plus-generator/src/main/resources/templates/entity.kt.vm

@@ -1,114 +0,0 @@
-package ${package.Entity};
-
-#foreach($pkg in ${table.importPackages})
-import ${pkg};
-#end
-#if(${swagger2})
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-#end
-/**
- * <p>
- * $!{table.comment}
- * </p>
- *
- * @author ${author}
- * @since ${date}
- */
-#if(${table.convert})
-@TableName("${table.name}")
-#end
-#if(${swagger2})
-@ApiModel(value="${entity}对象", description="$!{table.comment}")
-#end
-#if(${superEntityClass})
-class ${entity} : ${superEntityClass}#if(${activeRecord})<${entity}>#end() {
-#elseif(${activeRecord})
-class ${entity} : Model<${entity}>() {
-#else
-class ${entity} : Serializable {
-#end
-
-## ----------  BEGIN 字段循环遍历  ----------
-#foreach($field in ${table.fields})
-#if(${field.keyFlag})
-#set($keyPropertyName=${field.propertyName})
-#end
-#if("$!field.comment" != "")
-    #if(${swagger2})
-    @ApiModelProperty(value = "${field.comment}")
-    #else
-    /**
-     * ${field.comment}
-     */
-    #end
-#end
-#if(${field.keyFlag})
-## 主键
-#if(${field.keyIdentityFlag})
-    @TableId(value = "${field.annotationColumnName}", type = IdType.AUTO)
-#elseif(!$null.isNull(${idType}) && "$!idType" != "")
-    @TableId(value = "${field.annotationColumnName}", type = IdType.${idType})
-#elseif(${field.convert})
-    @TableId("${field.annotationColumnName}")
-#end
-## 普通字段
-#elseif(${field.fill})
-## -----   存在字段填充设置   -----
-#if(${field.convert})
-    @TableField(value = "${field.annotationColumnName}", fill = FieldFill.${field.fill})
-#else
-    @TableField(fill = FieldFill.${field.fill})
-#end
-#elseif(${field.convert})
-    @TableField("${field.annotationColumnName}")
-#end
-## 乐观锁注解
-#if(${versionFieldName}==${field.name})
-    @Version
-#end
-## 逻辑删除注解
-#if(${logicDeleteFieldName}==${field.name})
-    @TableLogic
-#end
-    #if(${field.propertyType} == "Integer")
-    var ${field.propertyName}: Int? = null
-    #else
-    var ${field.propertyName}: ${field.propertyType}? = null
-    #end
-#end
-## ----------  END 字段循环遍历  ----------
-
-
-#if(${entityColumnConstant})
-    companion object {
-#foreach($field in ${table.fields})
-
-        const val ${field.name.toUpperCase()} : String = "${field.name}"
-
-#end
-    }
-
-#end
-#if(${activeRecord})
-    override fun pkVal(): Serializable? {
-#if(${keyPropertyName})
-        return ${keyPropertyName}
-#else
-        return null
-#end
-    }
-
-#end
-    override fun toString(): String {
-        return "${entity}{" +
-#foreach($field in ${table.fields})
-#if($!{foreach.index}==0)
-        "${field.propertyName}=" + ${field.propertyName} +
-#else
-        ", ${field.propertyName}=" + ${field.propertyName} +
-#end
-#end
-        "}"
-    }
-}

+ 0 - 20
mybatis-plus-generator/src/main/resources/templates/mapper.java.btl

@@ -1,20 +0,0 @@
-package ${package.Mapper};
-
-import ${package.Entity}.${entity};
-import ${superMapperClassPackage};
-
-/**
- * <p>
- * ${table.comment!} Mapper 接口
- * </p>
- *
- * @author ${author}
- * @since ${date}
- */
-<% if(kotlin){ %>
-interface ${table.mapperName} : ${superMapperClass}<${entity}>
-<% }else{ %>
-public interface ${table.mapperName} extends ${superMapperClass}<${entity}> {
-
-}
-<% } %>

+ 0 - 20
mybatis-plus-generator/src/main/resources/templates/mapper.java.ftl

@@ -1,20 +0,0 @@
-package ${package.Mapper};
-
-import ${package.Entity}.${entity};
-import ${superMapperClassPackage};
-
-/**
- * <p>
- * ${table.comment!} Mapper 接口
- * </p>
- *
- * @author ${author}
- * @since ${date}
- */
-<#if kotlin>
-interface ${table.mapperName} : ${superMapperClass}<${entity}>
-<#else>
-public interface ${table.mapperName} extends ${superMapperClass}<${entity}> {
-
-}
-</#if>

+ 0 - 20
mybatis-plus-generator/src/main/resources/templates/mapper.java.vm

@@ -1,20 +0,0 @@
-package ${package.Mapper};
-
-import ${package.Entity}.${entity};
-import ${superMapperClassPackage};
-
-/**
- * <p>
- * $!{table.comment} Mapper 接口
- * </p>
- *
- * @author ${author}
- * @since ${date}
- */
-#if(${kotlin})
-interface ${table.mapperName} : ${superMapperClass}<${entity}>
-#else
-public interface ${table.mapperName} extends ${superMapperClass}<${entity}> {
-
-}
-#end

+ 0 - 41
mybatis-plus-generator/src/main/resources/templates/mapper.xml.btl

@@ -1,41 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="${package.Mapper}.${table.mapperName}">
-
-<% if(enableCache){ %>
-    <!-- 开启二级缓存 -->
-    <cache type="org.mybatis.caches.ehcache.LoggingEhcache"/>
-
-<% } %>
-<% if(baseResultMap){ %>
-    <!-- 通用查询映射结果 -->
-    <resultMap id="BaseResultMap" type="${package.Entity}.${entity}">
-<% for(field in table.fields){ %>
-   <% /** 生成主键排在第一位 **/ %>
-   <% if(field.keyFlag){ %>
-        <id column="${field.name}" property="${field.propertyName}" />
-   <% } %>
-<% } %>
-<% for(field in table.commonFields){ %>
-    <% /** 生成公共字段 **/ %>
-        <result column="${field.name}" property="${field.propertyName}" />
-<% } %>
-<% for(field in table.fields){ %>
-   <% /** 生成普通字段 **/ %>
-   <% if(!field.keyFlag){ %>
-        <result column="${field.name}" property="${field.propertyName}" />
-   <% } %>
-<% } %>
-    </resultMap>
-<% } %>
-<% if(baseColumnList){ %>
-    <!-- 通用查询结果列 -->
-    <sql id="Base_Column_List">
-<% for(field in table.commonFields){ %>
-        ${field.columnName},
-<% } %>
-        ${table.fieldNames}
-    </sql>
-
-<% } %>
-</mapper>

+ 0 - 39
mybatis-plus-generator/src/main/resources/templates/mapper.xml.ftl

@@ -1,39 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="${package.Mapper}.${table.mapperName}">
-
-<#if enableCache>
-    <!-- 开启二级缓存 -->
-    <cache type="org.mybatis.caches.ehcache.LoggingEhcache"/>
-
-</#if>
-<#if baseResultMap>
-    <!-- 通用查询映射结果 -->
-    <resultMap id="BaseResultMap" type="${package.Entity}.${entity}">
-<#list table.fields as field>
-<#if field.keyFlag><#--生成主键排在第一位-->
-        <id column="${field.name}" property="${field.propertyName}" />
-</#if>
-</#list>
-<#list table.commonFields as field><#--生成公共字段 -->
-        <result column="${field.name}" property="${field.propertyName}" />
-</#list>
-<#list table.fields as field>
-<#if !field.keyFlag><#--生成普通字段 -->
-        <result column="${field.name}" property="${field.propertyName}" />
-</#if>
-</#list>
-    </resultMap>
-
-</#if>
-<#if baseColumnList>
-    <!-- 通用查询结果列 -->
-    <sql id="Base_Column_List">
-<#list table.commonFields as field>
-        ${field.columnName},
-</#list>
-        ${table.fieldNames}
-    </sql>
-
-</#if>
-</mapper>

+ 0 - 39
mybatis-plus-generator/src/main/resources/templates/mapper.xml.vm

@@ -1,39 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="${package.Mapper}.${table.mapperName}">
-
-#if(${enableCache})
-    <!-- 开启二级缓存 -->
-    <cache type="org.mybatis.caches.ehcache.LoggingEhcache"/>
-
-#end
-#if(${baseResultMap})
-    <!-- 通用查询映射结果 -->
-    <resultMap id="BaseResultMap" type="${package.Entity}.${entity}">
-#foreach($field in ${table.fields})
-#if(${field.keyFlag})##生成主键排在第一位
-        <id column="${field.name}" property="${field.propertyName}" />
-#end
-#end
-#foreach($field in ${table.commonFields})##生成公共字段
-        <result column="${field.name}" property="${field.propertyName}" />
-#end
-#foreach($field in ${table.fields})
-#if(!${field.keyFlag})##生成普通字段
-        <result column="${field.name}" property="${field.propertyName}" />
-#end
-#end
-    </resultMap>
-
-#end
-#if(${baseColumnList})
-    <!-- 通用查询结果列 -->
-    <sql id="Base_Column_List">
-#foreach($field in ${table.commonFields})
-        ${field.columnName},
-#end
-        ${table.fieldNames}
-    </sql>
-
-#end
-</mapper>

+ 0 - 20
mybatis-plus-generator/src/main/resources/templates/service.java.btl

@@ -1,20 +0,0 @@
-package ${package.Service};
-
-import ${package.Entity}.${entity};
-import ${superServiceClassPackage};
-
-/**
- * <p>
- * ${table.comment!} 服务类
- * </p>
- *
- * @author ${author}
- * @since ${date}
- */
-<% if(kotlin){ %>
-interface ${table.serviceName} : ${superServiceClass}<${entity}>
-<% }else{ %>
-public interface ${table.serviceName} extends ${superServiceClass}<${entity}> {
-
-}
-<% } %>

+ 0 - 20
mybatis-plus-generator/src/main/resources/templates/service.java.ftl

@@ -1,20 +0,0 @@
-package ${package.Service};
-
-import ${package.Entity}.${entity};
-import ${superServiceClassPackage};
-
-/**
- * <p>
- * ${table.comment!} 服务类
- * </p>
- *
- * @author ${author}
- * @since ${date}
- */
-<#if kotlin>
-interface ${table.serviceName} : ${superServiceClass}<${entity}>
-<#else>
-public interface ${table.serviceName} extends ${superServiceClass}<${entity}> {
-
-}
-</#if>

+ 0 - 20
mybatis-plus-generator/src/main/resources/templates/service.java.vm

@@ -1,20 +0,0 @@
-package ${package.Service};
-
-import ${package.Entity}.${entity};
-import ${superServiceClassPackage};
-
-/**
- * <p>
- * $!{table.comment} 服务类
- * </p>
- *
- * @author ${author}
- * @since ${date}
- */
-#if(${kotlin})
-interface ${table.serviceName} : ${superServiceClass}<${entity}>
-#else
-public interface ${table.serviceName} extends ${superServiceClass}<${entity}> {
-
-}
-#end

+ 0 - 26
mybatis-plus-generator/src/main/resources/templates/serviceImpl.java.btl

@@ -1,26 +0,0 @@
-package ${package.ServiceImpl};
-
-import ${package.Entity}.${entity};
-import ${package.Mapper}.${table.mapperName};
-import ${package.Service}.${table.serviceName};
-import ${superServiceImplClassPackage};
-import org.springframework.stereotype.Service;
-
-/**
- * <p>
- * ${table.comment!} 服务实现类
- * </p>
- *
- * @author ${author}
- * @since ${date}
- */
-@Service
-<% if(kotlin){ %>
-open class ${table.serviceImplName} : ${superServiceImplClass}<${table.mapperName}, ${entity}>(), ${table.serviceName} {
-
-}
-<% }else{ %>
-public class ${table.serviceImplName} extends ${superServiceImplClass}<${table.mapperName}, ${entity}> implements ${table.serviceName} {
-
-}
-<% } %>

+ 0 - 26
mybatis-plus-generator/src/main/resources/templates/serviceImpl.java.ftl

@@ -1,26 +0,0 @@
-package ${package.ServiceImpl};
-
-import ${package.Entity}.${entity};
-import ${package.Mapper}.${table.mapperName};
-import ${package.Service}.${table.serviceName};
-import ${superServiceImplClassPackage};
-import org.springframework.stereotype.Service;
-
-/**
- * <p>
- * ${table.comment!} 服务实现类
- * </p>
- *
- * @author ${author}
- * @since ${date}
- */
-@Service
-<#if kotlin>
-open class ${table.serviceImplName} : ${superServiceImplClass}<${table.mapperName}, ${entity}>(), ${table.serviceName} {
-
-}
-<#else>
-public class ${table.serviceImplName} extends ${superServiceImplClass}<${table.mapperName}, ${entity}> implements ${table.serviceName} {
-
-}
-</#if>

+ 0 - 26
mybatis-plus-generator/src/main/resources/templates/serviceImpl.java.vm

@@ -1,26 +0,0 @@
-package ${package.ServiceImpl};
-
-import ${package.Entity}.${entity};
-import ${package.Mapper}.${table.mapperName};
-import ${package.Service}.${table.serviceName};
-import ${superServiceImplClassPackage};
-import org.springframework.stereotype.Service;
-
-/**
- * <p>
- * $!{table.comment} 服务实现类
- * </p>
- *
- * @author ${author}
- * @since ${date}
- */
-@Service
-#if(${kotlin})
-open class ${table.serviceImplName} : ${superServiceImplClass}<${table.mapperName}, ${entity}>(), ${table.serviceName} {
-
-}
-#else
-public class ${table.serviceImplName} extends ${superServiceImplClass}<${table.mapperName}, ${entity}> implements ${table.serviceName} {
-
-}
-#end

+ 0 - 54
mybatis-plus-generator/src/test/java/com/baomidou/mybatisplus/generator/config/converts/SqlServerTypeConvertTest.java

@@ -1,54 +0,0 @@
-package com.baomidou.mybatisplus.generator.config.converts;
-
-import static com.baomidou.mybatisplus.generator.config.rules.DbColumnType.*;
-
-import org.junit.jupiter.api.Assertions;
-import org.junit.jupiter.api.Test;
-
-import com.baomidou.mybatisplus.generator.config.GlobalConfig;
-import com.baomidou.mybatisplus.generator.config.rules.DateType;
-
-/**
- * @author lanjerry 2020/10/23.
- */
-public class SqlServerTypeConvertTest {
-
-    @Test
-    void processTypeConvertTest() {
-        // 常用格式
-        GlobalConfig globalConfig = new GlobalConfig();
-        SqlServerTypeConvert convert = SqlServerTypeConvert.INSTANCE;
-        Assertions.assertEquals(STRING, convert.processTypeConvert(globalConfig, "char"));
-        Assertions.assertEquals(STRING, convert.processTypeConvert(globalConfig, "xml"));
-        Assertions.assertEquals(STRING, convert.processTypeConvert(globalConfig, "text"));
-        Assertions.assertEquals(LONG, convert.processTypeConvert(globalConfig, "bigint"));
-        Assertions.assertEquals(INTEGER, convert.processTypeConvert(globalConfig, "int"));
-        Assertions.assertEquals(BOOLEAN, convert.processTypeConvert(globalConfig, "bit"));
-        Assertions.assertEquals(DOUBLE, convert.processTypeConvert(globalConfig, "decimal"));
-        Assertions.assertEquals(DOUBLE, convert.processTypeConvert(globalConfig, "numeric"));
-        Assertions.assertEquals(BIG_DECIMAL, convert.processTypeConvert(globalConfig, "money"));
-        Assertions.assertEquals(BYTE_ARRAY, convert.processTypeConvert(globalConfig, "binary"));
-        Assertions.assertEquals(BYTE_ARRAY, convert.processTypeConvert(globalConfig, "image"));
-        Assertions.assertEquals(FLOAT, convert.processTypeConvert(globalConfig, "float"));
-        Assertions.assertEquals(FLOAT, convert.processTypeConvert(globalConfig, "real"));
-
-        // 日期格式
-        globalConfig = new GlobalConfig().setDateType(DateType.SQL_PACK);
-        Assertions.assertEquals(DATE_SQL, convert.processTypeConvert(globalConfig, "date"));
-        Assertions.assertEquals(TIME, convert.processTypeConvert(globalConfig, "time"));
-        Assertions.assertEquals(TIMESTAMP, convert.processTypeConvert(globalConfig, "timestamp"));
-        Assertions.assertEquals(TIMESTAMP, convert.processTypeConvert(globalConfig, "datetime"));
-
-        globalConfig = new GlobalConfig().setDateType(DateType.TIME_PACK);
-        Assertions.assertEquals(LOCAL_DATE, convert.processTypeConvert(globalConfig, "date"));
-        Assertions.assertEquals(LOCAL_TIME, convert.processTypeConvert(globalConfig, "time"));
-        Assertions.assertEquals(LOCAL_DATE_TIME, convert.processTypeConvert(globalConfig, "timestamp"));
-        Assertions.assertEquals(LOCAL_DATE_TIME, convert.processTypeConvert(globalConfig, "datetime"));
-
-        globalConfig = new GlobalConfig().setDateType(DateType.ONLY_DATE);
-        Assertions.assertEquals(DATE, convert.processTypeConvert(globalConfig, "date"));
-        Assertions.assertEquals(DATE, convert.processTypeConvert(globalConfig, "time"));
-        Assertions.assertEquals(DATE, convert.processTypeConvert(globalConfig, "timestamp"));
-        Assertions.assertEquals(DATE, convert.processTypeConvert(globalConfig, "datetime"));
-    }
-}

+ 0 - 33
mybatis-plus-generator/src/test/java/com/baomidou/mybatisplus/generator/config/converts/select/SelectorTest.java

@@ -1,33 +0,0 @@
-package com.baomidou.mybatisplus.generator.config.converts.select;
-
-import org.junit.jupiter.api.Test;
-
-import static org.junit.jupiter.api.Assertions.assertEquals;
-
-/**
- * @author hanchunlin
- * Created at 2020/6/11 19:43
- */
-class SelectorTest {
-
-    @Test
-    void test() {
-        assertEquals("1", asString(1));
-        assertEquals("123", asString(4));
-    }
-
-    /**
-     * 将数字转换为字符串
-     *
-     * @param i 数字
-     * @return 返回对应的字符串
-     */
-    private String asString(int i) {
-        Selector<Integer, String> selector = Selector.param(i);
-        return selector.test(BranchBuilder.<Integer, String>of(ii -> ii == 1).then(p -> "1"))
-            .test(BranchBuilder.<Integer, String>of(ii -> ii == 2).then(p -> "2"))
-            .test(BranchBuilder.<Integer, String>of(ii -> ii == 3).then(p -> "3"))
-            .or("123");
-    }
-
-}

+ 0 - 18
mybatis-plus-generator/src/test/java/com/baomidou/mybatisplus/generator/config/rules/NamingStrategyTest.java

@@ -1,18 +0,0 @@
-package com.baomidou.mybatisplus.generator.config.rules;
-
-import org.junit.jupiter.api.Assertions;
-import org.junit.jupiter.api.Test;
-
-import java.util.Arrays;
-import java.util.HashSet;
-
-public class NamingStrategyTest {
-
-    @Test
-    void removePrefixTest() {
-        Assertions.assertEquals(NamingStrategy.removePrefix("test_ab", "t_", "test"), "_ab");
-        Assertions.assertEquals(NamingStrategy.removePrefix("test_ab", new HashSet<>(Arrays.asList("t_", "test"))), "_ab");
-    }
-
-
-}

+ 0 - 129
mybatis-plus-generator/src/test/java/com/baomidou/mybatisplus/test/generator/CodeGeneratorTest.java

@@ -1,129 +0,0 @@
-/*
- * Copyright (c) 2011-2019, hubin (jobob@qq.com).
- * <p>
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- * <p>
- * https://www.apache.org/licenses/LICENSE-2.0
- * <p>
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-package com.baomidou.mybatisplus.test.generator;
-
-import com.baomidou.mybatisplus.annotation.DbType;
-import com.baomidou.mybatisplus.annotation.IdType;
-import com.baomidou.mybatisplus.generator.AutoGenerator;
-import com.baomidou.mybatisplus.generator.config.DataSourceConfig;
-import com.baomidou.mybatisplus.generator.config.GlobalConfig;
-import com.baomidou.mybatisplus.generator.config.PackageConfig;
-import com.baomidou.mybatisplus.generator.config.StrategyConfig;
-import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy;
-import com.mysql.cj.jdbc.Driver;
-import org.junit.jupiter.api.Disabled;
-import org.junit.jupiter.api.Test;
-
-/**
- * 代码生成器 示例
- *
- * @author K神
- * @since 2017/12/29
- */
-class CodeGeneratorTest {
-
-    /**
-     * 是否强制带上注解
-     */
-    private boolean enableTableFieldAnnotation = false;
-    /**
-     * 生成的注解带上IdType类型
-     */
-    private IdType tableIdType = null;
-    /**
-     * 是否去掉生成实体的属性名前缀
-     */
-    private String[] fieldPrefix = new String[]{};
-    /**
-     * 生成的Service 接口类名是否以I开头
-     * <p>默认是以I开头</p>
-     * <p>user表 -> IUserService, UserServiceImpl</p>
-     */
-    private boolean serviceClassNameStartWithI = true;
-
-    @Test
-    @Disabled
-    void generateCode() {
-        String packageName = "com.baomidou.springboot";
-        enableTableFieldAnnotation = false;
-        tableIdType = null;
-        generateByTables(packageName + ".noannoidtype", "user");
-        enableTableFieldAnnotation = true;
-        tableIdType = null;
-        generateByTables(packageName + ".noidtype", "user");
-        enableTableFieldAnnotation = false;
-        tableIdType = IdType.INPUT;
-        generateByTables(packageName + ".noanno", "user");
-        enableTableFieldAnnotation = true;
-        tableIdType = IdType.INPUT;
-        generateByTables(packageName + ".both", "user");
-
-        fieldPrefix = new String[]{"test"};
-        enableTableFieldAnnotation = false;
-        tableIdType = null;
-        generateByTables(packageName + ".noannoidtypewithprefix", "user");
-        enableTableFieldAnnotation = true;
-        tableIdType = null;
-        generateByTables(packageName + ".noidtypewithprefix", "user");
-        enableTableFieldAnnotation = false;
-        tableIdType = IdType.INPUT;
-        generateByTables(packageName + ".noannowithprefix", "user");
-        enableTableFieldAnnotation = true;
-        tableIdType = IdType.INPUT;
-        generateByTables(packageName + ".withannoidtypeprefix", "user");
-
-        serviceClassNameStartWithI = false;
-        generateByTables(packageName, "user");
-    }
-
-    private void generateByTables(String packageName, String... tableNames) {
-        GlobalConfig config = new GlobalConfig();
-        String dbUrl = "jdbc:mysql://localhost:3306/mybatis-plus";
-        DataSourceConfig dataSourceConfig = new DataSourceConfig();
-        dataSourceConfig.setDbType(DbType.MYSQL)
-            .setUrl(dbUrl)
-            .setUsername("root")
-            .setPassword("")
-            .setDriverName(Driver.class.getName());
-        StrategyConfig strategyConfig = new StrategyConfig();
-        strategyConfig
-            .setCapitalMode(true)
-            .setEntityLombokModel(false)
-            // .setDbColumnUnderline(true) 改为如下 2 个配置
-            .setNaming(NamingStrategy.underline_to_camel)
-            .setColumnNaming(NamingStrategy.underline_to_camel)
-            .setEntityTableFieldAnnotationEnable(enableTableFieldAnnotation)
-            .setFieldPrefix(fieldPrefix)//test_id -> id, test_type -> type
-            .setInclude(tableNames);//修改替换成你需要的表名,多个表名传数组
-        config.setActiveRecord(false)
-            .setIdType(tableIdType)
-            .setAuthor("K神带你飞")
-            .setOutputDir("d:\\codeGen")
-            .setFileOverride(true);
-        if (!serviceClassNameStartWithI) {
-            config.setServiceName("%sService");
-        }
-        new AutoGenerator().setGlobalConfig(config)
-            .setDataSource(dataSourceConfig)
-            .setStrategy(strategyConfig)
-            .setPackageInfo(
-                new PackageConfig()
-                    .setParent(packageName)
-                    .setController("controller")
-                    .setEntity("entity")
-            ).execute();
-    }
-}

+ 0 - 122
mybatis-plus-generator/src/test/java/com/baomidou/mybatisplus/test/generator/CodeGeneratorWithTemplateTest.java

@@ -1,122 +0,0 @@
-/*
- * Copyright (c) 2011-2019, hubin (jobob@qq.com).
- * <p>
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- * <p>
- * https://www.apache.org/licenses/LICENSE-2.0
- * <p>
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-package com.baomidou.mybatisplus.test.generator;
-
-import com.baomidou.mybatisplus.annotation.DbType;
-import com.baomidou.mybatisplus.annotation.IdType;
-import com.baomidou.mybatisplus.generator.AutoGenerator;
-import com.baomidou.mybatisplus.generator.InjectionConfig;
-import com.baomidou.mybatisplus.generator.config.*;
-import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy;
-import com.mysql.cj.jdbc.Driver;
-import org.junit.jupiter.api.Disabled;
-import org.junit.jupiter.api.Test;
-
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * 代码生成器 示例
- *
- * @author K神
- * @since 2017/12/29
- */
-class CodeGeneratorWithTemplateTest {
-
-    /**
-     * 是否强制带上注解
-     */
-    private boolean enableTableFieldAnnotation = false;
-    /**
-     * 生成的注解带上IdType类型
-     */
-    private IdType tableIdType = null;
-    /**
-     * 是否去掉生成实体的属性名前缀
-     */
-    private String[] fieldPrefix = new String[]{};
-    /**
-     * 生成的Service 接口类名是否以I开头
-     * <p>默认是以I开头</p>
-     * <p>user表 -> IUserService, UserServiceImpl</p>
-     */
-    private boolean serviceClassNameStartWithI = true;
-
-    @Test
-    @Disabled
-    void generateCode() {
-        String packageName = "com.baomidou.springboot";
-        enableTableFieldAnnotation = false;
-        tableIdType = null;
-        generateByTables(packageName + ".tmp", "user");
-
-    }
-
-    private void generateByTables(String packageName, String... tableNames) {
-        GlobalConfig config = new GlobalConfig();
-        String dbUrl = "jdbc:mysql://localhost:3306/mybatis-plus";
-        DataSourceConfig dataSourceConfig = new DataSourceConfig();
-        dataSourceConfig.setDbType(DbType.MYSQL)
-            .setUrl(dbUrl)
-            .setUsername("root")
-            .setPassword("")
-            .setDriverName(Driver.class.getName());
-        StrategyConfig strategyConfig = new StrategyConfig();
-        strategyConfig
-            .setCapitalMode(true)
-            .setEntityLombokModel(false)
-            // .setDbColumnUnderline(true) 改为如下 2 个配置
-            .setNaming(NamingStrategy.underline_to_camel)
-            .setColumnNaming(NamingStrategy.underline_to_camel)
-            .setEntityTableFieldAnnotationEnable(enableTableFieldAnnotation)
-            .setFieldPrefix(fieldPrefix)//test_id -> id, test_type -> type
-            .setInclude(tableNames);//修改替换成你需要的表名,多个表名传数组
-        config.setActiveRecord(false)
-            .setIdType(tableIdType)
-            .setAuthor("K神带你飞")
-            .setOutputDir("d:\\codeGen")
-            .setFileOverride(true);
-        if (!serviceClassNameStartWithI) {
-            config.setServiceName("%sService");
-        }
-        //指定自定义模板路径,注意不要带上.ftl/.vm, 会根据使用的模板引擎自动识别
-        TemplateConfig templateConfig = new TemplateConfig()
-            .setEntity("templates/entity2.java");
-        InjectionConfig injectionConfig = new InjectionConfig() {
-            //自定义属性注入:abc
-            //在.vm/ftl模板中,通过${cfg.abc}获取属性
-            @Override
-            public void initMap() {
-                Map<String, Object> map = new HashMap<>();
-                map.put("abc", this.getConfig().getGlobalConfig().getAuthor() + "-mp");
-                this.setMap(map);
-            }
-        };
-        new AutoGenerator().setGlobalConfig(config)
-            .setDataSource(dataSourceConfig)
-            .setStrategy(strategyConfig)
-            //配置自定义模板
-            .setTemplate(templateConfig)
-            //配置自定义属性注入
-            .setCfg(injectionConfig)
-            .setPackageInfo(
-                new PackageConfig()
-                    .setParent(packageName)
-                    .setController("controller")
-                    .setEntity("entity")
-            ).execute();
-    }
-}

+ 0 - 79
mybatis-plus-generator/src/test/java/com/baomidou/mybatisplus/test/generator/DB2Generator.java

@@ -1,79 +0,0 @@
-/*
- * Copyright (c) 2011-2020, baomidou (jobob@qq.com).
- * <p>
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- * <p>
- * https://www.apache.org/licenses/LICENSE-2.0
- * <p>
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-package com.baomidou.mybatisplus.test.generator;
-
-import com.baomidou.mybatisplus.annotation.DbType;
-import com.baomidou.mybatisplus.generator.AutoGenerator;
-import com.baomidou.mybatisplus.generator.config.DataSourceConfig;
-import com.baomidou.mybatisplus.generator.config.GlobalConfig;
-import com.baomidou.mybatisplus.generator.config.PackageConfig;
-import com.baomidou.mybatisplus.generator.config.StrategyConfig;
-import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy;
-
-public class DB2Generator {
-
-    public static void main(String[] args) {
-        String packageName = "com.crea.gwms";
-        boolean serviceNameStartWithI = true;//user -> UserService, 设置成true: user -> IUserService
-        generateByTables(serviceNameStartWithI, packageName, "USER");
-    }
-
-    public static void generateByTables(boolean serviceNameStartWithI, String packageName, String... tableNames) {
-        GlobalConfig config = new GlobalConfig();
-        String dbUrl = "jdbc:db2://192.168.0.227:50000/TRADECTR";
-        DataSourceConfig dataSourceConfig = new DataSourceConfig();
-        dataSourceConfig.setDbType(DbType.DB2)
-            .setUrl(dbUrl)
-            .setUsername("tc")
-            .setPassword("business")
-            .setDriverName("com.ibm.db2.jcc.DB2Driver");
-        StrategyConfig strategyConfig = new StrategyConfig();
-        strategyConfig
-            .setCapitalMode(true)
-            .setEntityLombokModel(false)
-            // .setDbColumnUnderline(true) 改为如下 2 个配置
-            .setNaming(NamingStrategy.underline_to_camel)
-            .setColumnNaming(NamingStrategy.underline_to_camel)
-            .setEntityTableFieldAnnotationEnable(true)//实体属性上添加表字段映射
-            .setInclude(tableNames);//修改替换成你需要的表名,多个表名传数组
-        config.setActiveRecord(true)
-            .setEnableCache(false)// XML 二级缓存
-            .setAuthor("zhanyao")
-            .setBaseResultMap(true)// XML ResultMap
-            .setBaseColumnList(false)// XML columList
-            .setOutputDir("/Users/zhanyao/Downloads/code")
-            .setFileOverride(true);
-        if (!serviceNameStartWithI) {
-            config.setServiceName("%sService");
-        }
-        new AutoGenerator().setGlobalConfig(config)
-            .setDataSource(dataSourceConfig)
-            .setStrategy(strategyConfig)
-            .setPackageInfo(
-                new PackageConfig()
-                    .setParent(packageName)
-                    .setController("controller")
-                    .setMapper("dao")
-                    .setEntity("bean")
-            ).execute();
-    }
-
-    @SuppressWarnings("unused")
-	private void generateByTables(String packageName, String... tableNames) {
-        generateByTables(true, packageName, tableNames);
-    }
-
-}

Alguns arquivos não foram mostrados porque muitos arquivos mudaram nesse diff