Skip to content

Commit

Permalink
Merge pull request #35 from SWM-WeLike2Coding/fix/productList
Browse files Browse the repository at this point in the history
fix: 상품 청약/종료 조회에 대해서 이전에 작성했던 쿼리문으로 수정
  • Loading branch information
kjungw1025 authored Jul 30, 2024
2 parents 1edc8f8 + 683ec68 commit e94a0f2
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@ public interface ProductRepository extends JpaRepository<Product, Long> {

@Query("select p from Product p " +
"where p.productState = 'ACTIVE' and p.subscriptionEndDate >= CURRENT_DATE " +
"order by case when :sortType = 'knock-in' and p.knockIn is null and p.productState = 'ACTIVE' then 1 else 0 end ")
"order by case when :sortType = 'knock-in' and p.knockIn is null then 1 else 0 end ")
Page<Product> listByOnSale(@Param("sortType") String sortType, Pageable pageable);

@Query("select p from Product p where p.productState = 'ACTIVE' and p.id = :id and p.subscriptionEndDate >= CURRENT_DATE ")
Optional<Product> isItProductOnSale(@Param("id") Long id);

@Query("select p from Product p " +
"where p.productState = 'ACTIVE' and p.subscriptionEndDate < CURRENT_DATE " +
"order by case when :sortType = 'knock-in' and p.knockIn is null and p.productState = 'ACTIVE' then 1 else 0 end ")
"order by case when :sortType = 'knock-in' and p.knockIn is null then 1 else 0 end ")
Page<Product> listByEndSale(@Param("sortType") String sortType, Pageable pageable);

@Query("select p from Product p where p.productState = 'ACTIVE' and p.id = :id ")
Expand Down

0 comments on commit e94a0f2

Please sign in to comment.