fix(测试计划): 测试计划列表展示用例统计 sql 优化

This commit is contained in:
ZJH 2021-11-26 14:35:45 +08:00 committed by jianxing
parent 0c963b141f
commit 1654660213
1 changed files with 5 additions and 5 deletions

View File

@ -116,22 +116,22 @@
select DISTINCT test_plan.*, project.name as projectName,schedule.id as scheduleId,
(select name from user where user.id = test_plan.creator) as createUser,
IF(schedule.enable = true,true,false) as scheduleOpen,
(select COUNT(t.id) from test_plan_test_case t
(select COUNT(*) from test_plan_test_case t
inner join test_case on t.case_id = test_case.id
left join test_case_node on test_case_node.id = test_case.node_id
inner join project on project.id = test_case.project_id
where t.plan_id = test_plan.id) as testPlanTestCaseCount,
where test_case.status != 'Trash' and t.plan_id = test_plan.id) as testPlanTestCaseCount,
(select COUNT(t.id) from test_plan_api_case t
(select COUNT(*) from test_plan_api_case t
inner join api_test_case c on t.api_case_id = c.id
inner join api_definition a on c.api_definition_id = a.id
where t.test_plan_id = test_plan.id) as testPlanApiCaseCount,
(select COUNT(t.id) from test_plan_api_scenario t
(select COUNT(*) from test_plan_api_scenario t
inner join api_scenario c on t.api_scenario_id = c.id and c.status != 'Trash'
where t.test_plan_id = test_plan.id) as testPlanApiScenarioCount,
(select COUNT(t.id) from test_plan_load_case t
(select COUNT(*) from test_plan_load_case t
inner join load_test lt on t.load_case_id = lt.id
left join user u on lt.user_id = u.id
left join project p on lt.project_id = p.id