#7 Perfil de Personal Administrativo - Listado de empleados(Invertir orden desde el ultimo registro al primero)

This commit is contained in:
jesus.pelaez 2024-11-28 01:30:17 -04:00
parent d53792f380
commit e8152308fe

View File

@ -63,6 +63,7 @@ public class EmployeeService {
public List<Employee> findEmployees( public List<Employee> findEmployees(
final int start, final int pageSize, final String sortProperty, final boolean asc) { final int start, final int pageSize, final String sortProperty, final boolean asc) {
List<Employee> employees = employeeRepository.findAll(); List<Employee> employees = employeeRepository.findAll();
Collections.reverse(employees);
int end = Math.min(start + pageSize, employees.size()); int end = Math.min(start + pageSize, employees.size());
employees.sort(new BeanComparator<>(sortProperty)); employees.sort(new BeanComparator<>(sortProperty));
@ -76,6 +77,7 @@ public class EmployeeService {
public List<Employee> findEmployees(final int start, final int pageSize) { public List<Employee> findEmployees(final int start, final int pageSize) {
List<Employee> employees = employeeRepository.findAll(); List<Employee> employees = employeeRepository.findAll();
Collections.reverse(employees);
int end = Math.min(start + pageSize, employees.size()); int end = Math.min(start + pageSize, employees.size());
return employees.subList(start, end); return employees.subList(start, end);
@ -125,7 +127,9 @@ public class EmployeeService {
} }
public List<Employee> findAllEmployees() { public List<Employee> findAllEmployees() {
return employeeRepository.findAll(); List<Employee> employees = employeeRepository.findAll();
Collections.reverse(employees);
return employees;
} }
public List<Employee> findEmployeesByTeam(final String teamName) { public List<Employee> findEmployeesByTeam(final String teamName) {