Browse Source

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

pull/120/head
xuyuxiang 2 years ago
parent
commit
7013fd1568
  1. 4
      snowy-plugin/snowy-plugin-gen/src/main/java/vip/xiaonuo/gen/modular/basic/service/impl/GenBasicServiceImpl.java
  2. 12
      snowy-web-app/src/main/java/vip/xiaonuo/core/config/GlobalConfigure.java

4
snowy-plugin/snowy-plugin-gen/src/main/java/vip/xiaonuo/gen/modular/basic/service/impl/GenBasicServiceImpl.java

@ -268,11 +268,11 @@ public class GenBasicServiceImpl extends ServiceImpl<GenBasicMapper, GenBasic> i
DatabaseMetaData metaData = conn.getMetaData();
String url = metaData.getURL();
String schema = null;
if (url.toLowerCase().contains("oracle")) {
if (url.toLowerCase().contains("jdbc:oracle")) {
schema = metaData.getUserName();
}
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()) {
String tableName = rs.getString("TABLE_NAME");
if (!StrUtil.startWithIgnoreCase(tableName, "ACT_")) {

12
snowy-web-app/src/main/java/vip/xiaonuo/core/config/GlobalConfigure.java

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

Loading…
Cancel
Save