package com.izouma.zhirongip.service;

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

@Service
@AllArgsConstructor
public class BannerService {

    private final BannerRepo bannerRepo;

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