fix(接口测试): 修改接口测试首页的计数

This commit is contained in:
CaptainB 2022-01-26 11:22:13 +08:00 committed by 刘瑞斌
parent 1033486597
commit eb397506fd
2 changed files with 6 additions and 6 deletions

View File

@ -352,18 +352,18 @@
GROUP BY protocol GROUP BY protocol
</select> </select>
<select id="countStateByProjectID" resultType="io.metersphere.api.dto.datacount.ApiDataCountResult"> <select id="countStateByProjectID" resultType="io.metersphere.api.dto.datacount.ApiDataCountResult">
SELECT status AS groupField,count(id) AS countNumber FROM api_definition WHERE project_id = #{0} AND `status` != 'Trash' GROUP BY status SELECT status AS groupField,count(id) AS countNumber FROM api_definition WHERE project_id = #{0} AND `status` != 'Trash' AND latest = 1 GROUP BY status
</select> </select>
<select id="countByProjectIDAndCreateInThisWeek" resultType="java.lang.Long"> <select id="countByProjectIDAndCreateInThisWeek" resultType="java.lang.Long">
SELECT count(id) AS countNumber FROM api_definition SELECT count(id) AS countNumber FROM api_definition
WHERE project_id = #{projectId} WHERE project_id = #{projectId}
AND create_time BETWEEN #{firstDayTimestamp} AND #{lastDayTimestamp} AND `status` != 'Trash' AND create_time BETWEEN #{firstDayTimestamp} AND #{lastDayTimestamp} AND `status` != 'Trash' AND latest = 1
</select> </select>
<select id="countApiCoverageByProjectID" resultType="io.metersphere.api.dto.datacount.ApiDataCountResult"> <select id="countApiCoverageByProjectID" resultType="io.metersphere.api.dto.datacount.ApiDataCountResult">
SELECT count(api.id) AS countNumber, if(test_case_api.api_definition_id is null,"uncoverage","coverage") AS groupField FROM api_definition api left Join ( SELECT count(api.id) AS countNumber, if(test_case_api.api_definition_id is null,"uncoverage","coverage") AS groupField FROM api_definition api left Join (
SELECT DISTINCT api_definition_id FROM api_test_case WHERE status is null or status != 'Trash' SELECT DISTINCT api_definition_id FROM api_test_case WHERE status is null or status != 'Trash'
) test_case_api ON api.id = test_case_api.api_definition_id ) test_case_api ON api.id = test_case_api.api_definition_id
WHERE api.project_id = #{0} and api.`status` != 'Trash' WHERE api.project_id = #{0} and api.`status` != 'Trash' and api.latest = 1
GROUP BY groupField GROUP BY groupField
</select> </select>
<select id="getNextNum" resultType="io.metersphere.base.domain.ApiDefinition"> <select id="getNextNum" resultType="io.metersphere.base.domain.ApiDefinition">

View File

@ -426,13 +426,13 @@
</select> </select>
<select id="countByProjectIDAndCreatInThisWeek" resultType="java.lang.Long"> <select id="countByProjectIDAndCreatInThisWeek" resultType="java.lang.Long">
SELECT count(id) AS countNumber FROM api_scenario SELECT count(id) AS countNumber FROM api_scenario
WHERE project_id = #{projectId} AND status != 'Trash' WHERE project_id = #{projectId} AND status != 'Trash' and latest = 1
AND create_time BETWEEN #{firstDayTimestamp} AND #{lastDayTimestamp} AND create_time BETWEEN #{firstDayTimestamp} AND #{lastDayTimestamp}
</select> </select>
<select id="countRunResultByProjectID" resultType="io.metersphere.api.dto.datacount.ApiDataCountResult"> <select id="countRunResultByProjectID" resultType="io.metersphere.api.dto.datacount.ApiDataCountResult">
SELECT count(id) AS countNumber, if(last_result is null,"notRun",last_result) AS groupField FROM api_scenario SELECT count(id) AS countNumber, if(last_result is null,"notRun",last_result) AS groupField FROM api_scenario
WHERE project_id = #{0} AND status != 'Trash' WHERE project_id = #{0} AND status != 'Trash' and latest = 1
GROUP BY groupField GROUP BY groupField
</select> </select>
@ -504,7 +504,7 @@
<select id="countExecuteTimesByProjectID" resultType="java.lang.Long"> <select id="countExecuteTimesByProjectID" resultType="java.lang.Long">
SELECT SUM(execute_times) FROM api_scenario SELECT SUM(execute_times) FROM api_scenario
WHERE project_id = #{0} WHERE project_id = #{0} and latest = 1
</select> </select>
<select id="selectProjectIds" resultType="java.lang.String"> <select id="selectProjectIds" resultType="java.lang.String">
select DISTINCT project_id from api_scenario; select DISTINCT project_id from api_scenario;