From ee9f604388a3e77d3f4654e326f3976552e7f532 Mon Sep 17 00:00:00 2001
From: Jay <csj123456>
Date: 星期一, 25 十一月 2024 13:40:07 +0800
Subject: [PATCH] 测点启用和禁用

---
 iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/service/impl/DaPointServiceImpl.java    |    4 ++++
 iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/controller/admin/DaPointController.java |    3 ---
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/controller/admin/DaPointController.java b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/controller/admin/DaPointController.java
index a1788ea..8bc84b7 100644
--- a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/controller/admin/DaPointController.java
+++ b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/controller/admin/DaPointController.java
@@ -20,7 +20,6 @@
 import io.swagger.v3.oas.annotations.Parameters;
 import io.swagger.v3.oas.annotations.tags.Tag;
 import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.transaction.annotation.Transactional;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.multipart.MultipartFile;
@@ -111,7 +110,6 @@
     @PreAuthorize("@ss.hasPermission('data:point:update')")
     @PutMapping("/enable")
     @Operation(summary = "启用")
-    @Transactional
     public CommonResult<Boolean> enable(@RequestBody String[] ids) {
         daPointService.enableByIds(ids);
         return success(true);
@@ -120,7 +118,6 @@
     @PreAuthorize("@ss.hasPermission('data:point:update')")
     @PutMapping("/disable")
     @Operation(summary = "禁用")
-    @Transactional
     public CommonResult<Boolean> disable(@RequestBody String[] ids) {
         daPointService.disableByIds(ids);
         return success(true);
diff --git a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/service/impl/DaPointServiceImpl.java b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/service/impl/DaPointServiceImpl.java
index b54f665..59c5821 100644
--- a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/service/impl/DaPointServiceImpl.java
+++ b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/service/impl/DaPointServiceImpl.java
@@ -402,6 +402,7 @@
     }
 
     @Override
+    @DSTransactional(rollbackFor = Exception.class)
     public void enableByIds(String[] ids) {
         if (CollectionUtils.isEmpty(Arrays.asList(ids))) {
             return;
@@ -410,11 +411,13 @@
             DaPointEntity entity = new DaPointEntity();
             entity.setId(item);
             entity.setIsEnable(IsEnableEnum.ENABLE.getCode());
+            entity.setUpdateTime(new Date());
             daPointDao.updateById(entity);
         });
     }
 
     @Override
+    @DSTransactional(rollbackFor = Exception.class)
     public void disableByIds(String[] ids) {
         if (CollectionUtils.isEmpty(Arrays.asList(ids))) {
             return;
@@ -423,6 +426,7 @@
             DaPointEntity entity = new DaPointEntity();
             entity.setId(item);
             entity.setIsEnable(IsEnableEnum.DISABLE.getCode());
+            entity.setUpdateTime(new Date());
             daPointDao.updateById(entity);
         });
     }

--
Gitblit v1.9.3