File tree Expand file tree Collapse file tree 2 files changed +4
-2
lines changed
src/main/java/umc/GrowIT/Server Expand file tree Collapse file tree 2 files changed +4
-2
lines changed Original file line number Diff line number Diff line change 1010import java .util .Optional ;
1111
1212public interface ItemRepository extends JpaRepository <Item , Long > {
13- List <Item > findAllByCategory (ItemCategory category );
13+ // 카테고리별 아이템 조회
14+ @ Query ("SELECT i FROM Item i WHERE i.category = :category ORDER BY i.price ASC" )
15+ List <Item > findAllByCategoryOrderByPriceAtAsc (ItemCategory category );
1416
1517 // UserItem을 통해 현재 사용자의 특정 아이템 구매여부 판별
1618 boolean existsByUserItemsUserIdAndId (Long userId , Long itemId );
Original file line number Diff line number Diff line change @@ -30,7 +30,7 @@ public class ItemQueryServiceImpl implements ItemQueryService {
3030 @ Override
3131 @ Transactional (readOnly = true )
3232 public ItemResponseDTO .ItemListDTO getItemList (ItemCategory category , Long userId ) {
33- List <Item > itemList = itemRepository .findAllByCategory (category );
33+ List <Item > itemList = itemRepository .findAllByCategoryOrderByPriceAtAsc (category );
3434
3535 // status 조회 - null 처리 추가
3636 Map <Long , ItemStatus > itemStatuses = new HashMap <>();
You can’t perform that action at this time.
0 commit comments