File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed
src/main/java/dmu/dasom/api/domain/executive/service Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change 66import dmu .dasom .api .domain .executive .entity .ExecutiveEntity ;
77import dmu .dasom .api .domain .executive .repository .ExecutiveRepository ;
88import lombok .RequiredArgsConstructor ;
9+ import org .springframework .data .domain .Sort ;
910import org .springframework .stereotype .Service ;
1011import org .springframework .transaction .annotation .Transactional ;
1112
@@ -31,11 +32,13 @@ public ExecutiveResponseDto getExecutiveById(Long id) {
3132 // 임원진 전체 조회
3233 // 이름, 직책, 깃허브 주소 출력
3334 public List <ExecutiveListResponseDto > getAllExecutives () {
34- List <ExecutiveEntity > executives = executiveRepository .findAll ();
35+ // 전체 조회 시 정렬
36+ // 기준 sortOrder -> 직책 -> 이름
37+ Sort sort = Sort .by (Sort .Direction .ASC , "sortOrder" )
38+ .and (Sort .by (Sort .Direction .ASC , "position" ))
39+ .and (Sort .by (Sort .Direction .DESC , "name" ));
3540
36- List <Long > executiveIds = executives .stream ()
37- .map (ExecutiveEntity ::getId )
38- .toList ();
41+ List <ExecutiveEntity > executives = executiveRepository .findAll (sort );
3942
4043 return executives .stream ()
4144 .map (executiveEntity -> executiveEntity .toListResponseDto ())
You can’t perform that action at this time.
0 commit comments