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

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

import java.util.List;

/**
 * @author reghao
 * @date 2021-09-15 16:24:56
 */
@Service
public class MachineInfoCrudImpl implements MachineInfoCrud {
    private final MachineInfoRepository infoRepository;

    public MachineInfoCrudImpl(MachineInfoRepository infoRepository) {
        this.infoRepository = infoRepository;
    }

    @Override
    public MachineInfo save(MachineInfo machineInfo) {
        infoRepository.save(machineInfo);
        return machineInfo;
    }

    @Override
    public void saveAll(List<MachineInfo> machineInfos) {
        infoRepository.saveAll(machineInfos);
    }

    @Override
    public void update(MachineInfo machineInfo) {
        infoRepository.save(machineInfo);
    }

    @Override
    public void delete(MachineInfo machineInfo) {
        infoRepository.delete(machineInfo);
    }
}
