设备列表修改接口调整

master
zhouxinyu 11 months ago
parent 68669a81b6
commit 375e05afd3
  1. 9
      src/main/java/org/springblade/modules/business/service/impl/DeviceServiceImpl.java

@ -120,6 +120,15 @@ public class DeviceServiceImpl extends BaseServiceImpl<DeviceMapper, Device> imp
newSave.forEach(maintenance -> maintenance.setDeviceId(device.getId())); newSave.forEach(maintenance -> maintenance.setDeviceId(device.getId()));
maintenanceService.saveBatch(newSave); maintenanceService.saveBatch(newSave);
} }
// 需要更新的巡检
List<DeviceMaintenance> toUpdate = maintenances.stream()
.filter(maintenance -> maintenance.getId() != null && !newSave.contains(maintenance))
.collect(Collectors.toList());
// 批量更新需要更新的巡检
if (CollectionUtil.isNotEmpty(toUpdate)) {
maintenanceService.updateBatchById(toUpdate);
}
} }
return this.updateById(device); return this.updateById(device);
} }

Loading…
Cancel
Save