git clone https://gitee.com/engalar/mendix-custom-widget-gantt.git --depth=1 ./dummy && cd ./dummy && git clone https://gitee.com/engalar/mendix-testproject-800.git --depth=1 ./tests/testProject && rd /s /q .\tests\testProject\.git && xcopy dummy .\tests\testProject /E /Y && start tests/testProject/testProject.mpr
git clone --recurse-submodules https://gitee.com/engalar/mendix-custom-widget-gantt.git.&& npm run m && npm run x && npm run testProject && npm run start
P1/P2/P3/T1
P4/T2
P4/P5/T3
查询叶子节点 P1/P2/P3/T1
到根节点路径上的所有节点
WITH recursive nod as (
select
bn.*
from
`myfirstmodule$basenode` bn
where
bn.name = 'P1/P2/P3/T1'
union
all
select
bn.*
from
`myfirstmodule$basenode` bn
inner join `myfirstmodule$project` project on project.`myfirstmodule$projectnodeid` = bn.id
inner join nod on project.`myfirstmodule$basenodeid` = nod.id
where
nod.id = project.`myfirstmodule$basenodeid`
)
select
*
from
nod;
12103423998558209 P1/P2/P3/T1 0.00000000 MyFirstModule.TaskNode
12666373951979523 P1/P2/P3 0.00000000 MyFirstModule.ProjectNode
12666373951979522 P1/P2 0.00000000 MyFirstModule.ProjectNode
12666373951979521 P1 0.00000000 MyFirstModule.ProjectNode
查询叶子节点 P4/T2
到根节点路径上的所有节点 的所有直接子节点
WITH recursive nod as (
select
bn.*
from
`myfirstmodule$basenode` bn
where
bn.name = 'P4/T2'
union
all
select
bn.*
from
`myfirstmodule$basenode` bn
inner join `myfirstmodule$project` project on project.`myfirstmodule$projectnodeid` = bn.id
inner join nod on project.`myfirstmodule$basenodeid` = nod.id
where
nod.id = project.`myfirstmodule$basenodeid`
)
select
bn.*
from
`myfirstmodule$basenode` bn
inner join `myfirstmodule$project` project on project.`myfirstmodule$basenodeid` = bn.id
inner join nod on project.`myfirstmodule$projectnodeid` = nod.id;
12103423998558210 P4/T2 0.00000000 MyFirstModule.TaskNode
12666373951979525 P4/P5 0.00000000 MyFirstModule.ProjectNode
- 优化前
- 优化
ALTER TABLE `mendix`.`myfirstmodule$basenode`
ADD INDEX `idx_name` (`name` ASC, `id` ASC) VISIBLE;
;
- 优化后