package com.izouma.jmrh.service;

import com.izouma.jmrh.domain.DockingRecord;
import com.izouma.jmrh.enums.DockingStatus;
import com.izouma.jmrh.exception.BusinessException;
import com.izouma.jmrh.repo.DockingRecordRepo;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;

@Service
@AllArgsConstructor
public class DockingRecordService {

    private DockingRecordRepo dockingRecordRepo;

    public DockingRecord updateStatue(Long id, DockingStatus status) {
        DockingRecord dockingRecord = dockingRecordRepo.findById(id).orElseThrow(new BusinessException("无记录"));
        dockingRecord.setStatus(status);
        return dockingRecordRepo.save(dockingRecord);
    }
}
