Skip to content

Commit f07318a

Browse files
committed
fix > issue #45
1 parent e800911 commit f07318a

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/test/java/CodeGenerator.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public class CodeGenerator {
3838

3939
public static void main(String[] args) {
4040
genCode("输入表名");
41-
//genCode("输入表名","输入自定义Model名称");
41+
//genCodeByCustomModelName("输入表名","输入自定义Model名称");
4242
}
4343

4444
/**
@@ -48,7 +48,7 @@ public static void main(String[] args) {
4848
*/
4949
public static void genCode(String... tableNames) {
5050
for (String tableName : tableNames) {
51-
genCode(tableName, null);
51+
genCodeByCustomModelName(tableName, null);
5252
}
5353
}
5454

@@ -58,7 +58,7 @@ public static void genCode(String... tableNames) {
5858
* @param tableName 数据表名称
5959
* @param modelName 自定义的 Model 名称
6060
*/
61-
public static void genCode(String tableName, String modelName) {
61+
public static void genCodeByCustomModelName(String tableName, String modelName) {
6262
genModelAndMapper(tableName, modelName);
6363
genService(tableName, modelName);
6464
genController(tableName, modelName);
@@ -102,7 +102,7 @@ public static void genModelAndMapper(String tableName, String modelName) {
102102

103103
TableConfiguration tableConfiguration = new TableConfiguration(context);
104104
tableConfiguration.setTableName(tableName);
105-
tableConfiguration.setDomainObjectName(modelName);
105+
if (StringUtils.isNotEmpty(modelName))tableConfiguration.setDomainObjectName(modelName);
106106
tableConfiguration.setGeneratedKey(new GeneratedKey("id", "Mysql", true, null));
107107
context.addTableConfiguration(tableConfiguration);
108108

0 commit comments

Comments
 (0)