From f66e9016d77a0d500df285ff58a581b31eb54055 Mon Sep 17 00:00:00 2001
From: 潘志宝 <979469083@qq.com>
Date: 星期三, 08 一月 2025 08:21:43 +0800
Subject: [PATCH] DaPointDao代码优化

---
 iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/service/impl/HttpApiServiceImpl.java |   21 +++++++++++++++++----
 1 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/service/impl/HttpApiServiceImpl.java b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/service/impl/HttpApiServiceImpl.java
index d92d201..c6571a6 100644
--- a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/service/impl/HttpApiServiceImpl.java
+++ b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/service/impl/HttpApiServiceImpl.java
@@ -11,12 +11,17 @@
 
 import javax.annotation.Resource;
 import java.util.List;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
 
 @Service
 public class HttpApiServiceImpl extends ServiceImpl<HttpApiDao, HttpApiEntity> implements HttpApiService {
 
     @Resource
     private HttpApiDao httpApiDao;
+
+
+    private static Map<String, HttpApiEntity> idMap = new ConcurrentHashMap<>();
 
     @Override
     public PageResult<HttpApiEntity> queryPage(HttpApiPageReqVO reqVO) {
@@ -44,13 +49,21 @@
     }
 
     @Override
-    public HttpApiEntity selectXstHttpTagApi() {
-        return httpApiDao.selectOne(new QueryWrapper<HttpApiEntity>().eq("code","xstHttpTag"));
+    public HttpApiEntity getByCode(String code) {
+        return httpApiDao.selectOne(new QueryWrapper<HttpApiEntity>().eq("code", code));
     }
 
     @Override
-    public HttpApiEntity getByCode(String code) {
-        return httpApiDao.selectOne(new QueryWrapper<HttpApiEntity>().eq("code", code));
+    public HttpApiEntity getFromCatch(String id) {
+        if (idMap.containsKey(id)) {
+            return idMap.get(id);
+        }
+        HttpApiEntity entity = httpApiDao.selectById(id);
+        if (entity == null) {
+            return null;
+        }
+        idMap.put(id, entity);
+        return idMap.get(id);
     }
 
     @Override

--
Gitblit v1.9.3