package cn.reghao.autodop.dmaster.app.db.query.config.impl;

import cn.reghao.autodop.dmaster.app.db.query.config.RepoAuthConfigQuery;
import cn.reghao.autodop.dmaster.app.db.repository.config.build.RepoAuthConfigRepository;
import cn.reghao.autodop.dmaster.app.model.po.config.build.RepoAuthConfig;
import org.springframework.cache.annotation.CacheConfig;
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-06-11 18:02:57
 */
@Service
public class RepoAuthConfigQueryImpl implements RepoAuthConfigQuery {
    private RepoAuthConfigRepository repoAuthRepository;

    public RepoAuthConfigQueryImpl(RepoAuthConfigRepository repoAuthRepository) {
        this.repoAuthRepository = repoAuthRepository;
    }

    @Override
    public RepoAuthConfig findByName(String name) {
        return repoAuthRepository.findByName(name);
    }

    @Override
    public Page<RepoAuthConfig> findByPage(Pageable pageable) {
        return repoAuthRepository.findAll(pageable);
    }

    @Override
    public List<RepoAuthConfig> findAll() {
        return repoAuthRepository.findAllByIsDeleteFalse();
    }
}
