-
Notifications
You must be signed in to change notification settings - Fork 3
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
refactor: 공모글 목록 조회 필터링 수정 및 추가 #356
Merged
Merged
Changes from 5 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
32b35ae
refactor: 마감임박순 필터링 이름 마감임박만으로 변경
helenason 2e17e7f
refactor: 필터링 쿼리 수정
helenason 4dc29fe
feat: "참여가능만" 필터링 기능 구현
helenason 4a162e6
feat: "참여가능만" 필터링 기능 연결
helenason e54e648
fix: 쿼리 내 불필요한 파라미터 제거
helenason 574c21b
refactor: 할인율이 null일 경우 높은할인율 필터링 대상에서 제외
helenason 25a1c28
feat: 참여가능만 필터링 전략 클래스 추가
helenason 9ad4424
feat: 공모 목록 조회 API 응답값 변경
fromitive 4076a36
fix: 높은 할인율 단위 변경 및 last-id 필터링 로직 수정
fromitive 265a839
style: 주석 제거
fromitive File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,10 +11,10 @@ | |
public interface OfferingRepository extends JpaRepository<OfferingEntity, Long> { | ||
|
||
@Query(""" | ||
SELECT o | ||
FROM OfferingEntity as o JOIN OfferingMemberEntity as om | ||
ON o.id = om.offering.id | ||
WHERE om.member = :member | ||
SELECT o | ||
FROM OfferingEntity as o JOIN OfferingMemberEntity as om | ||
ON o.id = om.offering.id | ||
WHERE om.member = :member | ||
""") | ||
List<OfferingEntity> findCommentRoomsByMember(MemberEntity member); | ||
|
||
|
@@ -30,30 +30,35 @@ public interface OfferingRepository extends JpaRepository<OfferingEntity, Long> | |
@Query(""" | ||
SELECT o | ||
FROM OfferingEntity o | ||
WHERE ((o.meetingDate > :lastMeetingDate AND o.meetingDate < :threshold) | ||
OR (o.meetingDate = :lastMeetingDate AND o.id < :lastId AND o.meetingDate < :threshold) | ||
OR (o.totalCount <= 3 AND (o.totalCount - o.currentCount) < 2 AND (o.totalCount - o.currentCount) > 0) | ||
OR (o.totalCount > 3 AND (o.totalCount - o.currentCount) < 3 AND (o.totalCount - o.currentCount) > 0)) | ||
AND (:keyword IS NULL OR o.title LIKE %:keyword% OR o.meetingAddress LIKE %:keyword%) | ||
AND (o.isManualConfirmed IS FALSE) | ||
AND (o.meetingDate >= :now) | ||
AND ((o.meetingDate > :lastMeetingDate) OR (o.meetingDate = :lastMeetingDate AND o.id < :lastId)) | ||
WHERE (o.offeringStatus = 'IMMINENT') | ||
AND (o.meetingDate > :lastMeetingDate OR (o.meetingDate = :lastMeetingDate AND o.id < :lastId)) | ||
AND (:keyword IS NULL OR o.title LIKE %:keyword% OR o.meetingAddress LIKE %:keyword%) | ||
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. 오와 쿼리가 반토막 났네요 대박 |
||
ORDER BY o.meetingDate ASC, o.id DESC | ||
""") | ||
List<OfferingEntity> findImminentOfferingsWithKeyword( | ||
LocalDateTime now, LocalDateTime threshold, LocalDateTime lastMeetingDate, Long lastId, String keyword, | ||
Pageable pageable); | ||
LocalDateTime lastMeetingDate, Long lastId, String keyword, Pageable pageable); | ||
|
||
@Query(""" | ||
SELECT o | ||
FROM OfferingEntity o | ||
WHERE ((o.originPrice - (o.totalPrice * 1.0 / o.totalCount)) / o.originPrice < :discountRate | ||
OR ((o.originPrice - (o.totalPrice * 1.0 / o.totalCount)) / o.originPrice = :discountRate AND o.id < :lastId)) | ||
WHERE (o.offeringStatus != 'CONFIRMED') | ||
AND (o.discountRate < :lastDiscountRate OR (o.discountRate = :lastDiscountRate AND o.id < :lastId)) | ||
AND (:keyword IS NULL OR o.title LIKE %:keyword% OR o.meetingAddress LIKE %:keyword%) | ||
ORDER BY (o.originPrice - (o.totalPrice * 1.0 / o.totalCount)) / o.originPrice DESC, o.id DESC | ||
ORDER BY o.discountRate DESC, o.id DESC | ||
""") | ||
List<OfferingEntity> findHighDiscountOfferingsWithKeyword( | ||
double discountRate, Long lastId, String keyword, Pageable pageable); | ||
double lastDiscountRate, Long lastId, String keyword, Pageable pageable); | ||
|
||
@Query(""" | ||
SELECT o | ||
FROM OfferingEntity o | ||
WHERE (o.offeringStatus = 'AVAILABLE' OR o.offeringStatus = 'IMMINENT') | ||
AND (o.id < :lastId) | ||
AND (:keyword IS NULL OR o.title LIKE %:keyword% OR o.meetingAddress LIKE %:keyword%) | ||
ORDER BY o.id DESC | ||
""") | ||
List<OfferingEntity> findJoinableOfferingsWithKeyword(Long lastId, String keyword, Pageable pageable); | ||
|
||
|
||
@Query("SELECT MAX(o.id) FROM OfferingEntity o") | ||
Long findMaxId(); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
텍스트 수정 좋아요!!