From 537c421019cc5f626f000da8cff3d0bb0f47a3d9 Mon Sep 17 00:00:00 2001
From: 13693261870 <252740454@qq.com>
Date: 星期三, 11 十二月 2024 16:11:24 +0800
Subject: [PATCH] 1

---
 se-modules/se-system/src/main/java/com/se/system/service/impl/SysSoftServiceImpl.java |   64 +++++++++++++++++++++-----------
 1 files changed, 42 insertions(+), 22 deletions(-)

diff --git a/se-modules/se-system/src/main/java/com/se/system/service/impl/SysSoftServiceImpl.java b/se-modules/se-system/src/main/java/com/se/system/service/impl/SysSoftServiceImpl.java
index 4973006..d4c0b65 100644
--- a/se-modules/se-system/src/main/java/com/se/system/service/impl/SysSoftServiceImpl.java
+++ b/se-modules/se-system/src/main/java/com/se/system/service/impl/SysSoftServiceImpl.java
@@ -2,11 +2,14 @@
 
 import java.util.List;
 import com.se.common.core.utils.DateUtils;
-import org.springframework.beans.factory.annotation.Autowired;
+import com.se.system.utils.CaffeineUtils;
 import org.springframework.stereotype.Service;
 import com.se.system.mapper.SysSoftMapper;
 import com.se.system.domain.SysSoft;
 import com.se.system.service.inte.ISysSoftService;
+import org.springframework.util.CollectionUtils;
+
+import javax.annotation.Resource;
 
 /**
  * 杞欢Service涓氬姟灞傚鐞�
@@ -15,82 +18,99 @@
  * @date 2024-11-22
  */
 @Service
-public class SysSoftServiceImpl implements ISysSoftService 
-{
-    @Autowired
+@SuppressWarnings("ALL")
+public class SysSoftServiceImpl implements ISysSoftService {
+    @Resource
     private SysSoftMapper sysSoftMapper;
+
+    private final static String CACHE_KEY = "list:syssoft";
 
     /**
      * 鏌ヨ杞欢
-     * 
+     *
      * @param softId 杞欢涓婚敭
      * @return 杞欢
      */
     @Override
-    public SysSoft selectSysSoftBySoftId(Long softId)
-    {
+    public SysSoft selectSysSoftBySoftId(Long softId) {
         return sysSoftMapper.selectSysSoftBySoftId(softId);
     }
 
     /**
      * 鏌ヨ杞欢鍒楄〃
-     * 
+     *
      * @param sysSoft 杞欢
      * @return 杞欢
      */
     @Override
-    public List<SysSoft> selectSysSoftList(SysSoft sysSoft)
-    {
+    public List<SysSoft> selectSysSoftList(SysSoft sysSoft) {
         return sysSoftMapper.selectSysSoftList(sysSoft);
     }
 
     /**
      * 鏂板杞欢
-     * 
+     *
      * @param sysSoft 杞欢
      * @return 缁撴灉
      */
     @Override
-    public int insertSysSoft(SysSoft sysSoft)
-    {
+    public int insertSysSoft(SysSoft sysSoft) {
+        CaffeineUtils.remove(CACHE_KEY);
         sysSoft.setCreateTime(DateUtils.getNowDate());
         return sysSoftMapper.insertSysSoft(sysSoft);
     }
 
     /**
      * 淇敼杞欢
-     * 
+     *
      * @param sysSoft 杞欢
      * @return 缁撴灉
      */
     @Override
-    public int updateSysSoft(SysSoft sysSoft)
-    {
+    public int updateSysSoft(SysSoft sysSoft) {
+        CaffeineUtils.remove(CACHE_KEY);
         sysSoft.setUpdateTime(DateUtils.getNowDate());
         return sysSoftMapper.updateSysSoft(sysSoft);
     }
 
     /**
      * 鎵归噺鍒犻櫎杞欢
-     * 
+     *
      * @param softIds 闇�瑕佸垹闄ょ殑杞欢涓婚敭
      * @return 缁撴灉
      */
     @Override
-    public int deleteSysSoftBySoftIds(Long[] softIds)
-    {
+    public int deleteSysSoftBySoftIds(Long[] softIds) {
+        CaffeineUtils.remove(CACHE_KEY);
         return sysSoftMapper.deleteSysSoftBySoftIds(softIds);
     }
 
     /**
      * 鍒犻櫎杞欢淇℃伅
-     * 
+     *
      * @param softId 杞欢涓婚敭
      * @return 缁撴灉
      */
     @Override
-    public int deleteSysSoftBySoftId(Long softId)
-    {
+    public int deleteSysSoftBySoftId(Long softId) {
+        CaffeineUtils.remove(CACHE_KEY);
         return sysSoftMapper.deleteSysSoftBySoftId(softId);
     }
+
+    private List<SysSoft> getList() {
+        List<SysSoft> list = CaffeineUtils.getListByKey(CACHE_KEY);
+        if (null == list) {
+            list = selectSysSoftList(new SysSoft());
+            CaffeineUtils.putListByKey(CACHE_KEY, list);
+        }
+
+        return list;
+    }
+
+    public void runSoftTest() throws Exception {
+        List<SysSoft> list = getList();
+        if (CollectionUtils.isEmpty(list)) return;
+
+        //
+    }
 }

--
Gitblit v1.9.3