use of com.baomidou.mybatisplus.autoconfigure.MybatisPlusProperties in project scaleph by flowerfine.
the class MasterDataSourceConfig method masterSqlSessionFactory.
@Primary
@Bean(MASTER_SQL_SESSION_FACTORY)
public SqlSessionFactory masterSqlSessionFactory() throws Exception {
MybatisSqlSessionFactoryBean factoryBean = new MybatisSqlSessionFactoryBean();
MybatisPlusProperties props = new MybatisPlusProperties();
props.setMapperLocations(new String[] { MASTER_MAPPER_XML_PATH });
factoryBean.setMapperLocations(props.resolveMapperLocations());
MybatisConfiguration configuration = new MybatisConfiguration();
configuration.setMapUnderscoreToCamelCase(true);
configuration.setLogImpl(Slf4jImpl.class);
factoryBean.setConfiguration(configuration);
factoryBean.setDataSource(masterDataSource());
factoryBean.setTypeAliasesPackage(MASTER_ENTITY_PACKAGE);
factoryBean.setPlugins(mybatisPlusInterceptor);
return factoryBean.getObject();
}
use of com.baomidou.mybatisplus.autoconfigure.MybatisPlusProperties in project scaleph by flowerfine.
the class LogDataSourceConfig method logSqlSessionFactory.
@Bean(LOG_SQL_SESSION_FACTORY)
public SqlSessionFactory logSqlSessionFactory() throws Exception {
MybatisSqlSessionFactoryBean factoryBean = new MybatisSqlSessionFactoryBean();
MybatisPlusProperties props = new MybatisPlusProperties();
props.setMapperLocations(new String[] { LOG_MAPPER_XML_PATH });
factoryBean.setMapperLocations(props.resolveMapperLocations());
MybatisConfiguration configuration = new MybatisConfiguration();
configuration.setMapUnderscoreToCamelCase(true);
configuration.setLogImpl(Slf4jImpl.class);
factoryBean.setConfiguration(configuration);
factoryBean.setDataSource(logDataSource());
factoryBean.setTypeAliasesPackage(LOG_ENTITY_PACKAGE);
factoryBean.setPlugins(mybatisPlusInterceptor);
return factoryBean.getObject();
}
use of com.baomidou.mybatisplus.autoconfigure.MybatisPlusProperties in project smart-cloud by smart-cloud.
the class MybatisPlusPropertiesBeanPostProcessor method setDeleteStateEnumPackage.
/**
* 设置{@link DeleteState}枚举的包名
*
* @param bean
* @return
*/
private Object setDeleteStateEnumPackage(Object bean) {
if (!(bean instanceof MybatisPlusProperties)) {
return bean;
}
String deleteStatePackage = DeleteState.class.getPackage().getName();
MybatisPlusProperties mybatisPlusProperties = (MybatisPlusProperties) bean;
String typeEnumsPackage = mybatisPlusProperties.getTypeEnumsPackage();
if (StringUtils.isNotBlank(typeEnumsPackage)) {
typeEnumsPackage += SymbolConstant.COMMA + deleteStatePackage;
} else {
typeEnumsPackage = deleteStatePackage;
}
mybatisPlusProperties.setTypeEnumsPackage(typeEnumsPackage);
return bean;
}
Aggregations