Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: 상품 청약/종료 조회에 대해서 이전에 작성했던 쿼리문으로 수정 #35

Merged
merged 1 commit into from
Jul 30, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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