fix(接口测试): 修复接口测试首页数量不能对应的问题
This commit is contained in:
parent
3ec8b61e60
commit
17da33c464
|
@ -1780,7 +1780,7 @@ public class ApiDefinitionService {
|
||||||
return 0;
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
ApiDefinitionExample example = new ApiDefinitionExample();
|
ApiDefinitionExample example = new ApiDefinitionExample();
|
||||||
example.createCriteria().andProjectIdEqualTo(projectId).andStatusNotEqualTo("Trash");
|
example.createCriteria().andProjectIdEqualTo(projectId).andStatusNotEqualTo("Trash").andLatestEqualTo(true);
|
||||||
return apiDefinitionMapper.countByExample(example);
|
return apiDefinitionMapper.countByExample(example);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -344,7 +344,12 @@
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
<select id="countProtocolByProjectID" resultType="io.metersphere.api.dto.datacount.ApiDataCountResult">
|
<select id="countProtocolByProjectID" resultType="io.metersphere.api.dto.datacount.ApiDataCountResult">
|
||||||
SELECT protocol AS groupField,count(DISTINCT ref_id) AS countNumber FROM api_definition WHERE project_id = #{0} AND `status` != 'Trash' GROUP BY protocol
|
SELECT protocol AS groupField,count(DISTINCT ref_id) AS countNumber
|
||||||
|
FROM api_definition
|
||||||
|
WHERE project_id = #{0}
|
||||||
|
AND `status` != 'Trash'
|
||||||
|
AND latest = 1
|
||||||
|
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' GROUP BY status
|
||||||
|
@ -591,7 +596,7 @@
|
||||||
<select id="selectEffectiveIdByProjectId" resultType="io.metersphere.base.domain.ApiDefinition">
|
<select id="selectEffectiveIdByProjectId" resultType="io.metersphere.base.domain.ApiDefinition">
|
||||||
select id,path,method
|
select id,path,method
|
||||||
from api_definition
|
from api_definition
|
||||||
WHERE project_id = #{0} AND status != 'Trash' AND protocol = 'HTTP'
|
WHERE project_id = #{0} AND status != 'Trash' AND protocol = 'HTTP' AND latest = 1
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="moduleCount" resultType="java.lang.Integer">
|
<select id="moduleCount" resultType="java.lang.Integer">
|
||||||
|
@ -826,6 +831,7 @@
|
||||||
SELECT api_definition_id FROM api_test_case WHERE `status` is null or `status` != 'Trash'
|
SELECT api_definition_id FROM api_test_case WHERE `status` is null or `status` != 'Trash'
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
AND latest = 1
|
||||||
</select>
|
</select>
|
||||||
<select id="getForGraph" resultType="io.metersphere.dto.RelationshipGraphData$Node">
|
<select id="getForGraph" resultType="io.metersphere.dto.RelationshipGraphData$Node">
|
||||||
select id,num,`name`
|
select id,num,`name`
|
||||||
|
|
|
@ -416,13 +416,13 @@
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
<select id="countByProjectID" resultType="java.lang.Long">
|
<select id="countByProjectID" resultType="java.lang.Long">
|
||||||
SELECT COUNT(DISTINCT ref_id) AS countNumber FROM api_scenario WHERE project_id = #{0} AND status != 'Trash'
|
SELECT COUNT(DISTINCT ref_id) AS countNumber FROM api_scenario WHERE project_id = #{0} AND status != 'Trash' AND latest = 1
|
||||||
</select>
|
</select>
|
||||||
<select id="selectIdAndScenarioByProjectId" resultType="io.metersphere.base.domain.ApiScenarioWithBLOBs">
|
<select id="selectIdAndScenarioByProjectId" resultType="io.metersphere.base.domain.ApiScenarioWithBLOBs">
|
||||||
SELECT id,scenario_definition FROM api_scenario WHERE project_id = #{0} AND status != 'Trash'
|
SELECT id,scenario_definition FROM api_scenario WHERE project_id = #{0} AND status != 'Trash'
|
||||||
</select>
|
</select>
|
||||||
<select id="selectIdAndUseUrlByProjectId" resultType="io.metersphere.base.domain.ApiScenarioWithBLOBs">
|
<select id="selectIdAndUseUrlByProjectId" resultType="io.metersphere.base.domain.ApiScenarioWithBLOBs">
|
||||||
SELECT id,use_url FROM api_scenario WHERE project_id = #{0} AND status != 'Trash'
|
SELECT id,use_url FROM api_scenario WHERE project_id = #{0} AND status != 'Trash' AND latest = 1
|
||||||
</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
|
||||||
|
|
|
@ -230,7 +230,7 @@
|
||||||
SELECT count(ar.id) AS countNumber FROM
|
SELECT count(ar.id) AS countNumber FROM
|
||||||
api_scenario_report ar
|
api_scenario_report ar
|
||||||
INNER JOIN (
|
INNER JOIN (
|
||||||
SELECT acitem.`name`,acitem.id FROM api_scenario acitem INNER JOIN `schedule` sc ON acitem.id = sc.resource_id
|
SELECT acitem.`name`,acitem.id FROM api_scenario acitem INNER JOIN `schedule` sc ON acitem.id = sc.resource_id and latest = 1
|
||||||
) ac on ar.scenario_id = ac.id
|
) ac on ar.scenario_id = ac.id
|
||||||
WHERE ar.project_id = #{projectId} AND ar.trigger_mode = 'SCHEDULE' AND ar.create_time BETWEEN #{firstDayTimestamp} AND #{lastDayTimestamp}
|
WHERE ar.project_id = #{projectId} AND ar.trigger_mode = 'SCHEDULE' AND ar.create_time BETWEEN #{firstDayTimestamp} AND #{lastDayTimestamp}
|
||||||
</select>
|
</select>
|
||||||
|
@ -239,7 +239,7 @@
|
||||||
SELECT count(ar.id) AS countNumber,ar.status AS groupField FROM
|
SELECT count(ar.id) AS countNumber,ar.status AS groupField FROM
|
||||||
api_scenario_report ar
|
api_scenario_report ar
|
||||||
INNER JOIN (
|
INNER JOIN (
|
||||||
SELECT acitem.`name`,acitem.id FROM api_scenario acitem INNER JOIN `schedule` sc ON acitem.id = sc.resource_id
|
SELECT acitem.`name`,acitem.id FROM api_scenario acitem INNER JOIN `schedule` sc ON acitem.id = sc.resource_id and latest = 1
|
||||||
) ac on ar.scenario_id = ac.id
|
) ac on ar.scenario_id = ac.id
|
||||||
WHERE ar.project_id = #{projectId} AND ar.trigger_mode = 'SCHEDULE'
|
WHERE ar.project_id = #{projectId} AND ar.trigger_mode = 'SCHEDULE'
|
||||||
GROUP BY groupField;
|
GROUP BY groupField;
|
||||||
|
|
|
@ -542,7 +542,7 @@
|
||||||
<select id="countProtocolByProjectID" resultType="io.metersphere.api.dto.datacount.ApiDataCountResult">
|
<select id="countProtocolByProjectID" resultType="io.metersphere.api.dto.datacount.ApiDataCountResult">
|
||||||
SELECT apiDef.protocol AS groupField,COUNT(testCase.id) AS countNumber FROM api_test_case testCase
|
SELECT apiDef.protocol AS groupField,COUNT(testCase.id) AS countNumber FROM api_test_case testCase
|
||||||
INNER JOIN api_definition apiDef ON testCase.api_definition_id = apiDef.id
|
INNER JOIN api_definition apiDef ON testCase.api_definition_id = apiDef.id
|
||||||
WHERE testCase.project_id = #{0} AND (testCase.status IS NULL or testCase.status != "Trash")
|
WHERE testCase.project_id = #{0} AND (testCase.status IS NULL or testCase.status != "Trash") and latest = 1
|
||||||
GROUP BY apiDef.protocol
|
GROUP BY apiDef.protocol
|
||||||
</select>
|
</select>
|
||||||
<select id="findApiUrlAndMethodById" resultType="io.metersphere.base.domain.ApiDefinition">
|
<select id="findApiUrlAndMethodById" resultType="io.metersphere.base.domain.ApiDefinition">
|
||||||
|
@ -556,6 +556,7 @@
|
||||||
INNER JOIN api_definition apiDef ON testCase.api_definition_id = apiDef.id
|
INNER JOIN api_definition apiDef ON testCase.api_definition_id = apiDef.id
|
||||||
WHERE testCase.project_id = #{projectId}AND apiDef.status != "Trash"
|
WHERE testCase.project_id = #{projectId}AND apiDef.status != "Trash"
|
||||||
AND testCase.create_time BETWEEN #{firstDayTimestamp} AND #{lastDayTimestamp}
|
AND testCase.create_time BETWEEN #{firstDayTimestamp} AND #{lastDayTimestamp}
|
||||||
|
and latest = 1
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="moduleCount" resultType="java.lang.Integer">
|
<select id="moduleCount" resultType="java.lang.Integer">
|
||||||
|
|
|
@ -49,7 +49,7 @@
|
||||||
SELECT COUNT(id) AS countNumber
|
SELECT COUNT(id) AS countNumber
|
||||||
FROM `schedule`
|
FROM `schedule`
|
||||||
WHERE resource_id IN (
|
WHERE resource_id IN (
|
||||||
SELECT id FROM api_scenario WHERE project_id = #{0,jdbcType=VARCHAR} AND status != 'Trash'
|
SELECT id FROM api_scenario WHERE project_id = #{0,jdbcType=VARCHAR} AND status != 'Trash' AND latest = 1
|
||||||
)
|
)
|
||||||
</select>
|
</select>
|
||||||
<select id="countTaskByProjectIdAndCreateTimeRange" resultType="java.lang.Long">
|
<select id="countTaskByProjectIdAndCreateTimeRange" resultType="java.lang.Long">
|
||||||
|
@ -59,9 +59,9 @@
|
||||||
SELECT scene.id
|
SELECT scene.id
|
||||||
FROM api_scenario scene
|
FROM api_scenario scene
|
||||||
WHERE scene.project_id = #{projectId,jdbcType=VARCHAR}
|
WHERE scene.project_id = #{projectId,jdbcType=VARCHAR}
|
||||||
AND scene.status != 'Trash'
|
AND scene.status != 'Trash' AND latest = 1
|
||||||
)
|
)
|
||||||
AND create_time BETWEEN #{startTime} and #{endTime}
|
AND create_time BETWEEN #{startTime} AND #{endTime}
|
||||||
</select>
|
</select>
|
||||||
<select id="findRunningTaskInfoByProjectID" resultType="io.metersphere.api.dto.datacount.response.TaskInfoResult">
|
<select id="findRunningTaskInfoByProjectID" resultType="io.metersphere.api.dto.datacount.response.TaskInfoResult">
|
||||||
SELECT sch.id AS taskID,
|
SELECT sch.id AS taskID,
|
||||||
|
|
Loading…
Reference in New Issue