From a4891a78db2d8ac9d17ff01d79e72e8aab38785d Mon Sep 17 00:00:00 2001
From: 潘志宝 <979469083@qq.com>
Date: 星期五, 15 十一月 2024 11:47:56 +0800
Subject: [PATCH] 预测数据查询

---
 iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/service/impl/MmItemOutputServiceImpl.java |   33 +++++++++++++++------------------
 1 files changed, 15 insertions(+), 18 deletions(-)

diff --git a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/service/impl/MmItemOutputServiceImpl.java b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/service/impl/MmItemOutputServiceImpl.java
index 6e22fc7..0c69a6b 100644
--- a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/service/impl/MmItemOutputServiceImpl.java
+++ b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/service/impl/MmItemOutputServiceImpl.java
@@ -6,14 +6,12 @@
 import com.iailab.module.model.mcs.pre.dto.MmItemOutputDTO;
 import com.iailab.module.model.mcs.pre.entity.MmItemOutputEntity;
 import com.iailab.module.model.mcs.pre.service.MmItemOutputService;
-import com.iailab.module.model.mdk.vo.MmItemOutputVO;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
-import org.springframework.util.CollectionUtils;
 
 import java.util.List;
 import java.util.Map;
-import java.util.UUID;
+import java.util.concurrent.ConcurrentHashMap;
 
 /**
  * @author PanZhibao
@@ -24,21 +22,29 @@
 
     @Autowired
     private MmItemOutputDao mmItemOutputDao;
+
+    private static Map<String, MmItemOutputEntity> outputMap = new ConcurrentHashMap<>();
     
     @Override
     public void saveMmItemOutput(List<MmItemOutputEntity> mmItemOutput) {
         mmItemOutputDao.insert(mmItemOutput);
+        // 清空缓存
+        outputMap.clear();
     }
 
     @Override
     public void update(MmItemOutputEntity mmItemOutput) {
         mmItemOutputDao.updateById(mmItemOutput);
+        // 清空缓存
+        outputMap.clear();
     }
 
     public void deleteBatch(String[] itemIds) {
         QueryWrapper<MmItemOutputEntity> queryWrapper = new QueryWrapper();
         queryWrapper.in("itemid", itemIds);
         mmItemOutputDao.delete(queryWrapper);
+        // 清空缓存
+        outputMap.clear();
     }
 
     @Override
@@ -69,21 +75,12 @@
     }
 
     @Override
-    public MmItemOutputVO getOutPutById(String outputid) {
-        List<MmItemOutputVO> list = mmItemOutputDao.getOutPutById(outputid);
-        if (CollectionUtils.isEmpty(list)) {
-            return null;
+    public MmItemOutputEntity getOutPutById(String outputid) {
+        if (outputMap.containsKey(outputid)) {
+            return outputMap.get(outputid);
         }
-        return list.get(0);
-    }
-
-    @Override
-    public List<MmItemOutputVO> getOutPutByItemId(String itemid) {
-        return mmItemOutputDao.getOutPutByItemId(itemid);
-    }
-
-    @Override
-    public List<MmItemOutputVO> getOutPutByPointId(String pointid) {
-        return mmItemOutputDao.getOutPutByPointId(pointid);
+        MmItemOutputEntity entity = mmItemOutputDao.selectById(outputid);
+        outputMap.put(outputid, entity);
+        return entity;
     }
 }

--
Gitblit v1.9.3