-
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: 새로운 사장님 조회 로직 버그 수정 #1182
fix: 새로운 사장님 조회 로직 버그 수정 #1182
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.
빠른 대응 👍👍
for (Owner owner : result.getContent()) { | ||
Shop shop = adminOwnerShopRedisRepository.findById(owner.getId()) | ||
.map(ownerShop -> adminShopRepository.findById(ownerShop.getShopId()).orElse(null)) | ||
.orElse(null); | ||
Optional<OwnerShop> ownerShopOptional = adminOwnerShopRedisRepository.findById(owner.getId()); | ||
Shop shop = null; | ||
|
||
if (ownerShopOptional.isPresent()) { | ||
OwnerShop ownerShop = ownerShopOptional.get(); | ||
if (!Objects.isNull(ownerShop.getShopId())) { | ||
shop = adminShopRepository.findById(ownerShop.getShopId()).orElse(null); | ||
} | ||
} | ||
|
||
OwnerIncludingShop ownerIncludingShop = OwnerIncludingShop.of(owner, shop); | ||
ownerIncludingShops.add(ownerIncludingShop); |
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.
A
요런건 어떠한지
for (Owner owner : result.getContent()) { | |
Shop shop = adminOwnerShopRedisRepository.findById(owner.getId()) | |
.map(ownerShop -> adminShopRepository.findById(ownerShop.getShopId()).orElse(null)) | |
.orElse(null); | |
Optional<OwnerShop> ownerShopOptional = adminOwnerShopRedisRepository.findById(owner.getId()); | |
Shop shop = null; | |
if (ownerShopOptional.isPresent()) { | |
OwnerShop ownerShop = ownerShopOptional.get(); | |
if (!Objects.isNull(ownerShop.getShopId())) { | |
shop = adminShopRepository.findById(ownerShop.getShopId()).orElse(null); | |
} | |
} | |
OwnerIncludingShop ownerIncludingShop = OwnerIncludingShop.of(owner, shop); | |
ownerIncludingShops.add(ownerIncludingShop); | |
List<OwnerIncludingShop> ownerIncludingShops = new ArrayList<>(); | |
for (Owner owner : result.getContent()) { | |
Shop shop = adminOwnerShopRedisRepository.findById(owner.getId()) | |
.map(ownerShop -> { | |
Long shopId = ownerShop.getShopId(); | |
return shopId != null ? adminShopRepository.findById(shopId).orElse(null) : null; | |
}) | |
.orElse(null); | |
OwnerIncludingShop ownerIncludingShop = OwnerIncludingShop.of(owner, shop); | |
ownerIncludingShops.add(ownerIncludingShop); | |
} |
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.
if문 주렁주렁 달려있는 거 보다 보기 좋네요 👍
🔥 연관 이슈
🚀 작업 내용
💬 리뷰 중점사항