remove replace quote to method with a meaningful name. Also, remove split values to list to this method.
This commit is contained in:
parent
a9b3f409f3
commit
c197f27d8e
@ -561,18 +561,16 @@ public class EntityKeyMapping {
|
||||
stringOperationQuery = String.format("%s not like :%s or %s is null)", operationField, paramName, operationField);
|
||||
break;
|
||||
case IN:
|
||||
value = value.replaceAll("'","").replaceAll("\"", "");
|
||||
stringOperationQuery = String.format("%s in (:%s))", operationField, paramName);
|
||||
break;
|
||||
case NOT_IN:
|
||||
value = value.replaceAll("'","").replaceAll("\"", "");
|
||||
stringOperationQuery = String.format("%s not in (:%s))", operationField, paramName);
|
||||
break;
|
||||
}
|
||||
switch (stringFilterPredicate.getOperation()) {
|
||||
case IN:
|
||||
case NOT_IN:
|
||||
ctx.addStringListParameter(paramName, List.of(value.trim().split("\\s*,\\s*")));
|
||||
ctx.addStringListParameter(paramName, getListValuesWithoutQuote(value));
|
||||
break;
|
||||
default:
|
||||
ctx.addStringParameter(paramName, value);
|
||||
@ -580,6 +578,10 @@ public class EntityKeyMapping {
|
||||
return String.format("((%s is not null and %s)", field, stringOperationQuery);
|
||||
}
|
||||
|
||||
private List<String> getListValuesWithoutQuote(String value) {
|
||||
return List.of(value.replaceAll("'", "").replaceAll("\"", "").trim().split("\\s*,\\s*"));
|
||||
}
|
||||
|
||||
private String buildNumericPredicateQuery(QueryContext ctx, String field, NumericFilterPredicate numericFilterPredicate) {
|
||||
String paramName = getNextParameterName(field);
|
||||
ctx.addDoubleParameter(paramName, numericFilterPredicate.getValue().getValue());
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user