use of me.kadarh.mecaworks.domain.others.Fournisseur in project mecaworks by KadarH.
the class FournisseurServiceImpl method fournisseurList.
/**
* search with nom
*
* @param pageable page description
* @param search keyword
* @return Page
*/
@Override
public Page<Fournisseur> fournisseurList(Pageable pageable, String search) {
log.info("Service- FournisseurServiceImpl Calling FournisseurList with params :" + pageable + ", " + search);
try {
if (search.isEmpty()) {
log.debug("fetching Fournisseur page");
return fournisseurRepo.findAll(pageable);
} else {
log.debug("Searching by :" + search);
// creating example
Fournisseur fournisseur = new Fournisseur();
fournisseur.setNom(search);
// creating matcher
ExampleMatcher matcher = ExampleMatcher.matchingAny().withStringMatcher(ExampleMatcher.StringMatcher.CONTAINING).withIgnoreCase().withIgnoreNullValues();
Example<Fournisseur> example = Example.of(fournisseur, matcher);
log.debug("getting search results");
return fournisseurRepo.findAll(example, pageable);
}
} catch (Exception e) {
log.debug("Failed retrieving list of Fournisseurs");
throw new OperationFailedException("Operation échouée", e);
}
}
use of me.kadarh.mecaworks.domain.others.Fournisseur in project mecaworks by KadarH.
the class BonFournisseurServiceImpl method bonList.
@Override
public Page<BonFournisseur> bonList(Pageable pageable, String search) {
log.info("Service- BonFournisseurServiceImpl Calling bonList with params :" + pageable + ", " + search);
try {
if (search.isEmpty()) {
log.debug("fetching bonEngins page");
return bonFournisseurRepo.findAll(pageable);
} else {
log.debug("Searching by :" + search);
// creating example
// Searching by code bon , nom chantier, nom fournisseur
BonFournisseur bonFournisseur = new BonFournisseur();
Chantier chantier = new Chantier();
chantier.setNom(search);
Fournisseur fournisseur = new Fournisseur();
fournisseur.setNom(search);
bonFournisseur.setChantier(chantier);
bonFournisseur.setFournisseur(fournisseur);
bonFournisseur.setCode(search);
// creating matcher
ExampleMatcher matcher = ExampleMatcher.matchingAny().withStringMatcher(ExampleMatcher.StringMatcher.CONTAINING).withIgnoreCase().withIgnoreNullValues();
Example<BonFournisseur> example = Example.of(bonFournisseur, matcher);
Pageable pageable1 = PageRequest.of(pageable.getPageNumber(), pageable.getPageSize(), Sort.by(Sort.Direction.DESC, bonFournisseur.getDate().toString()));
log.debug("getting search results");
return bonFournisseurRepo.findAll(example, pageable1);
}
} catch (Exception e) {
log.debug("Failed retrieving list of employes");
throw new OperationFailedException("Operation échouée", e);
}
}
Aggregations