Skip to content

Commit 6ac53c3

Browse files
committed
feat : 정렬 기준에 따른 분기 처리
1 parent 7d3ce17 commit 6ac53c3

File tree

1 file changed

+7
-2
lines changed
  • adapters/out-persistence/src/main/kotlin/com/pokit/out/persistence/category/impl

1 file changed

+7
-2
lines changed

adapters/out-persistence/src/main/kotlin/com/pokit/out/persistence/category/impl/CategoryAdapter.kt

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,13 @@ class CategoryAdapter(
5050
}
5151

5252
override fun loadAllInId(categoryIds: List<Long>, pageable: Pageable): Slice<Category> {
53-
return categoryRepository.findAllByIdInAndDeleted(categoryIds, pageable, false)
54-
.map { it.toDomain() }
53+
return if (pageable.sort.equals("createdAt")) {
54+
categoryRepository.findAllByIdInAndCreatedAtSort(categoryIds, pageable, false)
55+
.map { it.toDomain() }
56+
} else {
57+
categoryRepository.findAllByIdInAndNameSort(categoryIds, pageable, false)
58+
.map { it.toDomain() }
59+
}
5560
}
5661

5762
}

0 commit comments

Comments
 (0)