From 7587c74159ce4026baa811f25f306510569ee54a Mon Sep 17 00:00:00 2001
From: 潘志宝 <979469083@qq.com>
Date: 星期四, 20 三月 2025 17:32:02 +0800
Subject: [PATCH] 数据分析 预警,建议

---
 iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/sche/service/impl/StAdjustConfigServiceImpl.java |   28 ++++++++++++++++++----------
 1 files changed, 18 insertions(+), 10 deletions(-)

diff --git a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/sche/service/impl/StAdjustConfigServiceImpl.java b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/sche/service/impl/StAdjustConfigServiceImpl.java
index 6ced3b9..d9cf83a 100644
--- a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/sche/service/impl/StAdjustConfigServiceImpl.java
+++ b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/sche/service/impl/StAdjustConfigServiceImpl.java
@@ -9,6 +9,7 @@
 import com.iailab.framework.common.util.object.BeanUtils;
 import com.iailab.framework.common.util.object.ConvertUtils;
 import com.iailab.module.model.api.mcs.dto.StAdjustConfigDTO;
+import com.iailab.module.model.common.enums.AdjustConfigStatusEnum;
 import com.iailab.module.model.mcs.pre.entity.MmItemOutputEntity;
 import com.iailab.module.model.mcs.sche.dao.StAdjustConfigDao;
 import com.iailab.module.model.mcs.sche.entity.StAdjustConfigDetEntity;
@@ -21,10 +22,9 @@
 import lombok.extern.slf4j.Slf4j;
 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.*;
 
 /**
  * @author PanZhibao
@@ -87,13 +87,21 @@
         return ConvertUtils.sourceToTarget(list, StAdjustConfigDTO.class);
     }
 
-    public StAdjustConfigEntity getByModelId(String modelId) {
-        return baseDao.selectOne("schedule_model_id", modelId);
-    }
+    @Override
+    public Map<StAdjustConfigEntity, List<StAdjustConfigDetEntity>> getAdjustConfigMap(String modelId) {
+        Map<StAdjustConfigEntity, List<StAdjustConfigDetEntity>> result = new HashMap<>();
+        QueryWrapper<StAdjustConfigEntity> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("schedule_model_id", modelId)
+                .eq("status", AdjustConfigStatusEnum.ENABLE.getCode());
+        List<StAdjustConfigEntity> configList =  baseDao.selectList(queryWrapper);
+        if (CollectionUtils.isEmpty(configList)) {
+            return result;
+        }
+        for (StAdjustConfigEntity entity : configList) {
+            List<StAdjustConfigDetEntity> detList = stAdjustConfigDetService.getListByConfigId(entity.getId());
+            result.put(entity, detList);
+        }
 
-
-    public List<StAdjustConfigDetEntity> getDetByModelId(String modelId) {
-        StAdjustConfigEntity configEntity = getByModelId(modelId);
-        return stAdjustConfigDetService.getListByConfigId(configEntity.getId());
+        return result;
     }
 }
\ No newline at end of file

--
Gitblit v1.9.3