package com.izouma.jiashanxia.service;

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

@Service
@AllArgsConstructor
public class BannerService {

    private BannerRepo bannerRepo;

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