29 lines
1.1 KiB
Java
29 lines
1.1 KiB
Java
package io.dataease.dto.datasource;
|
|
|
|
import io.dataease.plugins.datasource.entity.JdbcConfiguration;
|
|
import lombok.Getter;
|
|
import lombok.Setter;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
@Getter
|
|
@Setter
|
|
public class MysqlConfiguration extends JdbcConfiguration {
|
|
|
|
private String driver = "com.mysql.cj.jdbc.Driver";
|
|
private String extraParams = "characterEncoding=UTF-8&connectTimeout=5000&useSSL=false&allowPublicKeyRetrieval=true&zeroDateTimeBehavior=convertToNull";
|
|
|
|
public String getJdbc() {
|
|
if(StringUtils.isEmpty(extraParams.trim())){
|
|
return "jdbc:mysql://HOSTNAME:PORT/DATABASE"
|
|
.replace("HOSTNAME", getHost().trim())
|
|
.replace("PORT", getPort().toString().trim())
|
|
.replace("DATABASE", getDataBase().trim());
|
|
}else {
|
|
return "jdbc:mysql://HOSTNAME:PORT/DATABASE?EXTRA_PARAMS"
|
|
.replace("HOSTNAME", getHost().trim())
|
|
.replace("PORT", getPort().toString().trim())
|
|
.replace("DATABASE", getDataBase().trim())
|
|
.replace("EXTRA_PARAMS", getExtraParams().trim());
|
|
}
|
|
}
|
|
} |