add
This commit is contained in:
@ -0,0 +1,43 @@
|
||||
package com.qiaoba.common.base.code;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* 数据源错误信息
|
||||
*
|
||||
* @author ailanyin
|
||||
* @version 1.0
|
||||
* @since 2023/6/27 9:22
|
||||
*/
|
||||
@Getter
|
||||
public enum DatasourceErrorCode {
|
||||
|
||||
/**
|
||||
* 未找到
|
||||
*/
|
||||
NOT_FIND(50101, "未找到数据源信息"),
|
||||
|
||||
/**
|
||||
* 连接错误
|
||||
*/
|
||||
CONNECT_ERROR(50102, "数据源无法连接"),
|
||||
|
||||
/**
|
||||
* 切换模式错误
|
||||
*/
|
||||
SWITCH_SCHEMA_ERROR(50103, "切换模式错误"),
|
||||
|
||||
/**
|
||||
* 创建表错误
|
||||
*/
|
||||
CREATE_TABLE_ERROR(50104, "创建表错误");
|
||||
|
||||
private final Integer code;
|
||||
private final String msg;
|
||||
|
||||
DatasourceErrorCode(Integer code, String msg) {
|
||||
this.code = code;
|
||||
this.msg = msg;
|
||||
}
|
||||
|
||||
}
|
@ -38,7 +38,7 @@ public enum DataBaseEnum {
|
||||
* PostgreSQL
|
||||
*/
|
||||
POSTGRE_SQL("PostgreSQL",
|
||||
"jdbc:postgresql://{}:{}/mydb?currentSchema={}&useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true&allowMultiQueries=true",
|
||||
"jdbc:postgresql://{}:{}/{}?currentSchema={}&useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true&allowMultiQueries=true",
|
||||
"org.postgresql.Driver",
|
||||
"SELECT 1"),
|
||||
|
||||
@ -65,10 +65,10 @@ public enum DataBaseEnum {
|
||||
throw new ServiceException(StrUtil.format("未找到数据库驱动, Type: {}", type));
|
||||
}
|
||||
|
||||
public static String getUrl(String type, String ip, String port, String database) {
|
||||
public static String getUrl(String type, String ip, String port, String dbName, String schema) {
|
||||
for (DataBaseEnum dataBaseEnum : values()) {
|
||||
if (dataBaseEnum.getType().equals(type)) {
|
||||
return StrUtil.format(dataBaseEnum.url, ip, port, database);
|
||||
return StrUtil.format(dataBaseEnum.url, ip, port, dbName, schema);
|
||||
}
|
||||
}
|
||||
throw new ServiceException(StrUtil.format("未找到数据库Url, Type: {}", type));
|
||||
|
@ -17,7 +17,7 @@ public class AjaxResult extends HashMap<String, Object> {
|
||||
/**
|
||||
* 状态码
|
||||
*/
|
||||
public static final String CODE_TAG = "code";
|
||||
public static final String CODE_TAG = "result";
|
||||
|
||||
/**
|
||||
* 返回内容
|
||||
|
Reference in New Issue
Block a user