Fix for OR operation in complex filter.
This commit is contained in:
parent
5cee3ba91d
commit
02f928b918
@ -329,10 +329,10 @@ public class DefaultEntityQueryRepository implements EntityQueryRepository {
|
||||
String entityFieldsQuery = EntityKeyMapping.buildQuery(ctx, entityFieldsFilters, entityFilter.getType());
|
||||
String result = permissionQuery;
|
||||
if (!entityFilterQuery.isEmpty()) {
|
||||
result += " and " + entityFilterQuery;
|
||||
result += " and (" + entityFilterQuery + ")";
|
||||
}
|
||||
if (!entityFieldsQuery.isEmpty()) {
|
||||
result += " and " + entityFieldsQuery;
|
||||
result += " and (" + entityFieldsQuery + ")";
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -481,13 +481,13 @@ public class EntityKeyMapping {
|
||||
stringOperationQuery = String.format("%s like :%s) or (%s is null and :%s = '%%')", operationField, paramName, operationField, paramName);
|
||||
break;
|
||||
case CONTAINS:
|
||||
if (value.length()>1) {
|
||||
if (value.length()>0) {
|
||||
value = "%" + value + "%";
|
||||
}
|
||||
stringOperationQuery = String.format("%s like :%s) or (%s is null and :%s = '')", operationField, paramName, operationField, paramName);
|
||||
break;
|
||||
case NOT_CONTAINS:
|
||||
if (value.length()>1) {
|
||||
if (value.length()>0) {
|
||||
value = "%" + value + "%";
|
||||
}
|
||||
stringOperationQuery = String.format("%s not like :%s) or (%s is null and :%s != '')", operationField, paramName, operationField, paramName);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user