【更新】完善数据库的判断

pull/120/head
xuyuxiang 2 years ago
parent c71f33fd98
commit 7013fd1568

@ -268,11 +268,11 @@ public class GenBasicServiceImpl extends ServiceImpl<GenBasicMapper, GenBasic> i
DatabaseMetaData metaData = conn.getMetaData(); DatabaseMetaData metaData = conn.getMetaData();
String url = metaData.getURL(); String url = metaData.getURL();
String schema = null; String schema = null;
if (url.toLowerCase().contains("oracle")) { if (url.toLowerCase().contains("jdbc:oracle")) {
schema = metaData.getUserName(); schema = metaData.getUserName();
} }
List<GenBasicTableResult> tables = new ArrayList<>(); List<GenBasicTableResult> tables = new ArrayList<>();
rs = metaData.getTables(null, schema, "%", new String[]{"TABLE", "VIEW"}); rs = metaData.getTables(null, schema, "%", new String[]{"TABLE"});
while (rs.next()) { while (rs.next()) {
String tableName = rs.getString("TABLE_NAME"); String tableName = rs.getString("TABLE_NAME");
if (!StrUtil.startWithIgnoreCase(tableName, "ACT_")) { if (!StrUtil.startWithIgnoreCase(tableName, "ACT_")) {

@ -509,16 +509,16 @@ public class GlobalConfigure implements WebMvcConfigurer {
@Override @Override
public String getDatabaseId(DataSource dataSource) throws SQLException { public String getDatabaseId(DataSource dataSource) throws SQLException {
String url = dataSource.getConnection().getMetaData().getURL(); String url = dataSource.getConnection().getMetaData().getURL().toLowerCase();
if (url.contains("oracle")) { if (url.contains("jdbc:oracle")) {
return "oracle"; return "oracle";
} else if (url.contains("postgresql")) { } else if (url.contains("jdbc:postgresql")) {
return "pgsql"; return "pgsql";
} else if (url.contains("mysql")) { } else if (url.contains("jdbc:mysql")) {
return "mysql"; return "mysql";
} else if (url.contains("dm")) { } else if (url.contains("jdbc:dm")) {
return "dm"; return "dm";
} else if (url.contains("kingbase")) { } else if (url.contains("jdbc:kingbase")) {
return "kingbase"; return "kingbase";
} else { } else {
return "mysql"; return "mysql";

Loading…
Cancel
Save