add
This commit is contained in:
@ -82,4 +82,15 @@ public enum DataBaseEnum {
|
||||
}
|
||||
throw new ServiceException(StrUtil.format("未找到数据库checkSql, Type: {}", type));
|
||||
}
|
||||
|
||||
public static String getIp(String url, String driver) {
|
||||
for (DataBaseEnum dataBaseEnum : values()) {
|
||||
if (dataBaseEnum.getDriver().equals(driver)) {
|
||||
url = url.replaceFirst(url.substring(0, dataBaseEnum.url.indexOf(StrUtil.EMPTY_JSON)), "");
|
||||
return url.split(StrUtil.COLON)[0];
|
||||
}
|
||||
}
|
||||
throw new ServiceException(StrUtil.format("未找到数据库IP, Driver: {}", driver));
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user