From 45520aea38a87bfb262149d5c7b89d482cab07b9 Mon Sep 17 00:00:00 2001
From: dengzedong <dengzedong@email>
Date: 星期四, 05 十二月 2024 16:06:22 +0800
Subject: [PATCH] 调度模型

---
 iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/sche/service/impl/StScheduleModelParamServiceImpl.java |   22 ++++++++++++++++++++++
 1 files changed, 22 insertions(+), 0 deletions(-)

diff --git a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/sche/service/impl/StScheduleModelParamServiceImpl.java b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/sche/service/impl/StScheduleModelParamServiceImpl.java
index 80c17ca..3e951df 100644
--- a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/sche/service/impl/StScheduleModelParamServiceImpl.java
+++ b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/sche/service/impl/StScheduleModelParamServiceImpl.java
@@ -11,7 +11,9 @@
 import org.springframework.util.CollectionUtils;
 
 import java.util.List;
+import java.util.Map;
 import java.util.UUID;
+import java.util.concurrent.ConcurrentHashMap;
 
 /**
  * @author PanZhibao
@@ -21,6 +23,8 @@
 @Service
 public class StScheduleModelParamServiceImpl extends BaseServiceImpl<StScheduleModelParamDao, StScheduleModelParamEntity>
         implements StScheduleModelParamService {
+
+    private static Map<String, List<StScheduleModelParamEntity>> modelInputParamMap = new ConcurrentHashMap<>();
 
     @Override
     public List<StScheduleModelParamEntity> getByModelId(String modelId) {
@@ -51,5 +55,23 @@
             entity.setModelid(modelId);
             baseDao.insert(entity);
         });
+        clearCache();
+    }
+
+    @Override
+    public List<StScheduleModelParamEntity> getByModelidFromCache(String modelId) {
+        if (!modelInputParamMap.containsKey(modelId)) {
+            List<StScheduleModelParamEntity> list = getByModelId(modelId);
+            if (list != null) {
+                modelInputParamMap.put(modelId, list);
+            } else {
+                return null;
+            }
+        }
+        return modelInputParamMap.get(modelId);
+    }
+
+    public void clearCache() {
+        modelInputParamMap.clear();
     }
 }
\ No newline at end of file

--
Gitblit v1.9.3