package com.dxhy.common.config;

import java.util.Properties;

import org.apache.ibatis.mapping.VendorDatabaseIdProvider;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * mybatis数据库类型
 *
 * @author jiaohongyang
 * @date 2019年5月19日
 * 
 */
@Configuration
public class DatabaseIdProvider {

    /**
     * 添加支持的数据库类型
     */
    @Bean
    public VendorDatabaseIdProvider getDatabaseIdProvider() {
        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("oceanbase", "oceanbase");
        properties.setProperty("Kingbase", "oracle");
        databaseIdProvider.setProperties(properties);
        return databaseIdProvider;
    }

}
