-
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
[#18] Feature: Trade 즉시 구매, 판매 구현 #30
Conversation
.filter(e -> e.getValue().getModelNumber().equals(modelNumber)) | ||
.filter(e -> e.getValue().getSize().equals(size)).findFirst() | ||
.map(e -> e.getValue().getId()) | ||
.orElse(0L); |
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.
size
가 신발이나 의류의 크기를 의미하는것같은데 맞나요?- paging 처리에서 사용하는 size와 혼동이 생길 여지가 있네요.. 더 좋은 이름이 없을까요?
isExists
는 보통is
를 제외하고 사용합니다.- filter는 두번 사용할 필요는 없습니다. 하나의 필터에 모든조건을 넣으면 반복이 줄어 성능이 좋아집니다.
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.
피드백 감사합니다..!
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.
이부분도 존재여부만 판단하면 되기때문에
boolean
으로 바꾸고, anyMatch
를 사용하면 좋습니다.
anyMatch
는 하나라도 찾으면 이후 loop를 돌지 않기때문에 모든 element를 순회하는 fliter보다 성능이 좋을것입니다.
Id값이 정말 필요한것이라면 findByModelNumberAndSize()
를 활용하는것이 좋습니다
src/main/java/com/uniqueAuction/domain/trade/repository/SaleRepositoryImpl.java
Outdated
Show resolved
Hide resolved
private Long userId; | ||
private Long productId; | ||
private String modelNumber; |
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.
product ID에서 모델넘버로바뀐이유가뭔지 알수있을까요?
private Long userId; | ||
private Long productId; | ||
private String modelNumber; |
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.
모델넘버는 기본 키값이 될수 없을거같은데 ProductId가 맞는거 같습니다.
관련된 이슈 번호
요약
변경사항 (할 일)