jiawuxian 2 жил өмнө
parent
commit
27fba0f9c8

+ 8 - 0
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/resumption/service/impl/ProtectionServiceImpl.java

@@ -75,6 +75,14 @@ public class ProtectionServiceImpl extends ServiceImpl<ProtectionMapper, Protect
 
     @Override
     public Long edit(ProtectionEditDto dto) {
+        LambdaQueryWrapper<Protection> repeatNameWrapper=new LambdaQueryWrapper<>();
+        repeatNameWrapper.eq(Protection::getOrgId,dto.getOrgId())
+                .eq(Protection::getName,dto.getName())
+                .ne(Protection::getId,ObjectUtil.isNull(dto.getId())?0:dto.getId());
+
+        if(baseMapper.exists(repeatNameWrapper)){
+            throw new RuntimeException("防区名称重复");
+        }
         Protection protection = new Protection();
         if (dto.getId() != null) {
             protection = getById(dto.getId());