-
Notifications
You must be signed in to change notification settings - Fork 0
hotfix: 쿼리 수정 #236
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
hotfix: 쿼리 수정 #236
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -12,6 +12,6 @@ public interface PartnershipRestaurantRepository extends JpaRepository<Partnersh | |||||
| LEFT JOIN FETCH pr.partnerships p | ||||||
| LEFT JOIN FETCH p.partnershipCollege | ||||||
| LEFT JOIN FETCH p.partnershipDepartment | ||||||
| WHERE p.startDate >= current_date - 7 and (p.endDate is null or p.endDate >= CURRENT_DATE)""") | ||||||
| WHERE p.endDate is null or p.endDate >= CURRENT_DATE""") | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| List<PartnershipRestaurant> findAllWithDetails(); | ||||||
| } | ||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Partnership엔티티에@Where(clause = "start_date <= CURRENT_DATE AND end_date >= CURRENT_DATE")어노테이션이 이미 적용되어 있어, 현재 활성화된 제휴만 필터링하고 있습니다. 따라서 이 JPQL 쿼리에서(p.endDate is null or p.endDate >= current_date)조건을 추가하는 것은 중복입니다. 또한,Partnership엔티티의endDate필드는@Column(nullable = false)로 정의되어 있어p.endDate is null조건은 항상 거짓이 됩니다. 코드의 명확성과 유지보수성을 위해 이 중복 조건을 제거하고@Where절에 필터링 로직을 일원화하는 것을 권장합니다.