浏览代码

删掉无用代码.

nieqiurong 4 年之前
父节点
当前提交
aaedb6bb2a

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

@@ -154,9 +154,9 @@ public class AutoGenerator {
                 tableInfo.setImportPackages(Version.class.getCanonicalName());
             }
             boolean importSerializable = true;
-            if (StringUtils.isNotBlank(config.getSuperEntityClass())) {
+            if (StringUtils.isNotBlank(config.getStrategyConfig().getSuperEntityClass())) {
                 // 父实体
-                tableInfo.setImportPackages(config.getSuperEntityClass());
+                tableInfo.setImportPackages(config.getStrategyConfig().getSuperEntityClass());
                 importSerializable = false;
             }
             if (config.getGlobalConfig().isActiveRecord()) {

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

@@ -56,14 +56,6 @@ public class ConfigBuilder {
      * SQL连接
      */
     private final Connection connection;
-    private String superEntityClass;
-    private String superMapperClass;
-    /**
-     * service超类定义
-     */
-    private String superServiceClass;
-    private String superServiceImplClass;
-    private String superControllerClass;
     /**
      * 数据库表信息
      */
@@ -118,8 +110,7 @@ public class ConfigBuilder {
         this.connection = dataSourceConfig.getConn();
         // 策略配置
         this.strategyConfig = Optional.ofNullable(strategyConfig).orElseGet(StrategyConfig::new);
-
-        handlerStrategy(this.strategyConfig);
+        this.tableInfoList = getTablesInfo(this.strategyConfig);
     }
 
     // ************************ 曝露方法 BEGIN*****************************
@@ -143,37 +134,6 @@ public class ConfigBuilder {
         return pathInfo;
     }
 
-
-    public String getSuperEntityClass() {
-        return superEntityClass;
-    }
-
-
-    public String getSuperMapperClass() {
-        return superMapperClass;
-    }
-
-
-    /**
-     * 获取超类定义
-     *
-     * @return 完整超类名称
-     */
-    public String getSuperServiceClass() {
-        return superServiceClass;
-    }
-
-
-    public String getSuperServiceImplClass() {
-        return superServiceImplClass;
-    }
-
-
-    public String getSuperControllerClass() {
-        return superControllerClass;
-    }
-
-
     /**
      * 表信息
      *
@@ -188,7 +148,6 @@ public class ConfigBuilder {
         return this;
     }
 
-
     /**
      * 模板路径配置信息
      *
@@ -240,47 +199,6 @@ public class ConfigBuilder {
         }
     }
 
-    /**
-     * 处理数据库表 加载数据库表、列、注释相关数据集
-     *
-     * @param config StrategyConfig
-     */
-    private void handlerStrategy(StrategyConfig config) {
-        processTypes(config);
-        tableInfoList = getTablesInfo(config);
-    }
-
-
-    /**
-     * 处理superClassName,IdClassType,IdStrategy配置
-     *
-     * @param config 策略配置
-     */
-    private void processTypes(StrategyConfig config) {
-        this.superServiceClass = getValueOrDefault(config.getSuperServiceClass(), ConstVal.SUPER_SERVICE_CLASS);
-        this.superServiceImplClass = getValueOrDefault(config.getSuperServiceImplClass(), ConstVal.SUPER_SERVICE_IMPL_CLASS);
-        this.superMapperClass = getValueOrDefault(config.getSuperMapperClass(), ConstVal.SUPER_MAPPER_CLASS);
-        superEntityClass = config.getSuperEntityClass();
-        superControllerClass = config.getSuperControllerClass();
-    }
-
-    private static String getValueOrDefault(String value, String defaultValue) {
-        return StringUtils.isBlank(value) ? defaultValue : value;
-    }
-
-    /**
-     * 处理表对应的类名称
-     *
-     * @param tableList 表名称
-     * @param config    策略配置项
-     * @return 补充完整信息后的表
-     * @deprecated 3.3.2
-     */
-    @Deprecated
-    private List<TableInfo> processTable(List<TableInfo> tableList, NamingStrategy strategy, StrategyConfig config) {
-        return processTable(tableList, config);
-    }
-
     /**
      * 处理表对应的类名称
      *
@@ -546,8 +464,6 @@ public class ConfigBuilder {
                 tableFieldsSql = String.format(tableFieldsSql, dataSourceConfig.getSchemaName(), tableName);
             } else if (DbType.KINGBASE_ES == dbType) {
                 tableFieldsSql = String.format(tableFieldsSql, dataSourceConfig.getSchemaName(), tableName);
-            } else if (DbType.OSCAR == dbType) {
-                tableFieldsSql = String.format(tableFieldsSql, tableName);
             } else if (DbType.DB2 == dbType) {
                 tableFieldsSql = String.format(tableFieldsSql, dataSourceConfig.getSchemaName(), tableName);
             } else if (DbType.ORACLE == dbType) {

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

@@ -21,8 +21,8 @@ package com.baomidou.mybatisplus.generator.config.querys;
  * @author halower
  * @since 2019-06-27
  */
-public class DMQuery  extends AbstractDbQuery{
-    
+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 " +

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

@@ -15,9 +15,6 @@
  */
 package com.baomidou.mybatisplus.generator.config.querys;
 
-import java.sql.ResultSet;
-import java.sql.SQLException;
-
 /**
  * MySql 表数据查询
  *

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

@@ -132,7 +132,7 @@ public abstract class AbstractTemplateEngine {
         }
         return this;
     }
-    
+
     protected void writerFile(Map<String, Object> objectMap, String templatePath, String outputFile) throws Exception {
         if (StringUtils.isNotBlank(templatePath)) this.writer(objectMap, templatePath, outputFile);
     }
@@ -227,15 +227,15 @@ public abstract class AbstractTemplateEngine {
         objectMap.put("chainModel", config.getStrategyConfig().isChainModel());
         objectMap.put("entityLombokModel", config.getStrategyConfig().isEntityLombokModel());
         objectMap.put("entityBooleanColumnRemoveIsPrefix", config.getStrategyConfig().isEntityBooleanColumnRemoveIsPrefix());
-        objectMap.put("superEntityClass", getSuperClassName(config.getSuperEntityClass()));
-        objectMap.put("superMapperClassPackage", config.getSuperMapperClass());
-        objectMap.put("superMapperClass", getSuperClassName(config.getSuperMapperClass()));
-        objectMap.put("superServiceClassPackage", config.getSuperServiceClass());
-        objectMap.put("superServiceClass", getSuperClassName(config.getSuperServiceClass()));
-        objectMap.put("superServiceImplClassPackage", config.getSuperServiceImplClass());
-        objectMap.put("superServiceImplClass", getSuperClassName(config.getSuperServiceImplClass()));
-        objectMap.put("superControllerClassPackage", verifyClassPacket(config.getSuperControllerClass()));
-        objectMap.put("superControllerClass", getSuperClassName(config.getSuperControllerClass()));
+        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);
     }