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);
|
stringOperationQuery = String.format("%s not like :%s or %s is null)", operationField, paramName, operationField);
|
||||||
break;
|
break;
|
||||||
case IN:
|
case IN:
|
||||||
value = value.replaceAll("'","").replaceAll("\"", "");
|
|
||||||
stringOperationQuery = String.format("%s in (:%s))", operationField, paramName);
|
stringOperationQuery = String.format("%s in (:%s))", operationField, paramName);
|
||||||
break;
|
break;
|
||||||
case NOT_IN:
|
case NOT_IN:
|
||||||
value = value.replaceAll("'","").replaceAll("\"", "");
|
|
||||||
stringOperationQuery = String.format("%s not in (:%s))", operationField, paramName);
|
stringOperationQuery = String.format("%s not in (:%s))", operationField, paramName);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
switch (stringFilterPredicate.getOperation()) {
|
switch (stringFilterPredicate.getOperation()) {
|
||||||
case IN:
|
case IN:
|
||||||
case NOT_IN:
|
case NOT_IN:
|
||||||
ctx.addStringListParameter(paramName, List.of(value.trim().split("\\s*,\\s*")));
|
ctx.addStringListParameter(paramName, getListValuesWithoutQuote(value));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
ctx.addStringParameter(paramName, value);
|
ctx.addStringParameter(paramName, value);
|
||||||
@ -580,6 +578,10 @@ public class EntityKeyMapping {
|
|||||||
return String.format("((%s is not null and %s)", field, stringOperationQuery);
|
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) {
|
private String buildNumericPredicateQuery(QueryContext ctx, String field, NumericFilterPredicate numericFilterPredicate) {
|
||||||
String paramName = getNextParameterName(field);
|
String paramName = getNextParameterName(field);
|
||||||
ctx.addDoubleParameter(paramName, numericFilterPredicate.getValue().getValue());
|
ctx.addDoubleParameter(paramName, numericFilterPredicate.getValue().getValue());
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user