From 112f25b820aea7b0487197d1516974589d1d9979 Mon Sep 17 00:00:00 2001
From: 许鹏程 <1821349743@qq.com>
Date: 星期四, 15 八月 2024 18:37:27 +0800
Subject: [PATCH] commit udpate

---
 src/main/java/com/product/data/entity/DatabaseEntity.java |  275 ++++++++++++++++++++++++++++--------------------------
 1 files changed, 143 insertions(+), 132 deletions(-)

diff --git a/src/main/java/com/product/data/entity/DatabaseEntity.java b/src/main/java/com/product/data/entity/DatabaseEntity.java
index ff13b71..bff2f6a 100644
--- a/src/main/java/com/product/data/entity/DatabaseEntity.java
+++ b/src/main/java/com/product/data/entity/DatabaseEntity.java
@@ -2,6 +2,7 @@
 
 import com.product.common.lang.StringUtils;
 import com.product.core.entity.FieldSetEntity;
+import com.product.data.config.CmnConst;
 import com.product.data.config.DatabaseType;
 
 /**
@@ -11,174 +12,184 @@
  */
 public class DatabaseEntity {
 
-    private Class<?> DbTypeBase;
+	private Class<?> DbTypeBase;
 
-    private int DbType;
+	private int DbType;
 
-    private String userName;
+	private String userName;
 
-    private String passWord;
+	private String passWord;
 
-    private String ip;
+	private String ip;
 
-    private String port;
+	private String port;
 
-    private String DbName;
-    /**
-     * 瀹炰緥鍚�
-     * mysql oracle 鏃犵敤
-     */
-    private String DbInstance;
+	private String DbName;
+	/**
+	 * 瀹炰緥鍚�
+	 * mysql oracle 鏃犵敤
+	 */
+	private String DbInstance;
 
-    /**
-     * 鑷畾涔夊弬鏁�
-     * sqlserver oracle 鏃犵敤
-     */
-    private String customParams;
+	/**
+	 * 鑷畾涔夊弬鏁�
+	 * sqlserver oracle 鏃犵敤
+	 */
+	private String customParams;
 
-    /**
-     * 浠匫racle浣跨敤
-     */
-    private String serverName;
+	/**
+	 * 浠匫racle浣跨敤
+	 */
+	private String serverName;
 
 
-    /**
-     * 浠匫racle浣跨敤
-     */
-    private String sid;
+	/**
+	 * 浠匫racle浣跨敤
+	 */
+	private String sid;
 
-    public String getServerName() {
-        return serverName;
-    }
+	public String getServerName() {
+		return serverName;
+	}
 
-    public void setServerName(String serverName) {
-        this.serverName = serverName;
-    }
+	public void setServerName(String serverName) {
+		this.serverName = serverName;
+	}
 
-    public String getSid() {
-        return sid;
-    }
+	public String getSid() {
+		return sid;
+	}
 
-    public void setSid(String sid) {
-        this.sid = sid;
-    }
+	public void setSid(String sid) {
+		this.sid = sid;
+	}
 
-    public DatabaseEntity(int dbType) {
-        DbType = dbType;
-    }
+	public DatabaseEntity(int dbType) {
+		DbType = dbType;
+	}
 
-    @Override
-    public String toString() {
-        return "DatabaseEntity{" +
-                "DbType=" + DbType == null ? null : getDbType().getValue() +
-                ", userName='" + userName + '\'' +
-                ", passWord='" + passWord + '\'' +
-                ", ip='" + ip + '\'' +
-                ", port='" + port + '\'' +
-                ", DbName='" + DbName + '\'' +
-                ", DbInstance='" + DbInstance + '\'' +
-                ", customParams='" + customParams + '\'' +
-                ", serverName='" + serverName + '\'' +
-                ", sid='" + sid + '\'' +
-                '}';
-    }
+	@Override
+	public String toString() {
+		return "DatabaseEntity{" +
+				"DbType=" + DbType == null ? null : getDbType().getValue() +
+				", userName='" + userName + '\'' +
+				", passWord='" + passWord + '\'' +
+				", ip='" + ip + '\'' +
+				", port='" + port + '\'' +
+				", DbName='" + DbName + '\'' +
+				", DbInstance='" + DbInstance + '\'' +
+				", customParams='" + customParams + '\'' +
+				", serverName='" + serverName + '\'' +
+				", sid='" + sid + '\'' +
+				'}';
+	}
 
 
-    public DatabaseEntity(FieldSetEntity fse) {
-        this.DbTypeBase = DatabaseType.class;
-        init(fse);
-    }
+	public DatabaseEntity(FieldSetEntity fse) {
+		this.DbTypeBase = DatabaseType.class;
+		init(fse);
+	}
 
-    protected void init(FieldSetEntity fse) {
-        DbType = fse.getInteger("db_type");
-        userName = fse.getString("user_name");
-        passWord = fse.getString("pass_word");
-        ip = fse.getString("ip");
-        port = fse.getString("port");
-        DbName = StringUtils.isEmpty(fse.getString("db_name")) ? fse.getString("user_name") : fse.getString("db_name");
-        serverName = fse.getString("server_name");
-        sid = fse.getString("sid");
-        customParams = fse.getString("custom_params");
-        DbInstance = fse.getString("instance");
-    }
+	protected void init(FieldSetEntity fse) {
+		if (CmnConst.TABLE_PRODUCT_SYS_DATASOURCE_CONFIG.equals(fse.getTableName())) {
+			DbType = fse.getInteger("datasource_type");
+			userName = fse.getString("username");
+			passWord = fse.getString("password");
+			ip = fse.getString("ip_address");
+			port = fse.getString("database_port");
+			customParams = fse.getString("link_params");
+			DbInstance = fse.getString("instance_name");
+			return;
+		}
+		DbType = fse.getInteger("db_type");
+		userName = fse.getString("user_name");
+		passWord = fse.getString("pass_word");
+		ip = fse.getString("ip");
+		port = fse.getString("port");
+		DbName = StringUtils.isEmpty(fse.getString("db_name")) ? fse.getString("user_name") : fse.getString("db_name");
+		serverName = fse.getString("server_name");
+		sid = fse.getString("sid");
+		customParams = fse.getString("custom_params");
+		DbInstance = fse.getString("instance");
+	}
 
-    public String getCustomParams() {
+	public String getCustomParams() {
 
-        if (this.getDbType().equals(DatabaseType.MySql) && !StringUtils.isEmpty(this.customParams)) {
-            if (!"?".equals(this.customParams.substring(1))) {
-                return "?" + this.customParams;
-            }
-        }
-        return customParams == null ? "" : this.customParams;
-    }
+		if (this.getDbType().equals(DatabaseType.MySql) && !StringUtils.isEmpty(this.customParams)) {
+			if (!"?".equals(this.customParams.substring(1))) {
+				return "?" + this.customParams;
+			}
+		}
+		return customParams == null ? "" : this.customParams;
+	}
 
-    public int getDbTypeByInt() {
-        return this.DbType;
-    }
+	public int getDbTypeByInt() {
+		return this.DbType;
+	}
 
-    public String getOnlyKey() {
-        String[] params = {DbType + "", ip, port, DbName, serverName, sid, DbInstance};
-        StringBuilder str = new StringBuilder();
-        for (String param : params) {
-            str.append(param == null ? "" : param).append("-");
-        }
-        return str.toString();
-    }
+	public String getOnlyKey() {
+		String[] params = {DbType + "", ip, port, DbName, serverName, sid, DbInstance};
+		StringBuilder str = new StringBuilder();
+		for (String param : params) {
+			str.append(param == null ? "" : param).append("-");
+		}
+		return str.toString();
+	}
 
 
-    public void setCustomParams(String customParams) {
-        this.customParams = customParams;
-    }
+	public void setCustomParams(String customParams) {
+		this.customParams = customParams;
+	}
 
-    public DatabaseType getDbType() {
-        return DatabaseType.getDataBaseType(this.DbType);
-    }
+	public DatabaseType getDbType() {
+		return DatabaseType.getDataBaseType(this.DbType);
+	}
 
-    public String getUserName() {
-        return userName;
-    }
+	public String getUserName() {
+		return userName;
+	}
 
-    public void setUserName(String userName) {
-        this.userName = userName;
-    }
+	public void setUserName(String userName) {
+		this.userName = userName;
+	}
 
-    public String getPassWord() {
-        return passWord;
-    }
+	public String getPassWord() {
+		return passWord;
+	}
 
-    public void setPassWord(String passWord) {
-        this.passWord = passWord;
-    }
+	public void setPassWord(String passWord) {
+		this.passWord = passWord;
+	}
 
-    public String getIp() {
-        return ip;
-    }
+	public String getIp() {
+		return ip;
+	}
 
-    public void setIp(String ip) {
-        this.ip = ip;
-    }
+	public void setIp(String ip) {
+		this.ip = ip;
+	}
 
-    public String getDbName() {
-        return DbName;
-    }
+	public String getDbName() {
+		return DbName;
+	}
 
-    public void setDbName(String dbName) {
-        DbName = dbName;
-    }
+	public void setDbName(String dbName) {
+		DbName = dbName;
+	}
 
-    public String getDbInstance() {
-        return DbInstance;
-    }
+	public String getDbInstance() {
+		return DbInstance;
+	}
 
-    public void setDbInstance(String dbInstance) {
-        DbInstance = dbInstance;
-    }
+	public void setDbInstance(String dbInstance) {
+		DbInstance = dbInstance;
+	}
 
-    public String getPort() {
-        return port;
-    }
+	public String getPort() {
+		return port;
+	}
 
-    public void setPort(String port) {
-        this.port = port;
-    }
+	public void setPort(String port) {
+		this.port = port;
+	}
 }

--
Gitblit v1.9.2