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: page 1부터 시작하도록 변경 #305

Merged
merged 1 commit into from
Dec 20, 2023
Merged

fix: page 1부터 시작하도록 변경 #305

merged 1 commit into from
Dec 20, 2023

Conversation

oliviarla
Copy link
Contributor

What is this PR? 👀

  • Issue ticket number:

Changes ✏️

Test checklist 🧪

  • [ ]

Copy link
Contributor

@dygma0 dygma0 left a 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) {
Copy link
Contributor

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)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pageable을 안쓰면 이런 조회 쿼리 시 항상 page - 1을 해야한다는 규칙이 추가될 것 같다고 의견을 남기려고 했는데 저도 이렇게 하고 있었군요 ㅋㅋㅋ 이건 수정 해봐도 좋을 것 같은데 어떻게 생각하시나욤?

Copy link
Contributor Author

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);
  };
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

다시 pageable으로 돌렸습니다.!!

Comment on lines 15 to 16
private final long pageNumber;
private final long size;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

앗 페이징 범위 내에서 int 범위로도 괜찮을 것 같다는 생각인데 long으로 수정하신 이유가 있을까용? long 타입을 쓰면서 아래 불필요한 형변환이 이뤄지는 것 같아서 의견 남겨요!

@oliviarla oliviarla merged commit 0058817 into develop Dec 20, 2023
1 check passed
@oliviarla oliviarla deleted the perfume branch December 20, 2023 14:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants