From a28ca3f36d0ace05966a8c0fac1e4b5fe921f882 Mon Sep 17 00:00:00 2001
From: houzhongjian <houzhongyi@126.com>
Date: 星期三, 30 十月 2024 16:25:12 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/opcda/service/impl/ChannelOPCDATagServiceImpl.java |  130 ++++++++++++++-----------------------------
 1 files changed, 42 insertions(+), 88 deletions(-)

diff --git a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/opcda/service/impl/ChannelOPCDATagServiceImpl.java b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/opcda/service/impl/ChannelOPCDATagServiceImpl.java
index e274fad..875faec 100644
--- a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/opcda/service/impl/ChannelOPCDATagServiceImpl.java
+++ b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/opcda/service/impl/ChannelOPCDATagServiceImpl.java
@@ -1,17 +1,16 @@
 package com.iailab.module.data.channel.opcda.service.impl;
 
+import com.baomidou.dynamic.datasource.annotation.DSTransactional;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
-import com.baomidou.mybatisplus.core.toolkit.StringUtils;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.iailab.framework.common.pojo.PageResult;
 import com.iailab.framework.common.util.object.ConvertUtils;
 import com.iailab.module.data.channel.opcda.dao.ChannelOPCDATagDao;
 import com.iailab.module.data.channel.opcda.dto.ChannelOPCDATagDTO;
 import com.iailab.module.data.channel.opcda.entity.ChannelOPCDATagEntity;
 import com.iailab.module.data.channel.opcda.service.ChannelOPCDATagService;
-import com.iailab.module.data.common.utils.PageUtils;
-import com.iailab.module.data.common.utils.Query;
+import com.iailab.module.data.channel.opcda.vo.OpcDaTagPageReqVO;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.poi.ss.usermodel.CellType;
 import org.apache.poi.xssf.usermodel.XSSFRow;
@@ -19,7 +18,6 @@
 import org.apache.poi.xssf.usermodel.XSSFWorkbook;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.multipart.MultipartFile;
 
 import javax.annotation.Resource;
@@ -27,13 +25,12 @@
 import java.io.FileInputStream;
 import java.util.ArrayList;
 import java.util.List;
-import java.util.Map;
 import java.util.UUID;
 
 /**
- * @author DongYukun
+ * @author lirm
  * @Description
- * @createTime 2023年05月08日 15:04:00
+ * @createTime 2024年08月26日
  */
 @Slf4j
 @Service
@@ -44,34 +41,46 @@
     @Value("${iems.upload-dir}")
     private String uploadDir;
 
-    /**
-     * 分页查询tag
-     *
-     * @param params
-     */
-    @Override
-    public PageUtils queryPage(Map<String, Object> params) {
-        String tagName = (String) params.get("tagName");
-        String serverId = (String) params.get("serverId");
 
-        IPage<ChannelOPCDATagEntity> page = this.page(
-                new Query<ChannelOPCDATagEntity>().getPage(params),
-                new QueryWrapper<ChannelOPCDATagEntity>()
-                        .like(StringUtils.isNotBlank(tagName), "tag_name", tagName)
-                        .eq(StringUtils.isNotBlank(serverId), "server_id", serverId)
-                        .orderByDesc("create_time")
-        );
-        return new PageUtils(page);
+    @Override
+    public PageResult<ChannelOPCDATagEntity> queryPage(OpcDaTagPageReqVO reqVO) {
+        return channelOPCDATagDao.selectPage(reqVO);
     }
 
-    /**
-     * 查询tag详情
-     *
-     * @param id
-     */
     @Override
     public ChannelOPCDATagEntity info(String id) {
         return channelOPCDATagDao.selectById(id);
+    }
+
+    @Override
+    public void add(ChannelOPCDATagEntity channelOPCDATagEntity) {
+        channelOPCDATagDao.insert(channelOPCDATagEntity);
+    }
+
+    @Override
+    public void update(ChannelOPCDATagEntity channelOPCDATagEntity) {
+        channelOPCDATagDao.updateById(channelOPCDATagEntity);
+    }
+
+    @Override
+    public void delete(String id) {
+        channelOPCDATagDao.deleteById(id);
+    }
+
+    @Override
+    public List<ChannelOPCDATagDTO> selectAll() {
+        List<ChannelOPCDATagEntity> entityList = channelOPCDATagDao.selectList(null);
+        return ConvertUtils.sourceToTarget(entityList, ChannelOPCDATagDTO.class);
+    }
+
+    @Override
+    public List<ChannelOPCDATagEntity> listByIds(List<String> ids) {
+        return channelOPCDATagDao.selectList(new QueryWrapper<ChannelOPCDATagEntity>().in("id", ids));
+    }
+
+    @Override
+    public void deleteByServerId(String serverId) {
+        channelOPCDATagDao.delete(new QueryWrapper<ChannelOPCDATagEntity>().eq("server_id",serverId));
     }
 
     @Override
@@ -82,64 +91,8 @@
 
     }
 
-    /**
-     * 添加tag
-     *
-     * @param channelOPCDATagEntity
-     */
     @Override
-    public void add(ChannelOPCDATagEntity channelOPCDATagEntity) {
-        channelOPCDATagDao.insert(channelOPCDATagEntity);
-    }
-
-    /**
-     * 修改tag
-     *
-     * @param channelOPCDATagEntity
-     */
-    @Override
-    public void update(ChannelOPCDATagEntity channelOPCDATagEntity) {
-        channelOPCDATagDao.updateById(channelOPCDATagEntity);
-    }
-
-    /**
-     * 删除tag
-     *
-     * @param id
-     */
-    @Override
-    public void delete(String id) {
-        channelOPCDATagDao.deleteById(id);
-    }
-
-    @Override
-    public List<ChannelOPCDATagDTO> selectAll() {
-
-        List<ChannelOPCDATagEntity> entityList = baseMapper.selectList(
-                null
-        );
-        return ConvertUtils.sourceToTarget(entityList, ChannelOPCDATagDTO.class);
-    }
-
-    @Override
-    public List<ChannelOPCDATagEntity> listByIds(List<String> ids) {
-        return baseMapper.selectList(new QueryWrapper<ChannelOPCDATagEntity>().in("id", ids));
-    }
-
-    @Override
-    public void deleteByServerId(String serverId) {
-        baseMapper.delete(new QueryWrapper<ChannelOPCDATagEntity>().eq("server_id",serverId));
-    }
-
-    /**
-     * 导入Tag
-     *
-     * @param serverId
-     * @param file
-     * @throws Exception
-     */
-    @Override
-    @Transactional(rollbackFor = Exception.class)
+    @DSTransactional(rollbackFor = Exception.class)
     public void importTag(String serverId, MultipartFile file) throws Exception {
         try {
             String suffix = file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf("."));
@@ -173,7 +126,7 @@
             //getBaseMapper().insertList(dangerList);
             dangerList.forEach(item -> {
                 try {
-                    getBaseMapper().insert(item);
+                    channelOPCDATagDao.insert(item);
                 } catch (Exception ex) {
                     log.warn("插入异常:" + item.getTagName());
                 }
@@ -184,4 +137,5 @@
             throw ex;
         }
     }
+
 }

--
Gitblit v1.9.3