当前位置: 首页>>代码示例>>Java>>正文


Java Config类代码示例

本文整理汇总了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);
        }
    }
}
 
开发者ID:abel533,项目名称:Mapper,代码行数:14,代码来源:MapperHelper.java

示例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());

}
 
开发者ID:vakinge,项目名称:jeesuite-libs,代码行数:54,代码来源:JeesuiteMybatisConfiguration.java

示例3: getConfig

import tk.mybatis.mapper.entity.Config; //导入依赖的package包/类
/**
 * 获取通用Mapper配置
 *
 * @return
 */
public Config getConfig() {
    return config;
}
 
开发者ID:Yanweichen,项目名称:MybatisGeneatorUtil,代码行数:9,代码来源:MapperHelper.java

示例4: setConfig

import tk.mybatis.mapper.entity.Config; //导入依赖的package包/类
/**
 * 设置通用Mapper配置
 *
 * @param config
 */
public void setConfig(Config config) {
    this.config = config;
}
 
开发者ID:Yanweichen,项目名称:MybatisGeneatorUtil,代码行数:9,代码来源:MapperHelper.java


注:本文中的tk.mybatis.mapper.entity.Config类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。