Skip to content

Commit

Permalink
Fix: 페이지네이션 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
junohheo committed Dec 2, 2022
1 parent 985ea2d commit b98251d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,8 @@ public Order updateStatus(Long orderId) {

public Page<OrderHistoryDto> getAllList(Pageable pageable) {
log.info("Service/ 모든 주문내역 조회 시작");
List<Order> orders = orderRepository.findAll();
Page<Order> orderPage= orderRepository.findAll(pageable);
List<Order> orders = orderPage.getContent();
Long totalQuantity = orderRepository.countAllOrder();


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.backend.domain.order.domain.Order;
import com.backend.domain.order.domain.OrderStatus;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
Expand All @@ -22,13 +23,11 @@ public interface OrderRepository extends JpaRepository<Order, Long> {
)
Long countOrder(@Param("userId") Long userId);

@Query("select count(o) from Order o "
@Query("select count(o) from Order o"
)
Long countAllOrder();


List<Order> findAll();

List<Order> findByOrderStatus(OrderStatus orderStatus);


Expand All @@ -37,4 +36,8 @@ public interface OrderRepository extends JpaRepository<Order, Long> {
"order by o.createdAt desc"
)
List<Order> findByUserId(@Param("userId") Long userId);



Page<Order> findAll(Pageable pageable);
}

0 comments on commit b98251d

Please sign in to comment.