package com.izouma.zhirongip.service;

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

@Service
@AllArgsConstructor
public class ServiceDetailService {

    private final ServiceDetailRepo serviceDetailRepo;

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