mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-07-17 13:05:49 +00:00
Update VetController.java
Add Log
This commit is contained in:
parent
d2b2af1d39
commit
b1430053af
1 changed files with 44 additions and 0 deletions
|
@ -48,6 +48,17 @@ class VetController {
|
||||||
Vets vets = new Vets();
|
Vets vets = new Vets();
|
||||||
Page<Vet> paginated = findPaginated(page);
|
Page<Vet> paginated = findPaginated(page);
|
||||||
vets.getVetList().addAll(paginated.toList());
|
vets.getVetList().addAll(paginated.toList());
|
||||||
|
System.out.println("===============================================");
|
||||||
|
System.out.println("===============================================");
|
||||||
|
System.out.println("===============================================");
|
||||||
|
System.out.println("===============================================");
|
||||||
|
System.out.println("===============================================");
|
||||||
|
System.out.println("===============================================");
|
||||||
|
System.out.println("===============================================");
|
||||||
|
System.out.println("===============================================");
|
||||||
|
System.out.println("===============================================");
|
||||||
|
System.out.println("===============================================");
|
||||||
|
System.out.println("===============================================");
|
||||||
return addPaginationModel(page, paginated, model);
|
return addPaginationModel(page, paginated, model);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -57,12 +68,34 @@ class VetController {
|
||||||
model.addAttribute("totalPages", paginated.getTotalPages());
|
model.addAttribute("totalPages", paginated.getTotalPages());
|
||||||
model.addAttribute("totalItems", paginated.getTotalElements());
|
model.addAttribute("totalItems", paginated.getTotalElements());
|
||||||
model.addAttribute("listVets", listVets);
|
model.addAttribute("listVets", listVets);
|
||||||
|
System.out.println("===============================================");
|
||||||
|
System.out.println("===============================================");
|
||||||
|
System.out.println("===============================================");
|
||||||
|
System.out.println("===============================================");
|
||||||
|
System.out.println("===============================================");
|
||||||
|
System.out.println("===============================================");
|
||||||
|
System.out.println("===============================================");
|
||||||
|
System.out.println("===============================================");
|
||||||
|
System.out.println("===============================================");
|
||||||
|
System.out.println("===============================================");
|
||||||
|
System.out.println("===============================================");
|
||||||
return "vets/vetList";
|
return "vets/vetList";
|
||||||
}
|
}
|
||||||
|
|
||||||
private Page<Vet> findPaginated(int page) {
|
private Page<Vet> findPaginated(int page) {
|
||||||
int pageSize = 5;
|
int pageSize = 5;
|
||||||
Pageable pageable = PageRequest.of(page - 1, pageSize);
|
Pageable pageable = PageRequest.of(page - 1, pageSize);
|
||||||
|
System.out.println("===============================================");
|
||||||
|
System.out.println("===============================================");
|
||||||
|
System.out.println("===============================================");
|
||||||
|
System.out.println("===============================================");
|
||||||
|
System.out.println("===============================================");
|
||||||
|
System.out.println("===============================================");
|
||||||
|
System.out.println("===============================================");
|
||||||
|
System.out.println("===============================================");
|
||||||
|
System.out.println("===============================================");
|
||||||
|
System.out.println("===============================================");
|
||||||
|
System.out.println("===============================================");
|
||||||
return vetRepository.findAll(pageable);
|
return vetRepository.findAll(pageable);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -72,6 +105,17 @@ class VetController {
|
||||||
// objects so it is simpler for JSon/Object mapping
|
// objects so it is simpler for JSon/Object mapping
|
||||||
Vets vets = new Vets();
|
Vets vets = new Vets();
|
||||||
vets.getVetList().addAll(this.vetRepository.findAll());
|
vets.getVetList().addAll(this.vetRepository.findAll());
|
||||||
|
System.out.println("===============================================");
|
||||||
|
System.out.println("===============================================");
|
||||||
|
System.out.println("===============================================");
|
||||||
|
System.out.println("===============================================");
|
||||||
|
System.out.println("===============================================");
|
||||||
|
System.out.println("===============================================");
|
||||||
|
System.out.println("===============================================");
|
||||||
|
System.out.println("===============================================");
|
||||||
|
System.out.println("===============================================");
|
||||||
|
System.out.println("===============================================");
|
||||||
|
System.out.println("===============================================");
|
||||||
return vets;
|
return vets;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue