Former-commit-id: 7e6bc5a486e6bb238863613c64e78857e4d2e387
master
wangbing 5 years ago
parent 87be605b7c
commit 1a69d2feee

@ -247,6 +247,7 @@ public class SpringBootCallable implements Callable {
//config //config
freeMarkerManager.outputTemp(Tool.createFile(root.getAbsolutePath(), "ActionConfig.java"), option + "/java/config/ActionConfig.java", ctx); freeMarkerManager.outputTemp(Tool.createFile(root.getAbsolutePath(), "ActionConfig.java"), option + "/java/config/ActionConfig.java", ctx);
freeMarkerManager.outputTemp(Tool.createFile(root.getAbsolutePath(), "CacheConfig.java"), option + "/java/config/CacheConfig.java", ctx);
freeMarkerManager.outputTemp(Tool.createFile(root.getAbsolutePath(), "FreeMarkerConfig.java"), option + "/java/config/FreeMarkerConfig.java", ctx); freeMarkerManager.outputTemp(Tool.createFile(root.getAbsolutePath(), "FreeMarkerConfig.java"), option + "/java/config/FreeMarkerConfig.java", ctx);
freeMarkerManager.outputTemp(Tool.createFile(root.getAbsolutePath(), "SecurityConfig.java"), option + "/java/config/SecurityConfig.java", ctx); freeMarkerManager.outputTemp(Tool.createFile(root.getAbsolutePath(), "SecurityConfig.java"), option + "/java/config/SecurityConfig.java", ctx);
freeMarkerManager.outputTemp(Tool.createFile(root.getAbsolutePath(), "TaskConfig.java"), option + "/java/config/TaskConfig.java", ctx); freeMarkerManager.outputTemp(Tool.createFile(root.getAbsolutePath(), "TaskConfig.java"), option + "/java/config/TaskConfig.java", ctx);

@ -8,6 +8,7 @@ import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
</#if> </#if>
import org.springframework.boot.builder.SpringApplicationBuilder; import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.cache.annotation.EnableCaching;
@SpringBootApplication @SpringBootApplication
<#if multiDB> <#if multiDB>
@ -15,6 +16,7 @@ import org.springframework.boot.web.servlet.support.SpringBootServletInitializer
<#else> <#else>
@EnableAutoConfiguration @EnableAutoConfiguration
</#if> </#if>
@EnableCaching
public class Application extends SpringBootServletInitializer { public class Application extends SpringBootServletInitializer {
@Override @Override

@ -0,0 +1,28 @@
package ${basePackage}.config;
import net.sf.ehcache.CacheManager;
import net.sf.ehcache.config.CacheConfiguration;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.cache.ehcache.EhCacheCacheManager;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Configuration
@EnableCaching
public class CacheConfig {
@Bean(name = "tokenCacheManager")
public EhCacheCacheManager tokenCacheManager() {
EhCacheCacheManager ehCacheCacheManager = new EhCacheCacheManager();
net.sf.ehcache.config.Configuration configuration = new net.sf.ehcache.config.Configuration();
configuration.setMaxBytesLocalHeap("2G");
configuration.setUpdateCheck(false);//设置不检查更新
CacheConfiguration cacheConfiguration = new CacheConfiguration();
cacheConfiguration.setTimeToLiveSeconds(60 * 60);//一个小时有效缓存时间
cacheConfiguration.setTimeToIdleSeconds(30 * 60);//30分钟不使用eternal为true会失效
configuration.addDefaultCache(cacheConfiguration);
CacheManager cacheManager = CacheManager.create(configuration);
ehCacheCacheManager.setCacheManager(cacheManager);
return ehCacheCacheManager;
}
}

@ -4,6 +4,9 @@
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="${basePackage}.module.system.mpr.DictItemMapper"> <mapper namespace="${basePackage}.module.system.mpr.DictItemMapper">
<!--开启缓存-->
<cache/>
<sql id="table">`SYS_DICT_ITEM`</sql> <sql id="table">`SYS_DICT_ITEM`</sql>
<sql id="entityColumnList"> <sql id="entityColumnList">
@ -91,7 +94,7 @@
<include refid="entityColumnList"/> <include refid="entityColumnList"/>
) )
VALUES VALUES
<foreach collection="list" item= "item" index ="index" separator=","> <foreach collection="list" item="item" index="index" separator=",">
( (
${r"#"}{item.id}, ${r"#"}{item.id},
${r"#"}{item.dictName,jdbcType=VARCHAR}, ${r"#"}{item.dictName,jdbcType=VARCHAR},
@ -106,7 +109,7 @@
NULL, NULL,
NULL NULL
) )
</foreach > </foreach>
</insert> </insert>
<update id="delete"> <update id="delete">

@ -4,6 +4,9 @@
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="${basePackage}.module.system.mpr.DictItemMapper"> <mapper namespace="${basePackage}.module.system.mpr.DictItemMapper">
<!--开启缓存-->
<cache/>
<sql id="table">"SYS_DICT_ITEM"</sql> <sql id="table">"SYS_DICT_ITEM"</sql>
<sql id="entityColumnList"> <sql id="entityColumnList">

@ -4,6 +4,9 @@
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="${basePackage}.module.system.mpr.DictItemMapper"> <mapper namespace="${basePackage}.module.system.mpr.DictItemMapper">
<!--开启缓存-->
<cache/>
<sql id="table">"SYS_DICT_ITEM"</sql> <sql id="table">"SYS_DICT_ITEM"</sql>
<sql id="entityColumnList"> <sql id="entityColumnList">

@ -40,13 +40,14 @@
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>org.mybatis.spring.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId> <artifactId>spring-boot-starter-web</artifactId>
</dependency> </dependency>
<!-- mybatis -->
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.mybatis.spring.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId> <artifactId>mybatis-spring-boot-starter</artifactId>
</dependency> </dependency>
<!-- mybatis 分页插件 --> <!-- mybatis 分页插件 -->

Loading…
Cancel
Save

Powered by TurnKey Linux.