|  | @@ -1,6 +1,8 @@
 | 
	
		
			
				|  |  |  package com.genersoft.iot.vmp.conf;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  import org.apache.ibatis.logging.stdout.StdOutImpl;
 | 
	
		
			
				|  |  | +import org.apache.ibatis.mapping.DatabaseIdProvider;
 | 
	
		
			
				|  |  | +import org.apache.ibatis.mapping.VendorDatabaseIdProvider;
 | 
	
		
			
				|  |  |  import org.apache.ibatis.session.SqlSessionFactory;
 | 
	
		
			
				|  |  |  import org.mybatis.spring.SqlSessionFactoryBean;
 | 
	
		
			
				|  |  |  import org.springframework.beans.factory.annotation.Autowired;
 | 
	
	
		
			
				|  | @@ -9,6 +11,7 @@ import org.springframework.context.annotation.Configuration;
 | 
	
		
			
				|  |  |  import org.springframework.core.annotation.Order;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  import javax.sql.DataSource;
 | 
	
		
			
				|  |  | +import java.util.Properties;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  /**
 | 
	
		
			
				|  |  |   * 配置mybatis
 | 
	
	
		
			
				|  | @@ -21,7 +24,29 @@ public class MybatisConfig {
 | 
	
		
			
				|  |  |      private UserSetting userSetting;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      @Bean
 | 
	
		
			
				|  |  | -    public SqlSessionFactory sqlSessionFactory(DataSource dataSource) throws Exception {
 | 
	
		
			
				|  |  | +    public DatabaseIdProvider databaseIdProvider() {
 | 
	
		
			
				|  |  | +        VendorDatabaseIdProvider databaseIdProvider = new VendorDatabaseIdProvider();
 | 
	
		
			
				|  |  | +        Properties properties = new Properties();
 | 
	
		
			
				|  |  | +        properties.setProperty("Oracle", "oracle");
 | 
	
		
			
				|  |  | +        properties.setProperty("MySQL", "mysql");
 | 
	
		
			
				|  |  | +        properties.setProperty("DB2", "db2");
 | 
	
		
			
				|  |  | +        properties.setProperty("Derby", "derby");
 | 
	
		
			
				|  |  | +        properties.setProperty("H2", "h2");
 | 
	
		
			
				|  |  | +        properties.setProperty("HSQL", "hsql");
 | 
	
		
			
				|  |  | +        properties.setProperty("Informix", "informix");
 | 
	
		
			
				|  |  | +        properties.setProperty("MS-SQL", "ms-sql");
 | 
	
		
			
				|  |  | +        properties.setProperty("PostgreSQL", "postgresql");
 | 
	
		
			
				|  |  | +        properties.setProperty("Sybase", "sybase");
 | 
	
		
			
				|  |  | +        properties.setProperty("Hana", "hana");
 | 
	
		
			
				|  |  | +        properties.setProperty("DM", "dm");
 | 
	
		
			
				|  |  | +        properties.setProperty("KingbaseES", "kingbase");
 | 
	
		
			
				|  |  | +        properties.setProperty("KingBase8", "kingbase");
 | 
	
		
			
				|  |  | +        databaseIdProvider.setProperties(properties);
 | 
	
		
			
				|  |  | +        return databaseIdProvider;
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    @Bean
 | 
	
		
			
				|  |  | +    public SqlSessionFactory sqlSessionFactory(DataSource dataSource, DatabaseIdProvider databaseIdProvider) throws Exception {
 | 
	
		
			
				|  |  |         final SqlSessionFactoryBean sqlSessionFactory = new SqlSessionFactoryBean();
 | 
	
		
			
				|  |  |          sqlSessionFactory.setDataSource(dataSource);
 | 
	
		
			
				|  |  |          org.apache.ibatis.session.Configuration config = new org.apache.ibatis.session.Configuration();
 | 
	
	
		
			
				|  | @@ -30,6 +55,7 @@ public class MybatisConfig {
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |          config.setMapUnderscoreToCamelCase(true);
 | 
	
		
			
				|  |  |          sqlSessionFactory.setConfiguration(config);
 | 
	
		
			
				|  |  | +        sqlSessionFactory.setDatabaseIdProvider(databaseIdProvider);
 | 
	
		
			
				|  |  |          return sqlSessionFactory.getObject();
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 |