Forráskód Böngészése

Merge remote-tracking branch 'origin/dev_v3.2.0' into dev_v3.2.0

caozixuan 2 éve
szülő
commit
262738b30d

+ 1 - 3
distributed-print/src/main/java/com/qmth/distributed/print/api/MenuCustomController.java

@@ -142,17 +142,15 @@ public class MenuCustomController {
         SysConfig sysConfig = commonCacheService.addSysConfigCache(tSchoolPrivilegeParam.getSchoolId(), SystemConstant.PDF_SIZE_LIST);
         if (Objects.isNull(sysConfig)) {
             sysConfig = new SysConfig(tSchoolPrivilegeParam.getSchoolId(), SystemConstant.PDF_SIZE_LIST, "pdf格式清单", Arrays.asList(tSchoolPrivilegeParam.getPdfSize()).toString());
-            commonCacheService.updateSysConfigCache(tSchoolPrivilegeParam.getSchoolId(), SystemConstant.PDF_SIZE_LIST);
         } else {
             if (Objects.nonNull(tSchoolPrivilegeParam.getPdfSize()) && tSchoolPrivilegeParam.getPdfSize().length > 0) {
                 sysConfig.setConfigValue(Arrays.asList(tSchoolPrivilegeParam.getPdfSize()).toString());
-                commonCacheService.updateSysConfigCache(tSchoolPrivilegeParam.getSchoolId(), SystemConstant.PDF_SIZE_LIST);
             } else {
                 sysConfig.setConfigValue(null);
-                commonCacheService.removeSysConfigCache(tSchoolPrivilegeParam.getSchoolId(), SystemConstant.PDF_SIZE_LIST);
             }
         }
         sysConfigService.saveOrUpdate(sysConfig);
+        commonCacheService.removeSysConfigCache(tSchoolPrivilegeParam.getSchoolId(), SystemConstant.PDF_SIZE_LIST);
         return ResultUtil.ok(true);
     }
 

+ 4 - 4
teachcloud-common/src/main/java/com/qmth/teachcloud/common/service/impl/CommonCacheServiceImpl.java

@@ -579,7 +579,7 @@ public class CommonCacheServiceImpl implements CommonCacheService {
      * @return
      */
     @Override
-    @Cacheable(value = SystemConstant.SYS_CONFIG_CACHE, key = "#p0")
+    @Cacheable(value = SystemConstant.SYS_CONFIG_CACHE, key = "#p0", unless = "#result == null")
     public SysConfig addSysConfigCache(String key) {
         return sysConfigService.getOne(new QueryWrapper<SysConfig>().lambda().eq(SysConfig::getConfigKey, key));
     }
@@ -591,7 +591,7 @@ public class CommonCacheServiceImpl implements CommonCacheService {
      * @return
      */
     @Override
-    @CachePut(value = SystemConstant.SYS_CONFIG_CACHE, key = "#p0", condition = "#result != null")
+    @CachePut(value = SystemConstant.SYS_CONFIG_CACHE, key = "#p0", unless = "#result == null")
     public SysConfig updateSysConfigCache(String key) {
         return sysConfigService.getById(new QueryWrapper<SysConfig>().lambda().eq(SysConfig::getConfigKey, key));
     }
@@ -615,7 +615,7 @@ public class CommonCacheServiceImpl implements CommonCacheService {
      * @return
      */
     @Override
-    @Cacheable(value = SystemConstant.SYS_CONFIG_CACHE, key = "#p0 + '-' + #p1")
+    @Cacheable(value = SystemConstant.SYS_CONFIG_CACHE, key = "#p0 + '-' + #p1", unless = "#result == null")
     public SysConfig addSysConfigCache(Long schoolId, String key) {
         return sysConfigService.getOne(new QueryWrapper<SysConfig>().lambda().eq(SysConfig::getSchoolId, schoolId).eq(SysConfig::getConfigKey, key));
     }
@@ -628,7 +628,7 @@ public class CommonCacheServiceImpl implements CommonCacheService {
      * @return
      */
     @Override
-    @CachePut(value = SystemConstant.SYS_CONFIG_CACHE, key = "#p0 + '-' + #p1", condition = "#result != null")
+    @CachePut(value = SystemConstant.SYS_CONFIG_CACHE, key = "#p0 + '-' + #p1", unless = "#result != null")
     public SysConfig updateSysConfigCache(Long schoolId, String key) {
         return sysConfigService.getOne(new QueryWrapper<SysConfig>().lambda().eq(SysConfig::getSchoolId, schoolId).eq(SysConfig::getConfigKey, key));
     }