From a6cf52adb35541aaae7d84c06d3bde4e881f45f5 Mon Sep 17 00:00:00 2001
From: Administrator <1144154118@qq.com>
Date: 星期六, 19 八月 2023 14:39:31 +0800
Subject: [PATCH] 巡检日历

---
 ard-work/src/main/java/com/ruoyi/alarmpoints/well/service/impl/ArdAlarmpointsWellServiceImpl.java |   25 +++++++++++++++++++++++++
 1 files changed, 25 insertions(+), 0 deletions(-)

diff --git a/ard-work/src/main/java/com/ruoyi/alarmpoints/well/service/impl/ArdAlarmpointsWellServiceImpl.java b/ard-work/src/main/java/com/ruoyi/alarmpoints/well/service/impl/ArdAlarmpointsWellServiceImpl.java
index e0a498f..e89ccca 100644
--- a/ard-work/src/main/java/com/ruoyi/alarmpoints/well/service/impl/ArdAlarmpointsWellServiceImpl.java
+++ b/ard-work/src/main/java/com/ruoyi/alarmpoints/well/service/impl/ArdAlarmpointsWellServiceImpl.java
@@ -2,6 +2,7 @@
 
 import java.util.List;
 
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.ruoyi.alarmpoints.well.domain.ArdAlarmpointsWell;
 import com.ruoyi.alarmpoints.well.mapper.ArdAlarmpointsWellMapper;
 import com.ruoyi.alarmpoints.well.service.IArdAlarmpointsWellService;
@@ -13,10 +14,13 @@
 import com.ruoyi.common.utils.StringUtils;
 import com.ruoyi.common.utils.bean.BeanValidators;
 import com.ruoyi.common.utils.spring.SpringUtils;
+import com.ruoyi.common.utils.uuid.IdUtils;
+import lombok.ToString;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
 
 import javax.annotation.Resource;
 import javax.validation.Validator;
@@ -85,7 +89,14 @@
      * @return 缁撴灉
      */
     @Override
+    @Transactional
     public int insertArdAlarmpointsWell(ArdAlarmpointsWell ardAlarmpointsWell) {
+        boolean wellIdExists = ardAlarmpointsWellMapper.checkWellIdExists(ardAlarmpointsWell.getWellId());
+        if(wellIdExists)
+        {
+            throw new RuntimeException("浜曞彿宸插瓨鍦�");
+        }
+        ardAlarmpointsWell.setId(IdUtils.simpleUUID());
         ardAlarmpointsWell.setUserId(SecurityUtils.getUserId());
         ardAlarmpointsWell.setCreateBy(SecurityUtils.getUsername());
         ardAlarmpointsWell.setCreateTime(DateUtils.getNowDate());
@@ -99,7 +110,13 @@
      * @return 缁撴灉
      */
     @Override
+    @Transactional
     public int updateArdAlarmpointsWell(ArdAlarmpointsWell ardAlarmpointsWell) {
+        boolean wellIdExists = ardAlarmpointsWellMapper.checkWellIdExists(ardAlarmpointsWell.getWellId());
+        if(wellIdExists)
+        {
+            throw new RuntimeException("浜曞彿宸插瓨鍦�");
+        }
         ardAlarmpointsWell.setUpdateBy(SecurityUtils.getUsername());
         ardAlarmpointsWell.setUpdateTime(DateUtils.getNowDate());
         return ardAlarmpointsWellMapper.updateArdAlarmpointsWell(ardAlarmpointsWell);
@@ -210,4 +227,12 @@
             }
         }
     }
+
+
+    @Override
+    public List<ArdAlarmpointsWell> wellByDeptList(List<Long> deptList) {
+        QueryWrapper<ArdAlarmpointsWell> queryWrapper = new QueryWrapper<>();
+        queryWrapper.in("dept_id",deptList);
+        return ardAlarmpointsWellMapper.selectList(queryWrapper);
+    }
 }

--
Gitblit v1.9.3