From c3f4a932bcc6362ec3f3008546d655489419984e Mon Sep 17 00:00:00 2001 From: viniciosarodrigues Date: Fri, 22 May 2020 19:03:51 -0300 Subject: [PATCH] bug: ajuste em filtros de Procedimentos --- .../filters/ProcedureOrEventFilters.java | 20 +++++++------------ .../ProcedureOrEventRepositoryCustomImpl.java | 2 +- 2 files changed, 8 insertions(+), 14 deletions(-) diff --git a/src/main/java/br/com/nivlabs/gp/controller/filters/ProcedureOrEventFilters.java b/src/main/java/br/com/nivlabs/gp/controller/filters/ProcedureOrEventFilters.java index 614acfcc..e50737e6 100644 --- a/src/main/java/br/com/nivlabs/gp/controller/filters/ProcedureOrEventFilters.java +++ b/src/main/java/br/com/nivlabs/gp/controller/filters/ProcedureOrEventFilters.java @@ -13,21 +13,15 @@ @EqualsAndHashCode(callSuper = true) public class ProcedureOrEventFilters extends CustomFilters { - private static final long serialVersionUID = -8122726857291316469L; + private static final long serialVersionUID = -8122726857291316469L; - private String id; + private String id; - private String description = ""; + private String description = ""; - private ActiveType activeType; + private ActiveType activeType; - public ActiveType getActiveType() { - if (activeType == null) - this.activeType = ActiveType.ACTIVE; - return this.activeType; - } - - public String getDescription() { - return "%".concat(this.description).concat("%"); - } + public String getDescription() { + return "%".concat(this.description).concat("%"); + } } diff --git a/src/main/java/br/com/nivlabs/gp/repository/custom/procedureorevent/ProcedureOrEventRepositoryCustomImpl.java b/src/main/java/br/com/nivlabs/gp/repository/custom/procedureorevent/ProcedureOrEventRepositoryCustomImpl.java index 6ca24262..d61f2062 100644 --- a/src/main/java/br/com/nivlabs/gp/repository/custom/procedureorevent/ProcedureOrEventRepositoryCustomImpl.java +++ b/src/main/java/br/com/nivlabs/gp/repository/custom/procedureorevent/ProcedureOrEventRepositoryCustomImpl.java @@ -50,7 +50,7 @@ protected List> createRestrictions(CustomFilters c attributes.add((cb, from) -> cb.equal(from.get("id"), Long.parseLong(filters.getId()))); } if (!StringUtils.isNullOrEmpty(filters.getDescription())) { - attributes.add((cb, from) -> cb.equal(from.get("description"), filters.getDescription())); + attributes.add((cb, from) -> cb.like(from.get("description"), filters.getDescription())); } if (filters.getActiveType() != null) { attributes.add((cb, from) -> cb.equal(from.get("active"), filters.getActiveType() == ActiveType.ACTIVE));