浏览代码

系统缓存修改

于俊龙 4 周之前
父节点
当前提交
309930934b

+ 0 - 4
farm-common-biz/src/main/java/jp/yamoto/farm/common/biz/service/impl/SysConfigServiceImpl.java

@@ -5,7 +5,6 @@ import jp.yamoto.farm.common.annotation.DataSource;
 import jp.yamoto.farm.common.biz.domain.entity.SysConfig;
 import jp.yamoto.farm.common.biz.mapper.SysConfigMapper;
 import jp.yamoto.farm.common.biz.service.ISysConfigService;
-import jp.yamoto.farm.common.biz.service.ISysDictDataService;
 import jp.yamoto.farm.common.cache.AppCache;
 import jp.yamoto.farm.common.constant.CacheConstants;
 import jp.yamoto.farm.common.constant.UserConstants;
@@ -35,9 +34,6 @@ public class SysConfigServiceImpl implements ISysConfigService
     private SysConfigMapper configMapper;
 
     @Autowired
-    private ISysDictDataService sysDictDataService;
-
-    @Autowired
     private AppCache appCache;
 
     /**

+ 13 - 10
farm-common/src/main/java/jp/yamoto/farm/common/cache/AppCache.java

@@ -22,6 +22,9 @@ public class AppCache {
     @Autowired
     private DbCache dbCache;
 
+    @Autowired
+    private AppConfig appConfig;
+
     /**
      * 基本的なオブジェクトをキャッシュし、Integer、String、実体類等
      *
@@ -31,7 +34,7 @@ public class AppCache {
     public <T> void setCacheObject(final String key, final T value)
     {
         // データベースキャッシュ
-        if(StringUtils.equals(AppConfig.getCache(), CacheConstants.CACHE_TOOL_DB) ){
+        if(StringUtils.equals(appConfig.getCache(), CacheConstants.CACHE_TOOL_DB) ){
             dbCache.setCacheObject(key, value);
         } else {
             redisCache.setCacheObject(key, value);
@@ -50,7 +53,7 @@ public class AppCache {
     public <T> void setCacheObject(final String key, final T value, final Integer timeout, final TimeUnit timeUnit)
     {
         // データベースキャッシュ
-        if(StringUtils.equals(AppConfig.getCache(), CacheConstants.CACHE_TOOL_DB) ){
+        if(StringUtils.equals(appConfig.getCache(), CacheConstants.CACHE_TOOL_DB) ){
             dbCache.setCacheObject(key, value, timeout, timeUnit);
         } else {
             redisCache.setCacheObject(key, value, timeout, timeUnit);
@@ -67,7 +70,7 @@ public class AppCache {
     public boolean expire(final String key, final long timeout)
     {
         // データベースキャッシュ
-        if(StringUtils.equals(AppConfig.getCache(), CacheConstants.CACHE_TOOL_DB) ){
+        if(StringUtils.equals(appConfig.getCache(), CacheConstants.CACHE_TOOL_DB) ){
             return dbCache.expire(key, timeout);
         } else {
             return redisCache.expire(key, timeout);
@@ -85,7 +88,7 @@ public class AppCache {
     public boolean expire(final String key, final long timeout, final TimeUnit unit)
     {
         // データベースキャッシュ
-        if(StringUtils.equals(AppConfig.getCache(), CacheConstants.CACHE_TOOL_DB) ){
+        if(StringUtils.equals(appConfig.getCache(), CacheConstants.CACHE_TOOL_DB) ){
             return dbCache.expire(key, timeout, unit);
         } else {
             return redisCache.expire(key, timeout, unit);
@@ -100,7 +103,7 @@ public class AppCache {
      */
     public long getExpire(final String key) {
         // データベースキャッシュ
-        if(StringUtils.equals(AppConfig.getCache(), CacheConstants.CACHE_TOOL_DB) ){
+        if(StringUtils.equals(appConfig.getCache(), CacheConstants.CACHE_TOOL_DB) ){
             return dbCache.getExpire(key);
         } else {
             return redisCache.getExpire(key);
@@ -116,7 +119,7 @@ public class AppCache {
     public Boolean hasKey(String key)
     {
         // データベースキャッシュ
-        if(StringUtils.equals(AppConfig.getCache(), CacheConstants.CACHE_TOOL_DB) ){
+        if(StringUtils.equals(appConfig.getCache(), CacheConstants.CACHE_TOOL_DB) ){
             return dbCache.hasKey(key);
         } else {
             return redisCache.hasKey(key);
@@ -132,7 +135,7 @@ public class AppCache {
     public <T> T getCacheObject(final String key, Class<T> clazz)
     {
         // データベースキャッシュ
-        if(StringUtils.equals(AppConfig.getCache(), CacheConstants.CACHE_TOOL_DB) ){
+        if(StringUtils.equals(appConfig.getCache(), CacheConstants.CACHE_TOOL_DB) ){
             return dbCache.getCacheObject(key, clazz);
         } else {
             return redisCache.getCacheObject(key);
@@ -147,7 +150,7 @@ public class AppCache {
     public boolean deleteObject(final String key)
     {
         // データベースキャッシュ
-        if(StringUtils.equals(AppConfig.getCache(), CacheConstants.CACHE_TOOL_DB) ){
+        if(StringUtils.equals(appConfig.getCache(), CacheConstants.CACHE_TOOL_DB) ){
             return dbCache.deleteObject(key);
         } else {
             return redisCache.deleteObject(key);
@@ -163,7 +166,7 @@ public class AppCache {
     public boolean deleteObject(final Collection collection)
     {
         // データベースキャッシュ
-        if(StringUtils.equals(AppConfig.getCache(), CacheConstants.CACHE_TOOL_DB) ){
+        if(StringUtils.equals(appConfig.getCache(), CacheConstants.CACHE_TOOL_DB) ){
             return dbCache.deleteObject(collection);
         } else {
             return redisCache.deleteObject(collection);
@@ -179,7 +182,7 @@ public class AppCache {
     public Collection<String> keys(final String pattern)
     {
         // データベースキャッシュ
-        if(StringUtils.equals(AppConfig.getCache(), CacheConstants.CACHE_TOOL_DB) ){
+        if(StringUtils.equals(appConfig.getCache(), CacheConstants.CACHE_TOOL_DB) ){
             return dbCache.keys(pattern);
         } else {
             return redisCache.keys(pattern);

+ 1 - 1
farm-common/src/main/java/jp/yamoto/farm/common/config/AppConfig.java

@@ -89,7 +89,7 @@ public class AppConfig
         AppConfig.profile = profile;
     }
 
-    public static String getCache() {
+    public String getCache() {
         return cache;
     }
 

+ 1 - 1
farm-crm/src/main/java/jp/yamoto/farm/crm/web/controller/system/SysLoginController.java

@@ -77,7 +77,7 @@ public class SysLoginController
         userInfoVo.setUserId(user.getUserName());
         userInfoVo.setRoleId(user.getRoleId());
         userInfoVo.setPermissions(permissions);
-        userInfoVo.setUserType(loginUser.getUser().getUserType());
+        userInfoVo.setUserType(user.getUserType());
 
         AjaxResult ajax = AjaxResult.success(userInfoVo);