Changeset 0c37625 for src/main/java/it/finki/charitable/services
- Timestamp:
- 10/07/21 20:22:23 (3 years ago)
- Branches:
- master
- Children:
- ee0e297
- Parents:
- 276a8b6
- Location:
- src/main/java/it/finki/charitable/services
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/main/java/it/finki/charitable/services/DonationPostService.java
r276a8b6 r0c37625 54 54 } 55 55 56 public Page<DonationPost> findPaginated(int pageNo, int pageSize, String sort, String order ) {56 public Page<DonationPost> findPaginated(int pageNo, int pageSize, String sort, String order, boolean approved) { 57 57 Sort s = Sort.by(sort); 58 58 s = order.equals("asc") ? s.ascending() : s.descending(); 59 59 Pageable pageable = PageRequest.of(pageNo - 1, pageSize, s); 60 return donationPostRepository.findAllByApproved(pageable, true);60 return donationPostRepository.findAllByApproved(pageable, approved); 61 61 } 62 62 } -
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.