diff --git a/mybatis-flex-codegen/src/main/java/com/mybatisflex/codegen/config/GlobalConfig.java b/mybatis-flex-codegen/src/main/java/com/mybatisflex/codegen/config/GlobalConfig.java index 6e83f36b..57885847 100644 --- a/mybatis-flex-codegen/src/main/java/com/mybatisflex/codegen/config/GlobalConfig.java +++ b/mybatis-flex-codegen/src/main/java/com/mybatisflex/codegen/config/GlobalConfig.java @@ -234,7 +234,14 @@ public class GlobalConfig { return packageInfoGenerateEnable; } - public void addCustomConfig(String key, Object value) { + public Object getCustomConfig(String key) { + if (customConfig != null) { + return customConfig.get(key); + } + return null; + } + + public void setCustomConfig(String key, Object value) { if (customConfig == null) { customConfig = new HashMap<>(); } diff --git a/mybatis-flex-codegen/src/main/java/com/mybatisflex/codegen/config/StrategyConfig.java b/mybatis-flex-codegen/src/main/java/com/mybatisflex/codegen/config/StrategyConfig.java index 4ee35977..b6dc157a 100644 --- a/mybatis-flex-codegen/src/main/java/com/mybatisflex/codegen/config/StrategyConfig.java +++ b/mybatis-flex-codegen/src/main/java/com/mybatisflex/codegen/config/StrategyConfig.java @@ -70,7 +70,7 @@ public class StrategyConfig { */ private Set unGenerateTables; - public void addTableConfig(TableConfig tableConfig) { + public void setTableConfig(TableConfig tableConfig) { if (tableConfigMap == null) { tableConfigMap = new HashMap<>(); } @@ -81,19 +81,19 @@ public class StrategyConfig { return tableConfigMap == null ? null : tableConfigMap.get(tableName); } - public void addColumnConfig(ColumnConfig columnConfig) { + public void setColumnConfig(ColumnConfig columnConfig) { if (columnConfigMap == null) { columnConfigMap = new HashMap<>(); } columnConfigMap.put(columnConfig.getColumnName(), columnConfig); } - public void addColumnConfig(String tableName, ColumnConfig columnConfig) { + public void setColumnConfig(String tableName, ColumnConfig columnConfig) { TableConfig tableConfig = getTableConfig(tableName); if (tableConfig == null) { tableConfig = new TableConfig(); tableConfig.setTableName(tableName); - addTableConfig(tableConfig); + setTableConfig(tableConfig); } tableConfig.addColumnConfig(columnConfig); @@ -129,7 +129,7 @@ public class StrategyConfig { return columnConfig; } - public void addGenerateTable(String... tables) { + public void setGenerateTable(String... tables) { if (generateTables == null) { generateTables = new HashSet<>(); } @@ -141,7 +141,7 @@ public class StrategyConfig { } } - public void addUnGenerateTable(String... tables) { + public void setUnGenerateTable(String... tables) { if (unGenerateTables == null) { unGenerateTables = new HashSet<>(); } diff --git a/mybatis-flex-codegen/src/main/java/com/mybatisflex/codegen/generator/IGenerator.java b/mybatis-flex-codegen/src/main/java/com/mybatisflex/codegen/generator/IGenerator.java index 4d653e85..a291e524 100644 --- a/mybatis-flex-codegen/src/main/java/com/mybatisflex/codegen/generator/IGenerator.java +++ b/mybatis-flex-codegen/src/main/java/com/mybatisflex/codegen/generator/IGenerator.java @@ -1,17 +1,17 @@ -/** - * Copyright (c) 2022-2023, Mybatis-Flex (fuhai999@gmail.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. +/* + * Copyright (c) 2022-2023, Mybatis-Flex (fuhai999@gmail.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.mybatisflex.codegen.generator; @@ -26,26 +26,26 @@ import com.mybatisflex.codegen.entity.Table; */ public interface IGenerator { - /** - * 获取模板文件位置。 - * - * @return 路径 - */ - String getTemplatePath(); + /** + * 获取模板文件位置。 + * + * @return 路径 + */ + String getTemplatePath(); - /** - * 设置模板文件位置。 - * - * @param templatePath - */ - void setTemplatePath(String templatePath); + /** + * 设置模板文件位置。 + * + * @param templatePath + */ + void setTemplatePath(String templatePath); - /** - * 根据模板生成文件。 - * - * @param table 表内容 - * @param globalConfig 全局配置 - */ - void generate(Table table, GlobalConfig globalConfig); + /** + * 根据模板生成文件。 + * + * @param table 表内容 + * @param globalConfig 全局配置 + */ + void generate(Table table, GlobalConfig globalConfig); }