-
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
fix: page 1부터 시작하도록 변경 #305
Conversation
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.
하하 자기 반성을 하게 되는 pr이였습니다 😅
@@ -116,7 +114,7 @@ public CustomSlice<SimplePerfumeResult> findPerfumesByBrand( | |||
|
|||
@Override | |||
public CustomPage<SimplePerfumeResult> findPerfumesByCategory( | |||
Long categoryId, Pageable pageable) { | |||
Long categoryId, long page, long size) { |
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.
앗 혹시 Pageable을 안쓰시고 분리하신 이유가 있으실까요??
.limit(pageable.getPageSize()) | ||
.offset(pageable.getOffset()) | ||
.limit(size) | ||
.offset((page - 1) * size) |
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.
pageable을 안쓰면 이런 조회 쿼리 시 항상 page - 1을 해야한다는 규칙이 추가될 것 같다고 의견을 남기려고 했는데 저도 이렇게 하고 있었군요 ㅋㅋㅋ 이건 수정 해봐도 좋을 것 같은데 어떻게 생각하시나욤?
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.
아래와 같이 하면 1부터 시작할 수 있다고하는데 적용이 잘 안되어서 일단은 직접 작성했습니다 🥲
@Bean
public PageableHandlerMethodArgumentResolverCustomizer customize() {
return p -> {
p.setOneIndexedParameters(true);
};
}
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.
다시 pageable으로 돌렸습니다.!!
private final long pageNumber; | ||
private final long size; |
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.
앗 페이징 범위 내에서 int 범위로도 괜찮을 것 같다는 생각인데 long으로 수정하신 이유가 있을까용? long 타입을 쓰면서 아래 불필요한 형변환이 이뤄지는 것 같아서 의견 남겨요!
What is this PR? 👀
Changes ✏️
Test checklist 🧪