|
|
@@ -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));
|
|
|
}
|
|
|
|