From bcc9dc85368dbf60be7cbe619f825c862a943017 Mon Sep 17 00:00:00 2001 From: Owen Zou Date: Wed, 21 Dec 2016 17:34:38 +0800 Subject: [PATCH] improve generatedKey prompt text and set is as optional --- .../mybatis/generator/bridge/MybatisGeneratorBridge.java | 7 +++++-- src/main/resources/fxml/MainUI.fxml | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/zzg/mybatis/generator/bridge/MybatisGeneratorBridge.java b/src/main/java/com/zzg/mybatis/generator/bridge/MybatisGeneratorBridge.java index 1112115d..68a6d62d 100644 --- a/src/main/java/com/zzg/mybatis/generator/bridge/MybatisGeneratorBridge.java +++ b/src/main/java/com/zzg/mybatis/generator/bridge/MybatisGeneratorBridge.java @@ -6,6 +6,7 @@ import com.zzg.mybatis.generator.plugins.DbRemarksCommentGenerator; import com.zzg.mybatis.generator.util.ConfigHelper; import com.zzg.mybatis.generator.util.DbUtil; +import org.apache.commons.lang3.StringUtils; import org.mybatis.generator.api.MyBatisGenerator; import org.mybatis.generator.api.ProgressCallback; import org.mybatis.generator.api.ShellCallback; @@ -64,8 +65,10 @@ public void generate() throws Exception { tableConfig.setTableName(generatorConfig.getTableName()); tableConfig.setDomainObjectName(generatorConfig.getDomainObjectName()); //添加GeneratedKey主键生成 - tableConfig.setGeneratedKey(new GeneratedKey(generatorConfig.getGenerateKeys(), selectedDatabaseConfig.getDbType(), true, null)); - + if (StringUtils.isNoneEmpty(generatorConfig.getGenerateKeys())) { + tableConfig.setGeneratedKey(new GeneratedKey(generatorConfig.getGenerateKeys(), selectedDatabaseConfig.getDbType(), true, null)); + } + if (generatorConfig.getMapperName() != null) { tableConfig.setMapperName(generatorConfig.getMapperName()); } diff --git a/src/main/resources/fxml/MainUI.fxml b/src/main/resources/fxml/MainUI.fxml index 1f5c04c4..d9d42710 100644 --- a/src/main/resources/fxml/MainUI.fxml +++ b/src/main/resources/fxml/MainUI.fxml @@ -123,7 +123,7 @@