pick2
gitea/salix/master This commit looks good
Details
gitea/salix/master This commit looks good
Details
This commit is contained in:
parent
dd0c34d31b
commit
c7423f5580
|
@ -31,7 +31,7 @@ module.exports = Self => {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Self.getLeaves = async(zoneFk, parentFk, filter) => {
|
Self.getLeaves = async(zoneFk, parentFk = null, filter) => {
|
||||||
let conn = Self.dataSource.connector;
|
let conn = Self.dataSource.connector;
|
||||||
let stmts = [];
|
let stmts = [];
|
||||||
|
|
||||||
|
@ -79,18 +79,15 @@ module.exports = Self => {
|
||||||
AND zg.depth > 0
|
AND zg.depth > 0
|
||||||
UNION ALL
|
UNION ALL
|
||||||
SELECT
|
SELECT
|
||||||
child.id,
|
zg.id,
|
||||||
child.name,
|
zg.name,
|
||||||
child.lft,
|
zg.lft,
|
||||||
child.rgt,
|
zg.rgt,
|
||||||
child.depth,
|
zg.depth,
|
||||||
child.sons,
|
zg.sons,
|
||||||
zi.isIncluded AS selected
|
zi.isIncluded AS selected
|
||||||
FROM zoneGeo parent
|
FROM zoneGeo zg
|
||||||
JOIN zoneGeo child ON child.lft > parent.lft
|
LEFT JOIN zoneIncluded zi ON zi.geoFk = zg.id
|
||||||
AND child.rgt < parent.rgt
|
|
||||||
AND child.depth = parent.depth + 1
|
|
||||||
LEFT JOIN zoneIncluded zi ON zi.geoFk = child.id
|
|
||||||
AND zi.zoneFk = ?
|
AND zi.zoneFk = ?
|
||||||
WHERE (? IS NULL AND zg.parentFk IS NULL)
|
WHERE (? IS NULL AND zg.parentFk IS NULL)
|
||||||
OR (? IS NOT NULL AND zg.parentFk = ?)) AS nst`,
|
OR (? IS NOT NULL AND zg.parentFk = ?)) AS nst`,
|
||||||
|
|
Loading…
Reference in New Issue