u
This commit is contained in:
16
src/sql/category.js
Normal file
16
src/sql/category.js
Normal file
@@ -0,0 +1,16 @@
|
||||
export const GET_TREE = `
|
||||
WITH tree AS (
|
||||
SELECT id, parent_id, sort
|
||||
FROM category
|
||||
WHERE id = @rootId
|
||||
|
||||
UNION ALL
|
||||
|
||||
SELECT c.id, c.parent_id, c.sort
|
||||
FROM category c
|
||||
INNER JOIN tree t ON c.parent_id = t.id
|
||||
)
|
||||
SELECT id, parent_id, sort
|
||||
FROM tree
|
||||
ORDER BY sort, id
|
||||
`;
|
||||
Reference in New Issue
Block a user