Skip to content

Commit

Permalink
fix: 상품 청약 중/종료에 대한 낙인값 순 조회에 대해서 조건 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
kjungw1025 committed Jul 29, 2024
1 parent 7b86426 commit bed175f
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 then 1 else 0 end ")
"order by case when :sortType = 'knock-in' and p.knockIn is null and p.productState = 'ACTIVE' 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 then 1 else 0 end ")
"order by case when :sortType = 'knock-in' and p.knockIn is null and p.productState = 'ACTIVE' 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 bed175f

Please sign in to comment.