-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: 보호 동물 목록 조회 쿼리를 개선한다. (#440)
* refactor: 보호 동물 목록 조회에 페치 조인을 추가한다. * refactor: 보호 동물 목록 조회 쿼리를 개선한다. * refactor: 보호 동물 목록 조회 서비스 로직이 호출하는 쿼리를 변경한다. * refactor: 보호 동물 등록 서비스 메서드 파라미터를 개선한다. * refactor: 중복된 클래스를 제거한다. * refactor: 잘못된 변수명을 수정한다.
- Loading branch information
1 parent
934766d
commit 76ae039
Showing
12 changed files
with
418 additions
and
280 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 0 additions & 26 deletions
26
src/main/java/com/clova/anifriends/domain/animal/mapper/AnimalMapper.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
src/main/java/com/clova/anifriends/domain/animal/service/AnimalMapper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package com.clova.anifriends.domain.animal.service; | ||
|
||
import com.clova.anifriends.domain.animal.dto.response.FindAnimalsResponse; | ||
import com.clova.anifriends.domain.animal.dto.response.FindAnimalsResponse.FindAnimalResponse; | ||
import com.clova.anifriends.domain.animal.repository.response.FindAnimalsResult; | ||
import com.clova.anifriends.domain.common.PageInfo; | ||
import java.util.List; | ||
import lombok.AccessLevel; | ||
import lombok.NoArgsConstructor; | ||
import org.springframework.data.domain.Page; | ||
|
||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
public final class AnimalMapper { | ||
|
||
public static FindAnimalsResponse resultToResponse(Page<FindAnimalsResult> animalPage) { | ||
List<FindAnimalResponse> content = animalPage | ||
.map(result -> new FindAnimalResponse( | ||
result.getAnimalId(), | ||
result.getAnimalName(), | ||
result.getShelterName(), | ||
result.getShelterAddress(), | ||
result.getAnimalImageUrl() | ||
)).toList(); | ||
PageInfo pageInfo = PageInfo.of(animalPage.getTotalElements(), animalPage.hasNext()); | ||
return new FindAnimalsResponse(pageInfo, content); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.