fix(接口测试): 修复用例标签和场景标签中本周执行和总执行统计错误的问题

--bug=1015133 --user=宋天阳 【接口测试】首页-接口用例和场景用例数量统计-本周执行次数统计,删除测试报告后数量减少了
https://www.tapd.cn/55049933/s/1206613
This commit is contained in:
song-tianyang 2022-07-21 17:25:54 +08:00 committed by 建国
parent 146caffcf9
commit 2efc431fa1
2 changed files with 36 additions and 14 deletions

View File

@ -25,19 +25,35 @@
<select id="countByProjectIDAndCreateInThisWeek" resultType="java.lang.Long">
SELECT count(id) AS countNumber
FROM api_definition_exec_result
WHERE resource_id IN (SELECT testCase.id
FROM api_test_case testCase
WHERE testCase.project_id = #{projectId})
and start_time BETWEEN #{firstDayTimestamp} AND #{lastDayTimestamp}
FROM api_case_execution_info
WHERE source_id IN (
SELECT testCase.id
FROM api_test_case testCase
WHERE testCase.project_id = #{projectId}
UNION
SELECT id
FROM test_plan_api_case
WHERE api_case_id IN (SELECT testCase.id
FROM api_test_case testCase
WHERE testCase.project_id = #{projectId})
)
AND create_time BETWEEN #{firstDayTimestamp} AND #{lastDayTimestamp}
</select>
<select id="countByTestCaseIDInProject" resultType="java.lang.Long">
SELECT count(id) AS countNumber
FROM api_definition_exec_result
WHERE resource_id IN (SELECT testCase.id
FROM api_test_case testCase
WHERE testCase.project_id = #{projectId})
FROM api_case_execution_info
WHERE source_id IN (
SELECT testCase.id
FROM api_test_case testCase
WHERE testCase.project_id = #{projectId}
UNION
SELECT id
FROM test_plan_api_case
WHERE api_case_id IN (SELECT testCase.id
FROM api_test_case testCase
WHERE testCase.project_id = #{projectId})
)
</select>
<select id="selectDistinctStatusByReportId" resultType="java.lang.String">

View File

@ -350,9 +350,13 @@
</select>
<select id="countByProjectIdAndCreateInThisWeek" resultType="java.lang.Long">
SELECT count(id) AS countNumber
FROM api_scenario_report
WHERE project_id = #{projectId}
AND create_time BETWEEN #{firstDayTimestamp} AND #{lastDayTimestamp}
FROM scenario_execution_info
WHERE create_time BETWEEN #{firstDayTimestamp} AND #{lastDayTimestamp}
AND source_id in (
SELECT id
FROM api_scenario
WHERE project_id = #{projectId}
);
</select>
<select id="countByProjectIdAndCreateAndByScheduleInThisWeek" resultType="java.lang.Long">
@ -364,7 +368,6 @@
WHERE project_id = #{projectId}
AND latest = 1)
AND create_time BETWEEN #{firstDayTimestamp} AND #{lastDayTimestamp}
</select>
<select id="countByProjectIdGroupByExecuteResult" resultType="io.metersphere.api.dto.datacount.ApiDataCountResult">
@ -461,7 +464,10 @@
</foreach>
</select>
<select id="selectByProjectIdAndLessThanTime" resultType="java.lang.String">
select id from api_scenario_report where create_time &lt; #{time} and project_id = #{projectId}
select id
from api_scenario_report
where create_time &lt; #{time}
and project_id = #{projectId}
</select>
</mapper>