-
Notifications
You must be signed in to change notification settings - Fork 1
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
feat: 쿠폰 및 발급된 쿠폰 조회 API 기능 추가하기 #427
Conversation
Job Summary for GradleCheck Style and Test to Develop :: build-test
|
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.
Lgtm
Job Summary for GradleCheck Style and Test to Develop :: build-test
|
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.
고생하셨습니다. 리뷰한거 읽어봐주세여~~ 일단 어프로브드립니다!
.orderBy(issuedCoupon.createdAt.desc()) | ||
.fetch(); | ||
|
||
JPAQuery<Long> countQuery = |
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.
여기서 countQuery를 써서 하는것도 좋지만, 이렇게 동일조건으로 두번 조회하면 where문에 따른 같은양의 조인이 중복적으로
발생할거같습니다.
List fetch = queryFactory. 여기 where조건에서 보시다시피 쿠폰, 멤버를 조인해야하는데
동일 조건의 아래 countquery에서도 마찬가지로 두번의 조인이 발생하니까요!
그렇다면
List<Long> ids = queryFactory.select(issuedCoupon.id).from(issuedCoupon).where(matchesQueryOption(queryOption)).fetch();
를써서 id 리스트만 받아오고 그것의 ids.size()로 카운팅을 하면 카운트쿼리가 해결되지않을까요?
그리고 이 id리스트로 실데이터 조회시엔 where(issuedCoupon.id.in(ids))로 넣으면 중복적인 조인은 발생하지 않을거에요!!
이건 성능적으로만 생각하면 되니 가볍게 봐주세요.
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.
lgtm
🌱 관련 이슈
📌 작업 내용 및 특이사항
📝 참고사항
📚 기타