Skip to content

fix: rop조회#41

Merged
vivivim merged 2 commits intomainfrom
SPM-395
Nov 5, 2025
Merged

fix: rop조회#41
vivivim merged 2 commits intomainfrom
SPM-395

Conversation

@vivivim
Copy link
Contributor

@vivivim vivivim commented Nov 5, 2025

📝 Summary

카테고리, 그룹 네임으로 응답

🙏 Question & PR point

📬 Reference

Summary by CodeRabbit

릴리스 노트

  • 개선사항
    • ROP 조회 및 발주 목록에서 카테고리와 그룹의 고유 번호 대신 이름이 표시되도록 변경되어 제품 정보가 더 직관적으로 보입니다.
    • 목록 응답은 페이지 구성을 유지하되, 항목에 카테고리·그룹 이름을 일괄 조회해 추가로 채웁니다.
    • 대량 파트 코드 조회 기능이 추가되어 성능과 일관성이 향상되었습니다.

카테고리, 그룹 네임으로 응답
@coderabbitai
Copy link

coderabbitai bot commented Nov 5, 2025

Walkthrough

ROP 응답 DTO에서 categoryId/groupId(Long)를 제거하고 categoryName/groupName(String) 필드를 추가했습니다. 저장소 쿼리에서 해당 ID 반환을 제거했으며, 서비스 계층에서 배치 조회로 관련 엔터티를 조회해 DTO에 이름을 부착하도록 후처리 로직이 추가되었습니다.

Changes

Cohort / File(s) 변경 요약
DTO 변경
src/main/java/com/sampoom/backend/api/rop/dto/RopResDto.java
categoryId, groupId(Long) 삭제 → categoryName, groupName(String) 추가. @Setter, @AllArgsConstructor 어노테이션 추가. 생성자 시그니처 및 본문에서 ID 관련 매개변수/할당 제거.
쿼리 수정
src/main/java/com/sampoom/backend/api/rop/repository/RopQueryRepositoryImpl.java
QRopResDto 생성자 호출에서 categoryId, groupId 인자 제거 (조회 결과에서 ID 미포함).
서비스: ROP 후처리 추가
src/main/java/com/sampoom/backend/api/rop/service/RopService.java
PartRepository, PartGroupRepository, CategoryRepository 의존성 추가. getRops()가 저장소 결과를 받아 attachNames(Page<RopResDto>)로 배치 조회 후 각 DTO에 categoryName/groupName 설정하고 PageImpl로 반환하도록 변경.
서비스: 주문 후처리 일관화
src/main/java/com/sampoom/backend/api/order/service/PurchaseOrderService.java
getPurchaseOrders()가 Page 결과를 PageImpl로 재구성하도록 변경. attachNames(Page<POResDto>)로 배치 조회·매핑 방식으로 전환 (여러 POResDto를 처리).
레포지토리 API 확장
src/main/java/com/sampoom/backend/api/part/repository/PartRepository.java
List<Part> findByCodeIn(List<String> partCodes) 메서드 추가 (복수 코드 일괄 조회 지원).

Sequence Diagram

sequenceDiagram
    participant Client
    participant RopService
    participant RopRepository
    participant PartRepository
    participant CategoryRepository
    participant PartGroupRepository
    rect rgba(200,230,255,0.4)
    Client->>RopService: getRops(params, pageable)
    RopService->>RopRepository: search(params, pageable)
    RopRepository-->>RopService: Page<RopResDto> (category/group IDs removed)
    end
    rect rgba(230,255,220,0.4)
    RopService->>PartRepository: findByCodeIn(List<partCodes>)
    PartRepository-->>RopService: List<Part>
    RopService->>CategoryRepository: findAllById(Set<categoryIds>)
    CategoryRepository-->>RopService: List<Category>
    RopService->>PartGroupRepository: findAllById(Set<groupIds>)
    PartGroupRepository-->>RopService: List<PartGroup>
    RopService->>RopService: map names -> each RopResDto.categoryName/groupName
    RopService-->>Client: PageImpl<RopResDto> (names attached)
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20–30 minutes

  • 점검 권장 항목:
    • PartRepository.findByCodeIn 사용으로 인한 null/빈 결과 처리 로직 검토
    • attachNames 구현의 null 안전성 및 대량 처리 성능(N+1 회피 확인)
    • QRopResDto / RopResDto 생성자 시그니처 불일치 여파(다른 호출부 확인)
    • 테스트(통합/단위) 및 API 응답 스키마 변경 영향 확인

Possibly related PRs

  • #36 — 동일 ROP DTO·쿼리·서비스 경로를 수정한 PR로, 본 PR의 DTO 변경과 직접 연관 있음.
  • #10 — Part/Category/PartGroup 관련 저장소 및 엔티티 도입과 관련되어 배치 조회·연계 로직과 연관됨.
  • #24 — RopResDto 및 ROP 조회 흐름을 수정한 PR로 생성자/필드 변경과 관련성 있음.

Suggested labels

ready-to-merge

