本文整理汇总了Java中tk.mybatis.mapper.entity.Config类的典型用法代码示例。如果您正苦于以下问题:Java Config类的具体用法?Java Config怎么用?Java Config使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Config类属于tk.mybatis.mapper.entity包,在下文中一共展示了Config类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setConfig
import tk.mybatis.mapper.entity.Config; //导入依赖的package包/类
/**
* 设置通用Mapper配置
*
* @param config
*/
public void setConfig(Config config) {
this.config = config;
if(config.getMappers() != null && config.getMappers().size() > 0){
for (Class mapperClass : config.getMappers()) {
registerMapper(mapperClass);
}
}
}
示例2: afterPropertiesSet
import tk.mybatis.mapper.entity.Config; //导入依赖的package包/类
@Override
public void afterPropertiesSet() throws Exception {
//
String interceptorHandlers = null;
if (properties.isCacheEnabled()) {
interceptorHandlers = "cache";
}
if (properties.isRwRouteEnabled()) {
interceptorHandlers = interceptorHandlers == null ? "rwRoute" : interceptorHandlers + ",rwRoute";
}
if (properties.isDbShardEnabled()) {
interceptorHandlers = interceptorHandlers == null ? "dbShard" : interceptorHandlers + ",dbShard";
}
if (properties.isPaginationEnabled()) {
interceptorHandlers = interceptorHandlers == null ? "page" : interceptorHandlers + ",page";
}
if (interceptorHandlers != null) {
JeesuiteMybatisInterceptor interceptor = new JeesuiteMybatisInterceptor();
interceptor.setMapperLocations(mapperLocations);
interceptor.setInterceptorHandlers(interceptorHandlers);
sqlSessionFactory.getConfiguration().addInterceptor(interceptor);
Properties p = new Properties();
p.setProperty(PluginConfig.CRUD_DRIVER, properties.getCrudDriver());
p.setProperty(PluginConfig.DB_TYPE, properties.getDbType());
p.setProperty(PluginConfig.CACHE_NULL_VALUE, String.valueOf(properties.isNullValueCache()));
p.setProperty(PluginConfig.CACHE_EXPIRE_SECONDS, String.valueOf(properties.getCacheExpireSeconds()));
p.setProperty(PluginConfig.CACHE_DYNAMIC_EXPIRE, String.valueOf(properties.isDynamicExpire()));
interceptor.setProperties(p);
interceptor.afterPropertiesSet();
}else{
MybatisMapperParser.setMapperLocations(mapperLocations);
}
//
MapperHelper mapperHelper = new MapperHelper();
Config config = new Config();
config.setNotEmpty(false);
mapperHelper.setConfig(config);
List<EntityInfo> entityInfos = MybatisMapperParser.getEntityInfos();
for (EntityInfo entityInfo : entityInfos) {
mapperHelper.registerMapper(entityInfo.getMapperClass());
}
mapperHelper.processConfiguration(sqlSessionFactory.getConfiguration());
}
示例3: getConfig
import tk.mybatis.mapper.entity.Config; //导入依赖的package包/类
/**
* 获取通用Mapper配置
*
* @return
*/
public Config getConfig() {
return config;
}
示例4: setConfig
import tk.mybatis.mapper.entity.Config; //导入依赖的package包/类
/**
* 设置通用Mapper配置
*
* @param config
*/
public void setConfig(Config config) {
this.config = config;
}