fix(接口定义): #1006188 【接口定义】case列表删除用例,api列表用例数没减少
【【接口定义】case列表删除用例,api列表用例数没减少】https://www.tapd.cn/55049933/bugtrace/bugs/view?bug_id=1155049933001006188
This commit is contained in:
parent
76461e0902
commit
0ba827a278
|
@ -1034,7 +1034,7 @@ public class ApiDefinitionService {
|
|||
public void calculateResult(List<ApiDefinitionResult> resList, String projectId) {
|
||||
if (!resList.isEmpty()) {
|
||||
List<String> ids = resList.stream().map(ApiDefinitionResult::getId).collect(Collectors.toList());
|
||||
List<ApiComputeResult> results = extApiDefinitionMapper.selectByIds(ids, projectId);
|
||||
List<ApiComputeResult> results = extApiDefinitionMapper.selectByIdsAndStatusIsNotTrash(ids, projectId);
|
||||
Map<String, ApiComputeResult> resultMap = results.stream().collect(Collectors.toMap(ApiComputeResult::getApiDefinitionId, Function.identity()));
|
||||
for (ApiDefinitionResult res : resList) {
|
||||
ApiComputeResult compRes = resultMap.get(res.getId());
|
||||
|
|
|
@ -25,6 +25,8 @@ public interface ExtApiDefinitionMapper {
|
|||
|
||||
List<ApiComputeResult> selectByIds(@Param("ids") List<String> ids, @Param("projectId") String projectId);
|
||||
|
||||
List<ApiComputeResult> selectByIdsAndStatusIsNotTrash(@Param("ids") List<String> ids, @Param("projectId") String projectId);
|
||||
|
||||
// int removeToGc(@Param("ids") List<String> ids);
|
||||
|
||||
int removeToGcByExample(ApiDefinitionExampleWithOperation example);
|
||||
|
|
|
@ -100,6 +100,19 @@
|
|||
</foreach>
|
||||
</select>
|
||||
|
||||
<select id="selectByIdsAndStatusIsNotTrash" resultType="io.metersphere.api.dto.definition.ApiComputeResult">
|
||||
SELECT t1.api_definition_id apiDefinitionId,count(t1.id) caseTotal,
|
||||
SUM(case when t2.status ='success' then 1 else 0 end) as success ,SUM(case when t2.status ='error' then 1 else 0 end) as error,
|
||||
CONCAT(FORMAT(SUM(IF (t2.`status`='success',1,0))/COUNT(t1.id)*100,2),'%') passRate
|
||||
FROM api_test_case t1
|
||||
LEFT JOIN api_definition_exec_result t2 ON t1.last_result_id=t2.id
|
||||
WHERE t1.project_id = #{projectId} and (t1.status is null or t1.status != 'Trash')
|
||||
group by t1.api_definition_id having t1.api_definition_id in
|
||||
<foreach collection="ids" item="v" separator="," open="(" close=")">
|
||||
#{v}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
<sql id="combine">
|
||||
<if test='${condition}.name != null and (${name} == null or ${name} == "")'>
|
||||
and api_definition.name
|
||||
|
|
Loading…
Reference in New Issue