From 0177aa684d935d39e460719ac42914d96910a822 Mon Sep 17 00:00:00 2001 From: ‘liusuyi’ <1951119284@qq.com> Date: 星期一, 03 七月 2023 17:21:46 +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 e7c4321..ea80ad6 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 @@ -13,10 +13,12 @@ import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.bean.BeanValidators; import com.ruoyi.common.utils.spring.SpringUtils; +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; @@ -68,13 +70,30 @@ } /** + * + * @param ardAlarmpointsWell 鎸変簳缂栧彿鏌ヨ + * @return + */ + @Override + @DataScope(deptAlias = "d",userAlias = "u") + public List<ArdAlarmpointsWell> selectArdAlarmpointsWellByWellIdLike(ArdAlarmpointsWell ardAlarmpointsWell) { + return ardAlarmpointsWellMapper.selectArdAlarmpointsWellByWellIdLike(ardAlarmpointsWell); + } + + /** * 鏂板浜曠鐞� * * @param ardAlarmpointsWell 浜曠鐞� * @return 缁撴灉 */ @Override + @Transactional public int insertArdAlarmpointsWell(ArdAlarmpointsWell ardAlarmpointsWell) { + boolean wellIdExists = ardAlarmpointsWellMapper.checkWellIdExists(ardAlarmpointsWell.getWellId()); + if(wellIdExists) + { + throw new RuntimeException("浜曞彿宸插瓨鍦�"); + } ardAlarmpointsWell.setUserId(SecurityUtils.getUserId()); ardAlarmpointsWell.setCreateBy(SecurityUtils.getUsername()); ardAlarmpointsWell.setCreateTime(DateUtils.getNowDate()); @@ -88,7 +107,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); -- Gitblit v1.9.3