mirror of https://gitee.com/maxjhandsome/pig
fixed:redis序列化和cache问题
This commit is contained in:
parent
45dc249e5e
commit
3f3c0ef209
|
@ -1,6 +1,7 @@
|
|||
package com.github.pig.auth.config;
|
||||
|
||||
import com.github.pig.common.constant.CommonConstant;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.cache.CacheManager;
|
||||
import org.springframework.cache.annotation.CachingConfigurerSupport;
|
||||
import org.springframework.cache.annotation.EnableCaching;
|
||||
|
@ -20,11 +21,13 @@ import org.springframework.data.redis.serializer.StringRedisSerializer;
|
|||
@Configuration
|
||||
@EnableCaching
|
||||
public class RedisCacheConfig extends CachingConfigurerSupport {
|
||||
@Value("${redis.cache.expiration}")
|
||||
private Long expiration;
|
||||
@SuppressWarnings("rawtypes")
|
||||
@Bean
|
||||
public CacheManager cacheManager(RedisTemplate redisTemplate) {
|
||||
RedisCacheManager rcm = new RedisCacheManager(redisTemplate);
|
||||
rcm.setDefaultExpiration(3600);//秒
|
||||
rcm.setDefaultExpiration(expiration);
|
||||
return rcm;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.github.pig.auth.mapper.SysUserMapper">
|
||||
<cache/>
|
||||
|
||||
<!-- 通用查询映射结果 -->
|
||||
<resultMap id="BaseResultMap" type="com.github.pig.auth.entity.SysUser">
|
||||
|
|
|
@ -21,9 +21,12 @@ public class MybatisPlusGenerator {
|
|||
gc.setOutputDir("D://data");
|
||||
gc.setFileOverride(true);
|
||||
gc.setActiveRecord(true);
|
||||
gc.setEnableCache(false);// XML 二级缓存
|
||||
gc.setBaseResultMap(true);// XML ResultMap
|
||||
gc.setBaseColumnList(false);// XML columList
|
||||
// XML 二级缓存
|
||||
gc.setEnableCache(true);
|
||||
// XML ResultMap
|
||||
gc.setBaseResultMap(true);
|
||||
// XML columList
|
||||
gc.setBaseColumnList(false);
|
||||
gc.setAuthor("lengleng");
|
||||
mpg.setGlobalConfig(gc);
|
||||
|
||||
|
@ -40,7 +43,8 @@ public class MybatisPlusGenerator {
|
|||
StrategyConfig strategy = new StrategyConfig();
|
||||
// strategy.setCapitalMode(true);// 全局大写命名 ORACLE 注意
|
||||
//strategy.setTablePrefix(new String[]{"tlog_", "tsys_"});// 此处可以修改为您的表前缀
|
||||
strategy.setNaming(NamingStrategy.underline_to_camel);// 表名生成策略
|
||||
// 表名生成策略
|
||||
strategy.setNaming(NamingStrategy.underline_to_camel);
|
||||
mpg.setStrategy(strategy);
|
||||
|
||||
// 包配置
|
||||
|
|
Loading…
Reference in New Issue