This commit is contained in:
Joan Sanchez 2019-09-13 13:26:50 +02:00
parent 248dff2747
commit 043fe80254
1 changed files with 3 additions and 1 deletions

View File

@ -92,7 +92,9 @@ module.exports = Self => {
AND child.depth = parent.depth + 1
LEFT JOIN zoneIncluded zi ON zi.geoFk = child.id
AND zi.zoneFk = ?
WHERE parent.id = ?) AS nst`, [zoneFk, parentFk]);
WHERE (? IS NULL AND zg.parentFk IS NULL)
OR (? IS NOT NULL AND zg.parentFk = ?)) AS nst`,
[zoneFk, parentFk, parentFk, parentFk]);
// Get nodes from depth greather than Origin
stmt.merge(conn.makeSuffix(filter));