Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
SunZongming committed Aug 7, 2017
1 parent dc443a2 commit 0fdb978
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,12 @@ public void generate() throws Exception {
TableConfiguration tableConfig = new TableConfiguration(context);
tableConfig.setTableName(generatorConfig.getTableName());
tableConfig.setDomainObjectName(generatorConfig.getDomainObjectName());

// 针对 postgresql 单独配置
if (DbType.valueOf(selectedDatabaseConfig.getDbType()).getDriverClass() == "org.postgresql.Driver") {
tableConfig.setDelimitIdentifiers(true);
}

//添加GeneratedKey主键生成
if (StringUtils.isNoneEmpty(generatorConfig.getGenerateKeys())) {
tableConfig.setGeneratedKey(new GeneratedKey(generatorConfig.getGenerateKeys(), selectedDatabaseConfig.getDbType(), true, null));
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/com/zzg/mybatis/generator/util/DbUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ public static List<String> getTableNames(DatabaseConfig config) throws Exception
} else if (DbType.valueOf(config.getDbType()) == DbType.Oracle){
rs = md.getTables(null, config.getUsername().toUpperCase(), null, new String[] {"TABLE", "VIEW"});
} else {
rs = md.getTables(null, config.getUsername().toUpperCase(), null, null);
// rs = md.getTables(null, config.getUsername().toUpperCase(), null, null);
rs = md.getTables(null, "%", "%", new String[] {"TABLE", "VIEW"}); //针对 postgresql 的左侧数据表显示
}
while (rs.next()) {
tables.add(rs.getString(3));
Expand Down

0 comments on commit 0fdb978

Please sign in to comment.