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 | 10 ++++++++++ 1 files changed, 10 insertions(+), 0 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 ed43322..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 @@ -16,6 +16,7 @@ import org.springframework.transaction.annotation.Transactional; import java.util.*; +import java.util.concurrent.ConcurrentHashMap; /** * @author PanZhibao @@ -26,6 +27,8 @@ @Autowired private MmItemTypeDao mmItemTypeDao; + + private Map<String, MmItemTypeEntity> typeIdMap = new ConcurrentHashMap<>(); @Override public PageResult<MmItemTypeEntity> page(MmItemTypePageReqVO reqVO) { @@ -36,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 @@ -61,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); } -- Gitblit v1.9.3