// 오름차순 내림차순 설정
Sort.Direction direction = isAsc ? Sort.Direction.ASC : Sort.Direction.DESC;
// direction : 정렬 방식
// sortBy : 정렬 컬럼
Sort sort = Sort.by(direction, sortBy);
Pageable pageable = PageRequest.of(page, size, sort);
Page<Product> products = productRepository.findAllByUser(user, pageable);
'TIL' 카테고리의 다른 글
Cannot add or update a child row: a foreign key constraint fails Error (0) | 2024.08.29 |
---|---|
프로그래머스 알고리즘 문제풀이 달리기 경주 (시간 초과) (0) | 2024.08.28 |
면접 준비 (0) | 2024.08.26 |
Entity 연관 관계 ( 1 : 1 / N : 1 / 1 : N / N : M ) (0) | 2024.08.23 |
프로그래머스 알고리즘 문제풀이 햄버거 만들기 (시간 초과) (0) | 2024.08.22 |