|  | @@ -1,105 +0,0 @@
 | 
	
		
			
				|  |  | -//package cn.hnthyy.thmz.common.datasource;
 | 
	
		
			
				|  |  | -//
 | 
	
		
			
				|  |  | -//import com.zaxxer.hikari.HikariDataSource;
 | 
	
		
			
				|  |  | -//import org.apache.ibatis.session.SqlSessionFactory;
 | 
	
		
			
				|  |  | -//import org.mybatis.spring.SqlSessionFactoryBean;
 | 
	
		
			
				|  |  | -//import org.mybatis.spring.SqlSessionTemplate;
 | 
	
		
			
				|  |  | -//import org.mybatis.spring.annotation.MapperScan;
 | 
	
		
			
				|  |  | -//import org.springframework.beans.factory.annotation.Qualifier;
 | 
	
		
			
				|  |  | -//import org.springframework.beans.factory.annotation.Value;
 | 
	
		
			
				|  |  | -//import org.springframework.boot.context.properties.ConfigurationProperties;
 | 
	
		
			
				|  |  | -//import org.springframework.boot.jdbc.DataSourceBuilder;
 | 
	
		
			
				|  |  | -//import org.springframework.context.annotation.Bean;
 | 
	
		
			
				|  |  | -//import org.springframework.context.annotation.Configuration;
 | 
	
		
			
				|  |  | -//import org.springframework.context.annotation.Primary;
 | 
	
		
			
				|  |  | -//import org.springframework.jdbc.datasource.DataSourceTransactionManager;
 | 
	
		
			
				|  |  | -//
 | 
	
		
			
				|  |  | -//import javax.sql.DataSource;
 | 
	
		
			
				|  |  | -//
 | 
	
		
			
				|  |  | -//@Configuration
 | 
	
		
			
				|  |  | -//@MapperScan(basePackages = "cn.hnthyy.thmz.mapper.his", sqlSessionTemplateRef = "hisSqlSessionTemplate")
 | 
	
		
			
				|  |  | -//public class HisDataSource {
 | 
	
		
			
				|  |  | -//    @Value("${spring.datasource.his.type}")
 | 
	
		
			
				|  |  | -//    private Class type;
 | 
	
		
			
				|  |  | -//    @Value("${spring.datasource.his.driver-class-name}")
 | 
	
		
			
				|  |  | -//    private String driverClassName;
 | 
	
		
			
				|  |  | -//    @Value("${spring.datasource.his.jdbc-url}")
 | 
	
		
			
				|  |  | -//    private String url;
 | 
	
		
			
				|  |  | -//    @Value("${spring.datasource.his.username}")
 | 
	
		
			
				|  |  | -//    private String username;
 | 
	
		
			
				|  |  | -//    @Value("${spring.datasource.his.password}")
 | 
	
		
			
				|  |  | -//    private String password;
 | 
	
		
			
				|  |  | -//    @Value("${spring.datasource.his.connection-test-query}")
 | 
	
		
			
				|  |  | -//    private String connectionTestQuery;
 | 
	
		
			
				|  |  | -//    @Value("${spring.datasource.his.pool-name}")
 | 
	
		
			
				|  |  | -//    private String poolName;
 | 
	
		
			
				|  |  | -//    @Value("${spring.datasource.his.minimum-idle}")
 | 
	
		
			
				|  |  | -//    private Integer minimumIdle;
 | 
	
		
			
				|  |  | -//    @Value("${spring.datasource.his.maximum-pool-size}")
 | 
	
		
			
				|  |  | -//    private Integer maximumPoolSize;
 | 
	
		
			
				|  |  | -//    @Value("${spring.datasource.his.max-lifetime}")
 | 
	
		
			
				|  |  | -//    private Long maxLifetime;
 | 
	
		
			
				|  |  | -//    @Value("${spring.datasource.his.idle-timeout}")
 | 
	
		
			
				|  |  | -//    private Long idleTimeout;
 | 
	
		
			
				|  |  | -//    @Value("${spring.datasource.his.auto-commit}")
 | 
	
		
			
				|  |  | -//    private Boolean autoCommit;
 | 
	
		
			
				|  |  | -//    @Value("${spring.datasource.his.connection-timeout}")
 | 
	
		
			
				|  |  | -//    private Long connectionTimeout;
 | 
	
		
			
				|  |  | -//
 | 
	
		
			
				|  |  | -//    /**
 | 
	
		
			
				|  |  | -//     * 多数据源工程,这是导致这个配置没有生效的原因,因为他不知道为哪个数据源开启驼峰命名
 | 
	
		
			
				|  |  | -//     * 所以我们需要在配置多数据源的文件中,单独加入配置,(其他配置也是如此,只要涉及到多数据源的,都需要给每一个数据源去配置)
 | 
	
		
			
				|  |  | -//     *
 | 
	
		
			
				|  |  | -//     * @return
 | 
	
		
			
				|  |  | -//     */
 | 
	
		
			
				|  |  | -//    @Bean(name = "hisConfiguration")
 | 
	
		
			
				|  |  | -//    @ConfigurationProperties(prefix = "mybatis.configuration")
 | 
	
		
			
				|  |  | -//    @Primary
 | 
	
		
			
				|  |  | -//    public org.apache.ibatis.session.Configuration hisConfiguration() {
 | 
	
		
			
				|  |  | -//        return new org.apache.ibatis.session.Configuration();
 | 
	
		
			
				|  |  | -//    }
 | 
	
		
			
				|  |  | -//
 | 
	
		
			
				|  |  | -//
 | 
	
		
			
				|  |  | -//    @Bean(name = "hisData")
 | 
	
		
			
				|  |  | -//    @ConfigurationProperties(prefix = "spring.datasource.his") // application.yml
 | 
	
		
			
				|  |  | -//    @Primary
 | 
	
		
			
				|  |  | -//    public DataSource hisData() {
 | 
	
		
			
				|  |  | -//        //return DataSourceBuilder.create().build();
 | 
	
		
			
				|  |  | -//        // 创建基础hikari数据源
 | 
	
		
			
				|  |  | -//        DataSourceBuilder<HikariDataSource> hikariDataSourceBuilder = DataSourceBuilder.create().type(type);
 | 
	
		
			
				|  |  | -//        HikariDataSource hikariDataSource = hikariDataSourceBuilder.driverClassName(driverClassName).url(url).username(username).password(password).build();
 | 
	
		
			
				|  |  | -//        //配置Hikari连接池
 | 
	
		
			
				|  |  | -//        hikariDataSource.setAutoCommit(autoCommit);//update自动提交设置
 | 
	
		
			
				|  |  | -//        hikariDataSource.setConnectionTestQuery(connectionTestQuery);//连接查询语句设置
 | 
	
		
			
				|  |  | -//        hikariDataSource.setConnectionTimeout(connectionTimeout);//连接超时时间设置
 | 
	
		
			
				|  |  | -//        hikariDataSource.setIdleTimeout(idleTimeout);//连接空闲生命周期设置
 | 
	
		
			
				|  |  | -//        hikariDataSource.setIsolateInternalQueries(false);//执行查询启动设置
 | 
	
		
			
				|  |  | -//        hikariDataSource.setMaxLifetime(maxLifetime);//检查空余连接优化连接池设置时间,单位毫秒
 | 
	
		
			
				|  |  | -//        hikariDataSource.setMinimumIdle(minimumIdle);//连接池保持最小空余连接数量
 | 
	
		
			
				|  |  | -//        hikariDataSource.setMaximumPoolSize(maximumPoolSize);//连接池允许的最大连接数量
 | 
	
		
			
				|  |  | -//        hikariDataSource.setPoolName(poolName);//连接池名称
 | 
	
		
			
				|  |  | -//        return hikariDataSource;
 | 
	
		
			
				|  |  | -//    }
 | 
	
		
			
				|  |  | -//
 | 
	
		
			
				|  |  | -//    @Bean(name = "hisSqlSessionFactory")
 | 
	
		
			
				|  |  | -//    @Primary
 | 
	
		
			
				|  |  | -//    public SqlSessionFactory hisSqlSessionFactory(@Qualifier("hisData") DataSource dataSource, @Qualifier("hisConfiguration") org.apache.ibatis.session.Configuration configuration) throws Exception {
 | 
	
		
			
				|  |  | -//        SqlSessionFactoryBean bean = new SqlSessionFactoryBean();
 | 
	
		
			
				|  |  | -//        bean.setDataSource(dataSource);
 | 
	
		
			
				|  |  | -//        bean.setConfiguration(configuration);
 | 
	
		
			
				|  |  | -//        return bean.getObject();
 | 
	
		
			
				|  |  | -//    }
 | 
	
		
			
				|  |  | -//
 | 
	
		
			
				|  |  | -//    @Bean(name = "hisTransactionManager")
 | 
	
		
			
				|  |  | -//    @Primary
 | 
	
		
			
				|  |  | -//    public DataSourceTransactionManager hisTransactionManager(@Qualifier("hisData") DataSource dataSource) {
 | 
	
		
			
				|  |  | -//        return new DataSourceTransactionManager(dataSource);
 | 
	
		
			
				|  |  | -//    }
 | 
	
		
			
				|  |  | -//
 | 
	
		
			
				|  |  | -//    @Bean(name = "hisSqlSessionTemplate")
 | 
	
		
			
				|  |  | -//    @Primary
 | 
	
		
			
				|  |  | -//    public SqlSessionTemplate hisSqlSessionTemplate(@Qualifier("hisSqlSessionFactory") SqlSessionFactory sqlSessionFactory) throws Exception {
 | 
	
		
			
				|  |  | -//        return new SqlSessionTemplate(sqlSessionFactory);
 | 
	
		
			
				|  |  | -//    }
 | 
	
		
			
				|  |  | -//
 | 
	
		
			
				|  |  | -//}
 |