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

@ -247,6 +247,7 @@ public class SpringBootCallable implements Callable {
//config
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(), "SecurityConfig.java"), option + "/java/config/SecurityConfig.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>
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.cache.annotation.EnableCaching;
@SpringBootApplication
<#if multiDB>
@ -15,6 +16,7 @@ import org.springframework.boot.web.servlet.support.SpringBootServletInitializer
<#else>
@EnableAutoConfiguration
</#if>
@EnableCaching
public class Application extends SpringBootServletInitializer {
@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">
<mapper namespace="${basePackage}.module.system.mpr.DictItemMapper">
<!--开启缓存-->
<cache/>
<sql id="table">`SYS_DICT_ITEM`</sql>
<sql id="entityColumnList">
@ -11,18 +14,18 @@
</sql>
<resultMap id="dictItem" type="${basePackage}.module.system.ent.DictItem">
<result column="ID" jdbcType="BIGINT" property="id"/>
<result column="DICT_NAME" jdbcType="VARCHAR" property="dictName"/>
<result column="KEY" jdbcType="VARCHAR" property="key"/>
<result column="VALUE" jdbcType="VARCHAR" property="value"/>
<result column="SORT" jdbcType="INTEGER" property="sort"/>
<result column="VALID" jdbcType="BIT" property="valid"/>
<result column="ROW_VERSION" jdbcType="BIGINT" property="rowVersion"/>
<result column="IS_DELETED" jdbcType="BIT" property="isDeleted"/>
<result column="CREATE_BY" jdbcType="BIGINT" property="createBy"/>
<result column="CREATE_TIME" jdbcType="TIMESTAMP" property="createTime"/>
<result column="LAST_UPDATE_BY" jdbcType="BIGINT" property="lastUpdateBy"/>
<result column="LAST_UPDATE_TIME" jdbcType="TIMESTAMP" property="lastUpdateTime"/>
<result column="ID" jdbcType="BIGINT" property="id"/>
<result column="DICT_NAME" jdbcType="VARCHAR" property="dictName"/>
<result column="KEY" jdbcType="VARCHAR" property="key"/>
<result column="VALUE" jdbcType="VARCHAR" property="value"/>
<result column="SORT" jdbcType="INTEGER" property="sort"/>
<result column="VALID" jdbcType="BIT" property="valid"/>
<result column="ROW_VERSION" jdbcType="BIGINT" property="rowVersion"/>
<result column="IS_DELETED" jdbcType="BIT" property="isDeleted"/>
<result column="CREATE_BY" jdbcType="BIGINT" property="createBy"/>
<result column="CREATE_TIME" jdbcType="TIMESTAMP" property="createTime"/>
<result column="LAST_UPDATE_BY" jdbcType="BIGINT" property="lastUpdateBy"/>
<result column="LAST_UPDATE_TIME" jdbcType="TIMESTAMP" property="lastUpdateTime"/>
</resultMap>
<select id="find" resultMap="dictItem">
@ -91,22 +94,22 @@
<include refid="entityColumnList"/>
)
VALUES
<foreach collection="list" item= "item" index ="index" separator=",">
(
${r"#"}{item.id},
${r"#"}{item.dictName,jdbcType=VARCHAR},
${r"#"}{item.key,jdbcType=VARCHAR},
${r"#"}{item.value,jdbcType=VARCHAR},
${r"#"}{item.sort,jdbcType=INTEGER},
${r"#"}{item.valid,jdbcType=BIT},
0,
0,
${r"#"}{token.userId,jdbcType=NUMERIC},
sysdate(),
NULL,
NULL
)
</foreach >
<foreach collection="list" item="item" index="index" separator=",">
(
${r"#"}{item.id},
${r"#"}{item.dictName,jdbcType=VARCHAR},
${r"#"}{item.key,jdbcType=VARCHAR},
${r"#"}{item.value,jdbcType=VARCHAR},
${r"#"}{item.sort,jdbcType=INTEGER},
${r"#"}{item.valid,jdbcType=BIT},
0,
0,
${r"#"}{token.userId,jdbcType=NUMERIC},
sysdate(),
NULL,
NULL
)
</foreach>
</insert>
<update id="delete">

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

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

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

Loading…
Cancel
Save

Powered by TurnKey Linux.