Suggested reviewers

  • Lee-Jong-Jin
  • CHOOSLA
  • yangjiseonn

Poem

🐰
코드 밭을 깡충깡충 뛰어다녔네,
ID 대신 이름을 잎사귀에 적어,
한 번에 모아와 정성껏 붙였지.
조회는 깔끔, 응답은 포근해,
당근처럼 달콤한 배포를 꿈꾼다 🥕

Pre-merge checks and finishing touches

❌ Failed checks (1 inconclusive)
Check name Status Explanation Resolution
Title check ❓ Inconclusive PR 제목 'fix: rop조회'는 변경사항의 핵심(카테고리와 그룹 이름을 응답에 포함)을 명확하게 전달하지 못하고 있습니다. 제목을 더 구체적으로 수정하기를 권장합니다. 예: 'fix: ROP 조회 응답에 카테고리/그룹 이름 추가' 또는 'refactor: ROP 응답 DTO에서 ID 대신 이름으로 변경'
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch SPM-395

Warning

Review ran into problems

🔥 Problems

Git: Failed to clone repository. Please run the @coderabbitai full review command to re-trigger a full review. If the issue persists, set path_filters to include or exclude specific files.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@taemin3 taemin3 left a comment

Choose a reason for hiding this comment

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

확인했습니다

Copy link
Member

@Sangyoon98 Sangyoon98 left a comment

Choose a reason for hiding this comment

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

승인합니다

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 765457a and ae3c96c.

📒 Files selected for processing (3)
  • src/main/java/com/sampoom/backend/api/rop/dto/RopResDto.java (2 hunks)
  • src/main/java/com/sampoom/backend/api/rop/repository/RopQueryRepositoryImpl.java (0 hunks)
  • src/main/java/com/sampoom/backend/api/rop/service/RopService.java (3 hunks)
💤 Files with no reviewable changes (1)
  • src/main/java/com/sampoom/backend/api/rop/repository/RopQueryRepositoryImpl.java
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Analyze (java-kotlin)
🔇 Additional comments (3)
src/main/java/com/sampoom/backend/api/rop/dto/RopResDto.java (3)

10-12: DTO 가변성에 대한 고려

@Setter@AllArgsConstructor 추가는 현재 서비스 계층 구현(attachNames 메서드에서 setter 사용)과 일치하지만, DTO의 불변성을 감소시켜 서비스 계층과의 결합도를 높입니다.

N+1 쿼리 문제를 해결하고 쿼리 단계에서 JOIN을 통해 categoryName과 groupName을 직접 조회하도록 리팩토링하면, @Setter를 제거하고 DTO를 불변으로 유지할 수 있습니다.


17-18: LGTM!

카테고리와 그룹의 ID를 이름으로 변경한 것은 PR 목표와 일치하며, API 응답이 더 명확해집니다.


28-41: LGTM!

@QueryProjection 생성자에서 categoryId와 groupId 제거는 새로운 필드 구조와 일치하며, 쿼리 리포지토리의 QRopResDto 사용과 호환됩니다.

겸사겸사 비슷한 po도 같이 고침
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
src/main/java/com/sampoom/backend/api/order/service/PurchaseOrderService.java (1)

69-109: 배치 enrichment 패턴이 올바르게 구현되었습니다.

구현이 효율적이며 null 처리도 적절합니다. AI 요약에 따르면 RopService에서도 동일한 패턴이 사용되고 있습니다. 향후 공통 유틸리티로 리팩토링하는 것을 고려해 보세요.

참고: RopService와 PurchaseOrderService 모두에서 Part → Category/PartGroup 매핑을 통한 이름 부착 로직이 반복됩니다. 이를 공통 헬퍼 메서드나 유틸리티 클래스로 추출하면 유지보수성이 향상됩니다.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ae3c96c and ebfd346.

📒 Files selected for processing (3)
  • src/main/java/com/sampoom/backend/api/order/service/PurchaseOrderService.java (2 hunks)
  • src/main/java/com/sampoom/backend/api/part/repository/PartRepository.java (1 hunks)
  • src/main/java/com/sampoom/backend/api/rop/service/RopService.java (3 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/main/java/com/sampoom/backend/api/rop/service/RopService.java
🔇 Additional comments (3)
src/main/java/com/sampoom/backend/api/part/repository/PartRepository.java (1)

13-13: LGTM!

배치 조회를 위한 표준 Spring Data JPA 메서드입니다. 여러 Part 엔터티를 효율적으로 조회할 수 있습니다.

src/main/java/com/sampoom/backend/api/order/service/PurchaseOrderService.java (2)

18-18: LGTM!

배치 처리 로직에 필요한 import들이 정확하게 추가되었습니다.

Also applies to: 26-31


57-67: LGTM!

페이지네이션 메타데이터를 유지하면서 DTO를 배치 방식으로 enrichment하는 올바른 구현입니다.

@vivivim vivivim merged commit e686fcb into main Nov 5, 2025
6 checks passed
@coderabbitai coderabbitai bot mentioned this pull request Nov 6, 2025
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.

3 participants