Skip to content

Commit

Permalink
Merge pull request #348 from Greenstand/planting-org
Browse files Browse the repository at this point in the history
feat: planting_org
  • Loading branch information
dadiorchen authored Nov 9, 2022
2 parents a1e948b + 929561f commit 44fc16e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
5 changes: 5 additions & 0 deletions src/models/sqls/SQLCase1.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,11 @@ class SQLCase1{
) org ON planter.organization_id = org.entity_id
) planter_ids
ON trees.planter_id = planter_ids.id
UNION ALL
select id from trees where planting_organization_id = (
select id from entity where map_name = '${this.mapName}'
)
) t1
)
`;
Expand Down
8 changes: 5 additions & 3 deletions src/models/sqls/SQLCase1V2.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,17 @@ class SQLCase1V2 extends SQLCase1{
result += `
INNER JOIN
( select trees.id as org_tree_id from trees
INNER JOIN (
where trees.planter_id in (
SELECT id FROM planter
JOIN (
SELECT entity_id FROM getEntityRelationshipChildren(
(SELECT id FROM entity WHERE map_name = '${this.mapName}')
)
) org ON planter.organization_id = org.entity_id
) planter_ids
ON trees.planter_id = planter_ids.id
) OR
trees.planting_organization_id = (
select id from entity where map_name = '${this.mapName}'
)
) tree_ids
ON tree_region.tree_id = tree_ids.org_tree_id`;
}
Expand Down

0 comments on commit 44fc16e

Please sign in to comment.