From ba1f04ab4a086032a493f7beedf4b50372ed71ae Mon Sep 17 00:00:00 2001 From: Berkant Karduman Date: Tue, 12 Mar 2024 21:39:35 +0300 Subject: [PATCH] Update SearchQueryRenderer.java NOT modifier support added for addIdFilter mothod Signed-off-by: Berkant Karduman --- .../fhir/persistence/jdbc/domain/SearchQueryRenderer.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/fhir-persistence-jdbc/src/main/java/org/linuxforhealth/fhir/persistence/jdbc/domain/SearchQueryRenderer.java b/fhir-persistence-jdbc/src/main/java/org/linuxforhealth/fhir/persistence/jdbc/domain/SearchQueryRenderer.java index 383d8db35e1..e0cda3606dc 100644 --- a/fhir-persistence-jdbc/src/main/java/org/linuxforhealth/fhir/persistence/jdbc/domain/SearchQueryRenderer.java +++ b/fhir-persistence-jdbc/src/main/java/org/linuxforhealth/fhir/persistence/jdbc/domain/SearchQueryRenderer.java @@ -1214,7 +1214,11 @@ protected void addIdFilter(QueryData queryData, String resourceType, QueryParame final String parentAlias = queryData.getLRAlias(); List values = queryParm.getValues().stream().map(p -> p.getValueCode()).collect(Collectors.toList()); if (values.size() == 1) { - currentSubQuery.from().where().and(parentAlias, "LOGICAL_ID").eq().bind(values.get(0)); + if (Modifier.NOT.equals(queryParm.getModifier())) { + currentSubQuery.from().where().and(parentAlias, "LOGICAL_ID").neq().bind(values.get(0)); + }else{ + currentSubQuery.from().where().and(parentAlias, "LOGICAL_ID").eq().bind(values.get(0)); + } } else if (values.size() > 1) { // the values are converted to bind-markers, so this is secure currentSubQuery.from().where().and(parentAlias, "LOGICAL_ID").in(values); @@ -3193,4 +3197,4 @@ private String getDataCol() { } } } -} \ No newline at end of file +}