Fix for OR operation in complex filter.

This commit is contained in:
zbeacon 2020-07-27 09:22:28 +03:00 committed by Andrew Shvayka
parent 5cee3ba91d
commit 02f928b918
2 changed files with 4 additions and 4 deletions

View File

@ -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;
}

View File

@ -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);