bmmx 1 рік тому
батько
коміт
0b4606f93b

+ 8 - 0
src/main/java/com/om/service/impl/VciInfoServiceImpl.java

@@ -77,6 +77,14 @@ public class VciInfoServiceImpl extends ServiceImpl<VciInfoMapper, VciInfo> impl
         if(vciInfo.getVciNum() == null){
             throw new BadReqException("参数为空");
         }
+
+        VciInfo one = this.lambdaQuery()
+                .eq(VciInfo::getVciNum, vciInfo.getVciNum())
+                .one();
+        if (BeanUtil.isNotEmpty(one)){
+            throw new BadReqException("该VCI设备已存在");
+        }
+
         vciInfo.setCreateTime(LocalDateTime.now());
         vciInfo.setUpdateTime(LocalDateTime.now());
         this.save(vciInfo);