diff --git a/README.md b/README.md
index 97792eb9..4ec8e3b4 100644
--- a/README.md
+++ b/README.md
@@ -29,11 +29,23 @@ mybatis-generator-gui是基于[mybatis generator](http://www.mybatis.org/generat
cd target/jfx/app/
java -jar mybatis-generator-gui.jar
```
-
+
* 方法二: IDE中运行
Eclipse or IntelliJ IDEA中启动, 找到```com.zzg.mybatis.generator.MainUI```类并运行就可以了
+- 方法三:打包为本地原生应用,双击快捷方式即可启动,方便快捷
+
+ 如果不想打包后的安装包logo为Java的灰色的茶杯,需要在pom文件里将对应操作系统平台的图标注释放开
+
+```bash
+ #${project.basedir}/package/windows/mybatis-generator-gui.ico为windows
+ #${project.basedir}/package/macosx/mybatis-generator-gui.icns为mac
+ mvn jfx:native
+```
+
+ 另外需要注意,windows系统打包成exe的话需要安装WiXToolset3+的环境;由于打包后会把jre打入安装包,两个平台均100M左右,体积较大请自行打包;打包后的安装包在target/jfx/native目录下
+
### 文档
更多详细文档请参考本库的Wiki
diff --git a/package/macosx/mybatis-generator-gui.icns b/package/macosx/mybatis-generator-gui.icns
new file mode 100644
index 00000000..b1b5a0a2
Binary files /dev/null and b/package/macosx/mybatis-generator-gui.icns differ
diff --git a/package/windows/mybatis-generator-gui.ico b/package/windows/mybatis-generator-gui.ico
new file mode 100755
index 00000000..7fba0197
Binary files /dev/null and b/package/windows/mybatis-generator-gui.ico differ
diff --git a/pom.xml b/pom.xml
index 457f67c5..76f1adfd 100644
--- a/pom.xml
+++ b/pom.xml
@@ -75,6 +75,12 @@
javafx-maven-plugin
8.8.3
+
+
+ ${project.basedir}/package/windows/mybatis-generator-gui.ico
+
+ ${project.basedir}/package/macosx/mybatis-generator-gui.icns
+
com.zzg.mybatis.generator.MainUI
Owen Zou
false
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 b97fe0d6..f2e8de18 100644
--- a/src/main/java/com/zzg/mybatis/generator/bridge/MybatisGeneratorBridge.java
+++ b/src/main/java/com/zzg/mybatis/generator/bridge/MybatisGeneratorBridge.java
@@ -76,7 +76,16 @@ public void generate() throws Exception {
} else {
tableConfig.setCatalog(selectedDatabaseConfig.getSchema());
}
-
+ if (generatorConfig.isUseSchemaPrefix()) {
+ if (DbType.MySQL.name().equals(selectedDatabaseConfig.getDbType())) {
+ tableConfig.setSchema(selectedDatabaseConfig.getSchema());
+ } else if (DbType.Oracle.name().equals(selectedDatabaseConfig.getDbType())) {
+ //Oracle的schema为用户名,如果连接用户拥有dba等高级权限,若不设schema,会导致把其他用户下同名的表也生成一遍导致mapper中代码重复
+ tableConfig.setSchema(selectedDatabaseConfig.getUsername());
+ } else {
+ tableConfig.setCatalog(selectedDatabaseConfig.getSchema());
+ }
+ }
// 针对 postgresql 单独配置
if (DbType.valueOf(selectedDatabaseConfig.getDbType()).getDriverClass() == "org.postgresql.Driver") {
tableConfig.setDelimitIdentifiers(true);
diff --git a/src/main/java/com/zzg/mybatis/generator/controller/MainUIController.java b/src/main/java/com/zzg/mybatis/generator/controller/MainUIController.java
index a47d082e..595d5007 100644
--- a/src/main/java/com/zzg/mybatis/generator/controller/MainUIController.java
+++ b/src/main/java/com/zzg/mybatis/generator/controller/MainUIController.java
@@ -81,6 +81,8 @@ public class MainUIController extends BaseFXController {
@FXML
private CheckBox useExample;
@FXML
+ private CheckBox useSchemaPrefix;
+ @FXML
private TreeView leftDBTree;
// Current selected databaseConfig
private DatabaseConfig selectedDatabaseConfig;
@@ -321,6 +323,7 @@ public GeneratorConfig getGeneratorConfigFromUI() {
generatorConfig.setUseActualColumnNames(useActualColumnNamesCheckbox.isSelected());
generatorConfig.setEncoding(encodingChoice.getValue());
generatorConfig.setUseExampe(useExample.isSelected());
+ generatorConfig.setUseSchemaPrefix(useSchemaPrefix.isSelected());
return generatorConfig;
}
diff --git a/src/main/java/com/zzg/mybatis/generator/model/GeneratorConfig.java b/src/main/java/com/zzg/mybatis/generator/model/GeneratorConfig.java
index 052be26d..794da88b 100644
--- a/src/main/java/com/zzg/mybatis/generator/model/GeneratorConfig.java
+++ b/src/main/java/com/zzg/mybatis/generator/model/GeneratorConfig.java
@@ -56,6 +56,16 @@ public class GeneratorConfig {
private boolean useTableNameAlias;
+ private boolean useSchemaPrefix;
+
+ public boolean isUseSchemaPrefix() {
+ return useSchemaPrefix;
+ }
+
+ public void setUseSchemaPrefix(boolean useSchemaPrefix) {
+ this.useSchemaPrefix = useSchemaPrefix;
+ }
+
public boolean isUseExampe() {
return useExampe;
}
diff --git a/src/main/resources/fxml/MainUI.fxml b/src/main/resources/fxml/MainUI.fxml
index 6212cfbf..572c2d0a 100644
--- a/src/main/resources/fxml/MainUI.fxml
+++ b/src/main/resources/fxml/MainUI.fxml
@@ -190,17 +190,18 @@
-
+
+
-
-
+
+