package cn.reghao.autodop.dmaster.machine.db.crud;

import cn.reghao.autodop.dmaster.machine.db.repository.MachineStatRepository;
import cn.reghao.autodop.dmaster.machine.model.po.MachineStat;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author reghao
 * @date 2021-09-15 16:24:56
 */
@Service
public class MachineStatCrudImpl implements MachineStatCrud {
    private final MachineStatRepository statRepository;

    public MachineStatCrudImpl(MachineStatRepository statRepository) {
        this.statRepository = statRepository;
    }

    @Override
    public MachineStat save(MachineStat machineStat) {
        statRepository.save(machineStat);
        return machineStat;
    }

    @Override
    public void saveAll(List<MachineStat> machineStats) {
        statRepository.saveAll(machineStats);
    }

    @Override
    public void update(MachineStat machineStat) {
        statRepository.save(machineStat);
    }

    @Override
    public void delete(MachineStat machineStat) {
        statRepository.delete(machineStat);
    }
}
