package com.izouma.zhirongip.service;

import com.izouma.zhirongip.domain.Partner;
import com.izouma.zhirongip.dto.PageQuery;
import com.izouma.zhirongip.repo.PartnerRepo;
import com.izouma.zhirongip.utils.JpaUtils;
import lombok.AllArgsConstructor;
import org.springframework.data.domain.Page;
import org.springframework.stereotype.Service;

@Service
@AllArgsConstructor
public class PartnerService {

    private final PartnerRepo partnerRepo;

    public Page<Partner> all(PageQuery pageQuery) {
        return partnerRepo.findAll(JpaUtils.toSpecification(pageQuery, Partner.class), JpaUtils.toPageRequest(pageQuery));
    }
}
