[#35] feat: 기사의 배차에 대한 거리순 정렬 기능 구현 #39
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
관련 이슈
#35
📌 작업 개요
1. Repository Layer
DispatchRepository.findDispatchesByDistance()메서드 추가:statuses IS NULL OR d.status IN (:statuses))2. Service Layer
DispatcherService.getDispatchListByDistance()메서드 추가3. Controller Layer
GET /api/v1/transporter/dispatch-list엔드포인트 추가?status=OPEN&status=ASSIGNED형태로 복수 선택 가능기술적 의사결정
@RequestParam vs @ModelAttribute
기존의 코드 컨벤션에 맞춰 requestDTO + record 방식인
@ModelAttribute + DispatchListSearchReq(Record)방식을 사용하려 했으나,Java Record는 불변 객체(모든 필드가 final)라서 setteSpring의 @ModelAttribute는 전통적으로 기본 생성자 + setter를 통해 바인딩하기 때문에 Record와의 호환성 문제로 파라미터 바인딩이 실패
따라서
@RequestParam(required = false) List<String> status방식으로 직접 받아 컨트롤러에서 수동으로 enum 변환하는 방식으로 구현PostgreSQL IN 절 null 처리
빈 리스트를 전달하면 PostgreSQL에서 array literal 파싱 에러가 발생하므로, 상태 필터가 없을 경우 null을 전달하고 SQL에서 `:statuses IS N처리
API 사용 예시
✨ 기타 참고 사항
✅ 체크리스트
application.yml파일을 수정했다면, Notion에 업로드, github security 수정 및 공유했어요.