Fix ordering of sub entries
This commit is contained in:
parent
4bfcd2ea3e
commit
a7420a6ff4
@ -8,9 +8,14 @@ WITH x AS (
|
||||
WHERE u.user_id = app.get_user_id()
|
||||
),
|
||||
t AS (
|
||||
SELECT
|
||||
ROWNUM AS r#, -- to keep hierarchy sorted
|
||||
t.*
|
||||
FROM (
|
||||
SELECT
|
||||
n.app_id,
|
||||
n.page_id,
|
||||
n.order#,
|
||||
--
|
||||
REPLACE(p.page_name, '&' || 'APP_NAME.', a.application_name) AS page_name,
|
||||
REPLACE(p.page_title, '&' || 'APP_NAME.', a.application_name) AS page_title,
|
||||
@ -37,13 +42,20 @@ t AS (
|
||||
CONNECT BY n.parent_id = PRIOR n.page_id
|
||||
AND n.app_id = PRIOR n.app_id
|
||||
START WITH n.parent_id IS NULL
|
||||
ORDER SIBLINGS BY n.app_id, n.order#, n.page_id
|
||||
) t
|
||||
)
|
||||
SELECT
|
||||
n.app_id,
|
||||
n.page_id,
|
||||
n.parent_id,
|
||||
n.order#,
|
||||
t.page_root || ' ' || COALESCE(t.page_group, (SELECT t.page_group FROM t WHERE t.app_id = n.app_id AND t.page_id = n.parent_id)) AS page_group,
|
||||
--
|
||||
t.page_root || ' ' || COALESCE (
|
||||
t.page_group,
|
||||
(SELECT t.page_group FROM t WHERE t.app_id = n.app_id AND t.page_id = n.parent_id)
|
||||
) AS page_group,
|
||||
--
|
||||
t.page_alias,
|
||||
--
|
||||
CASE WHEN r.page_id IS NULL
|
||||
@ -79,7 +91,7 @@ SELECT
|
||||
--
|
||||
'UD' AS allow_changes, -- U = update, D = delete
|
||||
--
|
||||
t.page_root || '.' || t.depth || '.' || NVL(n.order#, n.page_id) AS sort_order,
|
||||
t.page_root || '.' || TO_CHAR(10000 + t.r#) || '.' || NVL(t.order#, t.page_id) AS sort_order,
|
||||
--
|
||||
CASE
|
||||
WHEN r.page_id IS NOT NULL
|
||||
@ -97,7 +109,7 @@ JOIN apps a
|
||||
ON a.app_id = n.app_id
|
||||
AND a.is_active = 'Y'
|
||||
CROSS JOIN x
|
||||
LEFT JOIN t
|
||||
LEFT JOIN t ---------- LEFT JOIN ???
|
||||
ON t.app_id = n.app_id
|
||||
AND t.page_id = n.page_id
|
||||
LEFT JOIN nav_pages_to_remove r
|
||||
@ -149,7 +161,7 @@ SELECT
|
||||
--
|
||||
NULL AS allow_changes, -- no changes allowed
|
||||
--
|
||||
NVL(t.page_root, n.page_id) || '.' || (t.depth + 1) || '.' || NVL(n.order#, n.page_id) AS sort_order,
|
||||
NVL(t.page_root, n.page_id) || '.' || TO_CHAR(10000 + t.r#) || '.' || NVL(n.order#, n.page_id) AS sort_order,
|
||||
--
|
||||
app.get_icon('fa-plus-square', 'Create record in Navigation table') AS action,
|
||||
--
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user