package com.izouma.nineth.service; import com.izouma.nineth.domain.BlindBoxItem; import com.izouma.nineth.dto.PageQuery; import com.izouma.nineth.dto.PageWrapper; import com.izouma.nineth.repo.BlindBoxItemRepo; import com.izouma.nineth.utils.JpaUtils; import lombok.AllArgsConstructor; import org.springframework.cache.annotation.Cacheable; import org.springframework.stereotype.Service; @Service @AllArgsConstructor public class BlindBoxItemService { private BlindBoxItemRepo blindBoxItemRepo; @Cacheable(value = "blindBoxList", key = "#pageQuery.hashCode()") public PageWrapper all(PageQuery pageQuery) { return PageWrapper.of(blindBoxItemRepo.findAll(JpaUtils.toSpecification(pageQuery, BlindBoxItem.class), JpaUtils.toPageRequest(pageQuery))); } }