package com.ruoyi.imports.util;

import org.apache.commons.lang3.StringUtils;

public class DbConfig {
	
//	private String driver = "oracle.jdbc.driver.OracleDriver";
//	private String url = "jdbc:oracle:thin:@127.0.0.1:1521:orcl";
//	private String username = "dream_cai_piao";
//	private String pwd = "piao";
	
	private String driver = "com.mysql.cj.jdbc.Driver";
	//test
//	private String url = "jdbc:mysql://127.0.0.1:4442/yunnan_report?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8";
	
	//pro
	private String url = "jdbc:mysql://10.253.228.75:3306/yunnan_report?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8";
	private String username = "root";
	private String pwd = "96ee46cebd2e2518";
	
	private String dbType= "mysql";
//	private String driver ;
//	private String url ;
//	private String username ;
//	private String pwd ;
	
	private boolean autoCommit=true;//是否自动提交
	private boolean stopOnError=true;//出错时是否继续执行
	
	public String validate(){
		String err=null;
		if(StringUtils.isBlank(dbType)){
			err="末知数据库类型";
		}
		else if(StringUtils.isBlank(driver)){
			err="缺失数据库驱动";
		}
		else if(StringUtils.isBlank(url)){
			err="缺失数据库url";
		}
		else if(StringUtils.isBlank(username)){
			err="缺失数据库用户名";
		}
		else if(StringUtils.isBlank(pwd)){
			err="缺失数据库密码";
		}		
		return err;
	}
	
	
	public boolean isAutoCommit() {
		return autoCommit;
	}


	public void setAutoCommit(boolean autoCommit) {
		this.autoCommit = autoCommit;
	}


	public boolean isStopOnError() {
		return stopOnError;
	}


	public void setStopOnError(boolean stopOnError) {
		this.stopOnError = stopOnError;
	}


	public String getDriver() {
		return driver;
	}
	public void setDriver(String driver) {
		this.driver = driver;
	}
	public String getUrl() {
		return url;
	}
	public void setUrl(String url) {
		this.url = url;
	}
	public String getUsername() {
		return username;
	}
	public void setUsername(String username) {
		this.username = username;
	}
	public String getPwd() {
		return pwd;
	}
	public void setPwd(String pwd) {
		this.pwd = pwd;
	}
	public String getDbType() {
		return dbType;
	}
	public void setDbType(String dbType) {
		this.dbType = dbType;
	}

}
