package com.izouma.jiashanxia.service;

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

@Service
@AllArgsConstructor
public class GoodsInfoService {

    private GoodsInfoRepo goodsInfoRepo;

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