From a440ec3bfaa1363f5841100b8948d852971a2eb1 Mon Sep 17 00:00:00 2001
From: 潘志宝 <979469083@qq.com>
Date: 星期二, 10 十二月 2024 13:19:58 +0800
Subject: [PATCH] MmPredictAlarmConfigService

---
 iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/service/impl/MmItemTypeImpl.java |   13 ++++++++++++-
 1 files changed, 12 insertions(+), 1 deletions(-)

diff --git a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/service/impl/MmItemTypeImpl.java b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/service/impl/MmItemTypeImpl.java
index 5258d78..02b2f0f 100644
--- a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/service/impl/MmItemTypeImpl.java
+++ b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/service/impl/MmItemTypeImpl.java
@@ -6,6 +6,7 @@
 import com.iailab.framework.common.service.impl.BaseServiceImpl;
 import com.iailab.framework.common.util.collection.CollectionUtils;
 import com.iailab.module.model.mcs.pre.dao.MmItemTypeDao;
+import com.iailab.module.model.mcs.pre.entity.DmModuleItemEntity;
 import com.iailab.module.model.mcs.pre.entity.MmItemTypeEntity;
 import com.iailab.module.model.mcs.pre.service.MmItemTypeService;
 import com.iailab.module.model.mcs.pre.vo.MmItemTypePageReqVO;
@@ -15,6 +16,7 @@
 import org.springframework.transaction.annotation.Transactional;
 
 import java.util.*;
+import java.util.concurrent.ConcurrentHashMap;
 
 /**
  * @author PanZhibao
@@ -25,6 +27,8 @@
 
     @Autowired
     private MmItemTypeDao mmItemTypeDao;
+
+    private Map<String, MmItemTypeEntity> typeIdMap = new ConcurrentHashMap<>();
     
     @Override
     public PageResult<MmItemTypeEntity> page(MmItemTypePageReqVO reqVO) {
@@ -35,16 +39,19 @@
     public void saveItemType(MmItemTypeEntity itemType) {
         itemType.setId(UUID.randomUUID().toString());
         mmItemTypeDao.insert(itemType);
+        typeIdMap.clear();
     }
 
     @Override
     public void update(MmItemTypeEntity itemType) {
         mmItemTypeDao.updateById(itemType);
+        typeIdMap.clear();
     }
 
     @Override
     public void deleteBatch(String[] moduleIds) {
         mmItemTypeDao.deleteBatchIds(Arrays.asList(moduleIds));
+        typeIdMap.clear();
     }
 
     @Override
@@ -60,10 +67,14 @@
 
     @Override
     public MmItemTypeEntity getItemTypeByItemId(String itemId) {
+        if (typeIdMap.containsKey(itemId)) {
+            return typeIdMap.get(itemId);
+        }
         List<MmItemTypeEntity> list = mmItemTypeDao.getItemTypeByItemId(itemId);
         if (CollectionUtils.isAnyEmpty(list)) {
             return null;
         }
+        typeIdMap.put(itemId, list.get(0));
         return list.get(0);
     }
 
@@ -74,6 +85,6 @@
 
     @Override
     public List<MmItemTypeEntity> list(Map<String, Object> params) {
-        return Collections.emptyList();
+        return mmItemTypeDao.selectList(new QueryWrapper<>());
     }
 }

--
Gitblit v1.9.3