Gestión de especialidades con paginado.
This commit is contained in:
@@ -118,6 +118,30 @@ public class SystemAdminFacadeBean implements SystemAdminFacadeRemote {
|
||||
return usr;
|
||||
}
|
||||
|
||||
public List<MedicalSpecialtyTO> listSpecialtiesPaged(int pageNumber, int pageSize) {
|
||||
TypedQuery<MedicalSpecialtyJPA> query = entman.createQuery("SELECT s from MedicalSpecialtyJPA s order by s.name", MedicalSpecialtyJPA.class);
|
||||
|
||||
if (pageSize > 0) {
|
||||
query.setFirstResult(pageNumber * pageSize);
|
||||
query.setMaxResults(pageSize);
|
||||
}
|
||||
|
||||
List<MedicalSpecialtyJPA> allJPA = query.getResultList();
|
||||
List<MedicalSpecialtyTO> specialties = new ArrayList<MedicalSpecialtyTO>();
|
||||
|
||||
for (MedicalSpecialtyJPA item : allJPA) {
|
||||
specialties.add(commonServices.getPOJOforMedicalSpecialtyJPA(item));
|
||||
}
|
||||
|
||||
return specialties;
|
||||
}
|
||||
|
||||
public Long getSpecialtiesCount() {
|
||||
TypedQuery<Long> query = entman.createQuery("SELECT count(1) from MedicalSpecialtyJPA", Long.class);
|
||||
|
||||
return query.getSingleResult();
|
||||
}
|
||||
|
||||
public MedicalSpecialtyTO updateSpecialty(int id, String name, String description) throws Exception {
|
||||
MedicalSpecialtyJPA ms = entman.find(MedicalSpecialtyJPA.class, id);
|
||||
|
||||
|
||||
@@ -22,6 +22,10 @@ public interface SystemAdminFacadeRemote {
|
||||
*/
|
||||
|
||||
public LoggedUserTO login(String id, String pwd);
|
||||
|
||||
public List<MedicalSpecialtyTO> listSpecialtiesPaged(int pageNumber, int pageSize);
|
||||
|
||||
public Long getSpecialtiesCount();
|
||||
|
||||
public MedicalSpecialtyTO updateSpecialty(int id, String name, String description) throws Exception;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user