Parcourir la source

调整机构扩展标准判定

luojun il y a 2 ans
Parent
commit
483be8153a

+ 6 - 1
soc-modules/soc-modules-system/src/main/java/com/xunmei/system/controller/SysPhysicalDefenseConstructionController.java

@@ -1,5 +1,6 @@
 package com.xunmei.system.controller;
 
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.PostMapping;
@@ -62,7 +63,11 @@ public class SysPhysicalDefenseConstructionController extends BaseController {
     //@RequiresPermissions("system:construction:add")
     @Log(title = "机构物防建设", businessType = BusinessType.INSERT)
     @PostMapping
-    public AjaxResult add(@RequestBody SysPhysicalDefenseConstruction sysPhysicalDefenseConstruction) {
+    public AjaxResult add(@RequestBody SysPhysicalDefenseConstruction sysPhysicalDefenseConstruction) throws Exception{
+        long count = sysPhysicalDefenseConstructionService.count(new LambdaQueryWrapper<SysPhysicalDefenseConstruction>().eq(SysPhysicalDefenseConstruction::getOrgId, sysPhysicalDefenseConstruction.getOrgId()).eq(SysPhysicalDefenseConstruction::getType, sysPhysicalDefenseConstruction.getType()).eq(SysPhysicalDefenseConstruction::getStandard, sysPhysicalDefenseConstruction.getStandard()));
+        if (count > 0) {
+            throw new RuntimeException("当前标准已存在");
+        }
         return toAjax(sysPhysicalDefenseConstructionService.insertSysPhysicalDefenseConstruction(sysPhysicalDefenseConstruction));
     }
 

+ 2 - 1
soc-modules/soc-modules-system/src/main/java/com/xunmei/system/service/impl/SysPhysicalDefenseConstructionServiceImpl.java

@@ -98,7 +98,8 @@ public class SysPhysicalDefenseConstructionServiceImpl extends ServiceImpl<SysPh
     @Override
     public int insertSysPhysicalDefenseConstruction(SysPhysicalDefenseConstruction sysPhysicalDefenseConstruction) {
         sysPhysicalDefenseConstruction.setCreateTime(DateUtils.getNowDate());
-        sysPhysicalDefenseConstructionMapper.delete(new LambdaQueryWrapper<SysPhysicalDefenseConstruction>().eq(SysPhysicalDefenseConstruction::getOrgId,sysPhysicalDefenseConstruction.getOrgId()).eq(SysPhysicalDefenseConstruction::getType,sysPhysicalDefenseConstruction.getType()).eq(SysPhysicalDefenseConstruction::getStandard,sysPhysicalDefenseConstruction.getStandard()));
+
+//        sysPhysicalDefenseConstructionMapper.delete(new LambdaQueryWrapper<SysPhysicalDefenseConstruction>().eq(SysPhysicalDefenseConstruction::getOrgId, sysPhysicalDefenseConstruction.getOrgId()).eq(SysPhysicalDefenseConstruction::getType, sysPhysicalDefenseConstruction.getType()).eq(SysPhysicalDefenseConstruction::getStandard, sysPhysicalDefenseConstruction.getStandard()));
         return sysPhysicalDefenseConstructionMapper.insert(sysPhysicalDefenseConstruction);
     }