- Timestamp:
- 10/07/21 20:22:23 (3 years ago)
- Branches:
- master
- Children:
- ee0e297
- Parents:
- 276a8b6
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/main/java/it/finki/charitable/services/ReportPostService.java
r276a8b6 r0c37625 5 5 import it.finki.charitable.entities.ReportPost; 6 6 import it.finki.charitable.repository.ReportPostRepository; 7 import org.springframework.data.domain.Page; 8 import org.springframework.data.domain.PageRequest; 9 import org.springframework.data.domain.Pageable; 10 import org.springframework.data.domain.Sort; 7 11 import org.springframework.stereotype.Service; 8 12 … … 18 22 } 19 23 20 public List<ReportPost> findAll() { 21 return reportPostRepository.findAll(); 24 public Page<ReportPost> findAll(int pageNo, int pageSize, String sort, String order) { 25 Sort s = Sort.by(sort); 26 s = order.equals("asc") ? s.ascending() : s.descending(); 27 Pageable pageable = PageRequest.of(pageNo - 1, pageSize, s); 28 return reportPostRepository.findAll(pageable); 22 29 } 23 30
Note:
See TracChangeset
for help on using the changeset viewer.