style: 代码格式更新。

This commit is contained in:
Suomm 2023-05-18 12:33:11 +08:00
parent 51acb6df3f
commit 6729860e03
3 changed files with 47 additions and 40 deletions

View File

@ -234,7 +234,14 @@ public class GlobalConfig {
return packageInfoGenerateEnable; 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) { if (customConfig == null) {
customConfig = new HashMap<>(); customConfig = new HashMap<>();
} }

View File

@ -70,7 +70,7 @@ public class StrategyConfig {
*/ */
private Set<String> unGenerateTables; private Set<String> unGenerateTables;
public void addTableConfig(TableConfig tableConfig) { public void setTableConfig(TableConfig tableConfig) {
if (tableConfigMap == null) { if (tableConfigMap == null) {
tableConfigMap = new HashMap<>(); tableConfigMap = new HashMap<>();
} }
@ -81,19 +81,19 @@ public class StrategyConfig {
return tableConfigMap == null ? null : tableConfigMap.get(tableName); return tableConfigMap == null ? null : tableConfigMap.get(tableName);
} }
public void addColumnConfig(ColumnConfig columnConfig) { public void setColumnConfig(ColumnConfig columnConfig) {
if (columnConfigMap == null) { if (columnConfigMap == null) {
columnConfigMap = new HashMap<>(); columnConfigMap = new HashMap<>();
} }
columnConfigMap.put(columnConfig.getColumnName(), columnConfig); columnConfigMap.put(columnConfig.getColumnName(), columnConfig);
} }
public void addColumnConfig(String tableName, ColumnConfig columnConfig) { public void setColumnConfig(String tableName, ColumnConfig columnConfig) {
TableConfig tableConfig = getTableConfig(tableName); TableConfig tableConfig = getTableConfig(tableName);
if (tableConfig == null) { if (tableConfig == null) {
tableConfig = new TableConfig(); tableConfig = new TableConfig();
tableConfig.setTableName(tableName); tableConfig.setTableName(tableName);
addTableConfig(tableConfig); setTableConfig(tableConfig);
} }
tableConfig.addColumnConfig(columnConfig); tableConfig.addColumnConfig(columnConfig);
@ -129,7 +129,7 @@ public class StrategyConfig {
return columnConfig; return columnConfig;
} }
public void addGenerateTable(String... tables) { public void setGenerateTable(String... tables) {
if (generateTables == null) { if (generateTables == null) {
generateTables = new HashSet<>(); generateTables = new HashSet<>();
} }
@ -141,7 +141,7 @@ public class StrategyConfig {
} }
} }
public void addUnGenerateTable(String... tables) { public void setUnGenerateTable(String... tables) {
if (unGenerateTables == null) { if (unGenerateTables == null) {
unGenerateTables = new HashSet<>(); unGenerateTables = new HashSet<>();
} }

View File

@ -1,17 +1,17 @@
/** /*
* Copyright (c) 2022-2023, Mybatis-Flex (fuhai999@gmail.com). * Copyright (c) 2022-2023, Mybatis-Flex (fuhai999@gmail.com).
* <p> * <p>
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* <p> * <p>
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* <p> * <p>
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package com.mybatisflex.codegen.generator; package com.mybatisflex.codegen.generator;
@ -26,26 +26,26 @@ import com.mybatisflex.codegen.entity.Table;
*/ */
public interface IGenerator { public interface IGenerator {
/** /**
* 获取模板文件位置 * 获取模板文件位置
* *
* @return 路径 * @return 路径
*/ */
String getTemplatePath(); String getTemplatePath();
/** /**
* 设置模板文件位置 * 设置模板文件位置
* *
* @param templatePath * @param templatePath
*/ */
void setTemplatePath(String templatePath); void setTemplatePath(String templatePath);
/** /**
* 根据模板生成文件 * 根据模板生成文件
* *
* @param table 表内容 * @param table 表内容
* @param globalConfig 全局配置 * @param globalConfig 全局配置
*/ */
void generate(Table table, GlobalConfig globalConfig); void generate(Table table, GlobalConfig globalConfig);
} }