‘liusuyi’
2023-07-03 29d8ea701df5bba27bda837a550853b299207040
增加井号重复判断
已修改2个文件
19 ■■■■ 文件已修改
ard-work/src/main/java/com/ruoyi/alarmpoints/well/controller/ArdAlarmpointsWellController.java 17 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ard-work/src/main/resources/mapper/alarmpoints/ArdAlarmpointsWellMapper.xml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ard-work/src/main/java/com/ruoyi/alarmpoints/well/controller/ArdAlarmpointsWellController.java
@@ -3,11 +3,15 @@
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import com.ruoyi.alarmpoints.well.domain.ArdAlarmpointsWell;
import com.ruoyi.alarmpoints.well.service.IArdAlarmpointsWellService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.dao.DuplicateKeyException;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
@@ -23,6 +27,7 @@
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.core.page.TableDataInfo;
import org.springframework.web.multipart.MultipartFile;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@@ -84,7 +89,11 @@
    @PostMapping
    @ApiOperation("新增井")
    public AjaxResult add(@RequestBody ArdAlarmpointsWell ardAlarmpointsWell) {
        return toAjax(ardAlarmpointsWellService.insertArdAlarmpointsWell(ardAlarmpointsWell));
        try {
            return toAjax(ardAlarmpointsWellService.insertArdAlarmpointsWell(ardAlarmpointsWell));
        } catch (DuplicateKeyException e) {
            return AjaxResult.error("井号重复");
        }
    }
    /**
@@ -95,7 +104,11 @@
    @PutMapping
    @ApiOperation("修改井")
    public AjaxResult edit(@RequestBody ArdAlarmpointsWell ardAlarmpointsWell) {
        return toAjax(ardAlarmpointsWellService.updateArdAlarmpointsWell(ardAlarmpointsWell));
        try {
            return toAjax(ardAlarmpointsWellService.updateArdAlarmpointsWell(ardAlarmpointsWell));
        } catch (DuplicateKeyException e) {
            return AjaxResult.error("井号重复");
        }
    }
    /**
ard-work/src/main/resources/mapper/alarmpoints/ArdAlarmpointsWellMapper.xml
@@ -174,7 +174,7 @@
            <if test="updateTime != null">update_time = #{updateTime},</if>
            <if test="cameraId != null">camera_id = #{cameraId},</if>
        </trim>
         where well_id = #{wellId}
         where id = #{id}
    </update>
    <delete id="deleteArdAlarmpointsWellById" parameterType="String">