From b131f033c12459b718565cab504f762c25642d2d Mon Sep 17 00:00:00 2001
From: 潘志宝 <979469083@qq.com>
Date: 星期一, 06 一月 2025 15:23:08 +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