use of me.kadarh.mecaworks.domain.others.Employe in project mecaworks by KadarH.
the class EmployeController method add.
@GetMapping("/add")
public String add(Model model) {
model.addAttribute("employe", new Employe());
model.addAttribute("metiers", Metier.values());
return "admin/employes/add";
}
use of me.kadarh.mecaworks.domain.others.Employe in project mecaworks by KadarH.
the class EmployeServiceImpl method employesList.
/**
* search with nom
*
* @param pageable page description
* @param search keyword
* @return Page
*/
@Override
public Page<Employe> employesList(Pageable pageable, String search) {
log.info("Service- employeServiceImpl Calling employeList with params :" + pageable + ", " + search);
try {
if (search.isEmpty()) {
log.debug("fetching employe page");
return employeRepo.findAll(pageable);
} else {
log.debug("Searching by :" + search);
// creating example
Employe employe = new Employe();
employe.setNom(search);
employe.setMetier(search);
// creating matcher
ExampleMatcher matcher = ExampleMatcher.matchingAny().withStringMatcher(ExampleMatcher.StringMatcher.CONTAINING).withIgnoreCase().withIgnoreNullValues();
Example<Employe> example = Example.of(employe, matcher);
log.debug("getting search results");
return employeRepo.findAll(example, pageable);
}
} catch (Exception e) {
log.debug("Failed retrieving list of employes");
throw new OperationFailedException("Operation échouée", e);
}
}
Aggregations