diff --git a/README.md b/README.md
index 9299acad..9f6f5750 100644
--- a/README.md
+++ b/README.md
@@ -10,7 +10,7 @@ mybatis-generator-gui是基于[mybatis generator](http://www.mybatis.org/generat
* 保存数据库连接与配置,每次代码生成轻松搞定
* 内置常用插件,比如offset
* 可选的去除掉对版本管理不友好的注释,这样新增或删除字段重新生成的文件比较过来清楚
-* 目前仅支持Mysql与Oracle,如果有对其它数据库有需求的请提Issue我会跟进。
+* 目前已经支持Mysql、Oracle与PostgreSQL,如果有对其它数据库有需求的请提Issue我会跟进。
### 要求
本工具由于使用了Java 8的众多特性,所以要求 JRE或者JDK 8.0以上版本,对于JDK版本还没有升级的童鞋表示歉意。
diff --git a/pom.xml b/pom.xml
index da836397..bc1fd606 100644
--- a/pom.xml
+++ b/pom.xml
@@ -48,6 +48,11 @@
system
${project.basedir}/src/main/resources/lib/ojdbc14.jar
+
+ org.postgresql
+ postgresql
+ 9.4.1209
+
com.alibaba
fastjson
diff --git a/src/main/java/com/zzg/mybatis/generator/controller/BaseFXController.java b/src/main/java/com/zzg/mybatis/generator/controller/BaseFXController.java
index 39eb5581..e6bc2c4f 100644
--- a/src/main/java/com/zzg/mybatis/generator/controller/BaseFXController.java
+++ b/src/main/java/com/zzg/mybatis/generator/controller/BaseFXController.java
@@ -26,9 +26,9 @@ public abstract class BaseFXController implements Initializable {
private static Map> cacheNodeMap = new HashMap<>();
- public BaseFXController loadFXMLPage(String title, FXMLPage fxmlPage) {
+ public BaseFXController loadFXMLPage(String title, FXMLPage fxmlPage, boolean cache) {
SoftReference extends BaseFXController> parentNodeRef = cacheNodeMap.get(fxmlPage);
- if (parentNodeRef != null) {
+ if (cache && parentNodeRef != null) {
return parentNodeRef.get();
}
URL skeletonResource = Thread.currentThread().getContextClassLoader().getResource(fxmlPage.getFxml());
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 866ebbaf..c7201240 100644
--- a/src/main/java/com/zzg/mybatis/generator/controller/MainUIController.java
+++ b/src/main/java/com/zzg/mybatis/generator/controller/MainUIController.java
@@ -99,8 +99,9 @@ public void initialize(URL location, ResourceBundle resources) {
dbImage.setFitWidth(40);
connectionLabel.setGraphic(dbImage);
connectionLabel.setOnMouseClicked(event -> {
- NewConnectionController controller = (NewConnectionController) loadFXMLPage("New Connection", FXMLPage.NEW_CONNECTION);
+ NewConnectionController controller = (NewConnectionController) loadFXMLPage("New Connection", FXMLPage.NEW_CONNECTION, false);
controller.setMainUIController(this);
+ controller.showDialogStage();
});
leftDBTree.setShowRoot(false);
@@ -260,7 +261,7 @@ public void openTableColumnCustomizationPage() {
AlertUtil.showErrorAlert("Please select table from left DB treee first");
return;
}
- SelectTableColumnController controller = (SelectTableColumnController) loadFXMLPage("Select Columns", FXMLPage.SELECT_TABLE_COLUMN);
+ SelectTableColumnController controller = (SelectTableColumnController) loadFXMLPage("Select Columns", FXMLPage.SELECT_TABLE_COLUMN, true);
controller.setMainUIController(this);
try {
// If select same schema and another table, update table data
diff --git a/src/main/java/com/zzg/mybatis/generator/model/DbType.java b/src/main/java/com/zzg/mybatis/generator/model/DbType.java
index 971e2ea8..b838174c 100644
--- a/src/main/java/com/zzg/mybatis/generator/model/DbType.java
+++ b/src/main/java/com/zzg/mybatis/generator/model/DbType.java
@@ -6,7 +6,8 @@
public enum DbType {
MySQL("com.mysql.jdbc.Driver", "jdbc:mysql://%s:%s/%s?useUnicode=true&useSSL=false&characterEncoding=%s"),
- Oracle("oracle.jdbc.driver.OracleDriver", "jdbc:oracle:thin:@%s:%s:%s");
+ Oracle("oracle.jdbc.driver.OracleDriver", "jdbc:oracle:thin:@%s:%s:%s"),
+ PostgreSQL("org.postgresql.Driver", "jdbc:postgresql://%s:%s/%s");
private final String driverClass;
private final String connectionUrlPattern;
diff --git a/src/main/resources/fxml/newConnection.fxml b/src/main/resources/fxml/newConnection.fxml
index 12bf2e3d..03b3f8a3 100644
--- a/src/main/resources/fxml/newConnection.fxml
+++ b/src/main/resources/fxml/newConnection.fxml
@@ -34,6 +34,7 @@
+