Skip to content

Commit

Permalink
Fix: 질병, 증상, 동물 리스트 null값이 아닌 빈 배열로 판단
Browse files Browse the repository at this point in the history
Fix: 질병, 증상, 동물 리스트 null값이 아닌 빈 배열로 판단
  • Loading branch information
seoyeonjin authored Jan 23, 2025
2 parents 3b17789 + 00157b3 commit 9e2d9f7
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -257,21 +257,21 @@ public PostListResponse getPosts(final Long memberId, final String keyword, fina
if (keyword != null) {
spec = spec.and(PostSpecification.hasKeyword(keyword));
}
if (animalIds != null) {
if (!animalIds.isEmpty()) {
final List<PostTag> postTags = postTagRepository.findAllByTagIdAndTagType(animalIds, TagType.ANIMAL);
final List<Long> postIds = postTags.stream()
.map(PostTag::getPostId)
.toList();
spec = spec.and(PostSpecification.inPostIds(postIds));
}
if (symptomIds != null) {
if (!symptomIds.isEmpty()) {
final List<PostTag> postTags = postTagRepository.findAllByTagIdAndTagType(symptomIds, TagType.SYMPTOM);
final List<Long> postIds = postTags.stream()
.map(PostTag::getPostId)
.toList();
spec = spec.and(PostSpecification.inPostIds(postIds));
}
if (diseaseIds != null) {
if (!diseaseIds.isEmpty()) {
final List<PostTag> postTags = postTagRepository.findAllByTagIdAndTagType(diseaseIds, TagType.DISEASE);
final List<Long> postIds = postTags.stream()
.map(PostTag::getPostId)
Expand Down

0 comments on commit 9e2d9f7

Please sign in to comment.