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

import cn.reghao.autodop.dmaster.machine.db.repository.MachineHostRepository;
import cn.reghao.autodop.dmaster.machine.model.po.MachineHost;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author reghao
 * @date 2021-09-15 16:35:24
 */
@Service
public class MachineHostQueryImpl implements MachineHostQuery {
    private final MachineHostRepository hostRepository;
    
    public MachineHostQueryImpl(MachineHostRepository hostRepository) {
        this.hostRepository = hostRepository;
    }
    
    @Override
    public List<MachineHost> findAll() {
        return hostRepository.findAll();
    }

    @Override
    public MachineHost findByMachineId(String machineId) {
        return hostRepository.findByMachineId(machineId);
    }

    @Override
    public MachineHost findByMachineIpv4(String machineIpv4) {
        return hostRepository.findByMachineIpv4(machineIpv4);
    }

    @Override
    public Page<MachineHost> findByEnv(String env, Pageable pageable) {
        return hostRepository.findByEnv(env, pageable);
    }

    @Override
    public List<MachineHost> findByEnv(String env) {
        return hostRepository.findByEnv(env);
    }
}
