diff --git a/pom.xml b/pom.xml index 95e14bc79..7d897442e 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ opensrp-server-core jar - 3.2.8-SNAPSHOT + 3.2.9-SNAPSHOT opensrp-server-core OpenSRP Server Core module https://github.com/OpenSRP/opensrp-server-core diff --git a/src/main/java/org/opensrp/repository/postgres/mapper/custom/xml/CustomLocationMetadataMapper.xml b/src/main/java/org/opensrp/repository/postgres/mapper/custom/xml/CustomLocationMetadataMapper.xml index 5f99cd8f9..5ac0b7f66 100755 --- a/src/main/java/org/opensrp/repository/postgres/mapper/custom/xml/CustomLocationMetadataMapper.xml +++ b/src/main/java/org/opensrp/repository/postgres/mapper/custom/xml/CustomLocationMetadataMapper.xml @@ -214,11 +214,14 @@ WITH RECURSIVE locations AS ( SELECT lm1.geojson_id, lm1.parent_id, lm1.location_id, 0 as level - FROM core.location_metadata lm1 WHERE geojson_id IN - - #{value} - - AND lm1.status IN ('ACTIVE', 'PENDING_REVIEW') + FROM core.location_metadata lm1 + WHERE lm1.status IN ('ACTIVE', 'PENDING_REVIEW') + + AND geojson_id IN + + #{value} + + UNION SELECT lm2.geojson_id, lm2.parent_id, lm2.location_id,level+1 as level FROM locations lm1