Commit d36f66f2 authored by KeYong's avatar KeYong

修复bug

parent 276264e0
...@@ -1598,20 +1598,20 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM ...@@ -1598,20 +1598,20 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM
if (!ObjectUtils.isEmpty(equipmentSpecific)) { if (!ObjectUtils.isEmpty(equipmentSpecific)) {
QueryWrapper<VideoEquipmentSpecific> queryWrapper = new QueryWrapper<>(); QueryWrapper<VideoEquipmentSpecific> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("equipment_specific_id", equipmentSpecificId); queryWrapper.eq("equipment_specific_id", equipmentSpecificId);
boolean remove = videoEquipmentSpecificService.remove(queryWrapper); if (0 == videoIdList.size()) {
if (remove) { videoEquipmentSpecificService.remove(queryWrapper);
List<VideoEquipmentSpecific> videoSpecificList = new ArrayList<>();
videoIdList.parallelStream().forEach(x -> {
VideoEquipmentSpecific videoEquipmentSpecific = new VideoEquipmentSpecific();
videoEquipmentSpecific.setVideoId(x);
videoEquipmentSpecific.setEquipmentSpecificId(equipmentSpecificId);
videoSpecificList.add(videoEquipmentSpecific);
});
videoEquipmentSpecificService.saveBatch(videoSpecificList);
return Boolean.TRUE; return Boolean.TRUE;
}
List<VideoEquipmentSpecific> list = videoEquipmentSpecificService.getBaseMapper().selectList(queryWrapper);
if (0 < list.size()) {
boolean remove = videoEquipmentSpecificService.remove(queryWrapper);
if (remove) {
this.bingEquipmentRelationshipToVideo(videoIdList, equipmentSpecificId);
}
} else { } else {
throw new RuntimeException("设备摄像头绑定关系中此设备不存在!"); this.bingEquipmentRelationshipToVideo(videoIdList, equipmentSpecificId);
} }
return Boolean.FALSE;
} else { } else {
throw new RuntimeException("未获取到此设备!"); throw new RuntimeException("未获取到此设备!");
} }
...@@ -1619,4 +1619,17 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM ...@@ -1619,4 +1619,17 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM
throw new RuntimeException("设备ID为空!"); throw new RuntimeException("设备ID为空!");
} }
} }
private Boolean bingEquipmentRelationshipToVideo(List<Long> videoIdList, Long equipmentSpecificId) {
List<VideoEquipmentSpecific> videoSpecificList = new ArrayList<>();
videoIdList.parallelStream().forEach(x -> {
VideoEquipmentSpecific videoEquipmentSpecific = new VideoEquipmentSpecific();
videoEquipmentSpecific.setVideoId(x);
videoEquipmentSpecific.setEquipmentSpecificId(equipmentSpecificId);
videoSpecificList.add(videoEquipmentSpecific);
});
videoEquipmentSpecificService.saveBatch(videoSpecificList);
return Boolean.TRUE;
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment