diff --git a/src/main/java/dev/kons/kuenyawz/repositories/ProductRepository.java b/src/main/java/dev/kons/kuenyawz/repositories/ProductRepository.java index d9f1f810..57be0d1b 100644 --- a/src/main/java/dev/kons/kuenyawz/repositories/ProductRepository.java +++ b/src/main/java/dev/kons/kuenyawz/repositories/ProductRepository.java @@ -15,9 +15,6 @@ public interface ProductRepository extends JpaRepository, JpaSpec List findAllByCategoryIsAndNameLikeIgnoreCase(Product.Category category, String name); - @Query("SELECT p.productId FROM Product p") - List findAllIds(); - @Query("SELECT p.productId FROM Product p WHERE p.available=TRUE") List findAllAvailableIds(); } \ No newline at end of file diff --git a/src/main/java/dev/kons/kuenyawz/services/logic/RecommenderServiceImpl.java b/src/main/java/dev/kons/kuenyawz/services/logic/RecommenderServiceImpl.java index ff06607a..94fb07ce 100644 --- a/src/main/java/dev/kons/kuenyawz/services/logic/RecommenderServiceImpl.java +++ b/src/main/java/dev/kons/kuenyawz/services/logic/RecommenderServiceImpl.java @@ -150,7 +150,7 @@ private List oldRecommender(Long productId, Boolean addRandom) { private Long addOneRandom(Long productId, Set excludeSet) { excludeSet.add(productId); - List allProductIds = productRepository.findAllIds(); + List allProductIds = productRepository.findAllAvailableIds(); List filteredProductIds = allProductIds.stream() .filter(id -> !excludeSet.contains(id)) .collect(Collectors.toList());