fix(接口案例): #1005994【接口定义】用例列表,筛选未执行的结果失败、#1006017【接口定义】删除用例,用例列表没更新

【【接口定义】用例列表,筛选未执行的结果失败】https://www.tapd.cn/55049933/bugtrace/bugs/view?bug_id=1155049933001005994;【【接口定义】删除用例,用例列表没更新】https://www.tapd.cn/55049933/bugtrace/bugs/view?bug_id=1155049933001006017
This commit is contained in:
song-tianyang 2021-08-23 15:09:35 +08:00 committed by 刘瑞斌
parent a883cd4f37
commit d499f3e287
5 changed files with 32 additions and 13 deletions

View File

@ -323,6 +323,7 @@ public class ApiTestCaseService {
final ApiTestCaseWithBLOBs test = new ApiTestCaseWithBLOBs();
test.setId(request.getId());
test.setName(request.getName());
test.setStatus("");
test.setApiDefinitionId(request.getApiDefinitionId());
test.setCreateUserId(Objects.requireNonNull(SessionUtils.getUser()).getId());
test.setUpdateUserId(Objects.requireNonNull(SessionUtils.getUser()).getId());
@ -883,7 +884,6 @@ public class ApiTestCaseService {
cannotReductionApiCaseList.stream().map(ApiTestCaseDTO::getId).collect(Collectors.toList());
List<String> deleteIds = ids.stream().filter(id -> !cannotReductionCaseId.contains(id)).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(deleteIds)) {
extApiTestCaseMapper.checkOriginalStatusByIds(deleteIds);
extApiTestCaseMapper.reduction(deleteIds);
}
}

View File

@ -43,7 +43,6 @@ public interface ExtApiTestCaseMapper {
int deleteToGc(ApiTestCaseRequest request);
int reduction(@Param("ids") List<String> ids);
void checkOriginalStatusByIds(@Param("ids") List<String> ids);
List<ApiTestCaseDTO> getCannotReductionApiCaseList(@Param("ids") List<String> ids);

View File

@ -532,6 +532,32 @@
<if test="request.apiDefinitionId != null and request.apiDefinitionId!=''">
AND t1.api_definition_id = #{request.apiDefinitionId}
</if>
<if test="request.filters != null and request.filters.size() > 0">
<foreach collection="request.filters.entrySet()" index="key" item="values">
<if test="values != null and values.size() > 0">
<choose>
<when test="key == 'priority'">
and t1.priority in
<foreach collection="values" item="value" separator="," open="(" close=")">
#{value}
</foreach>
</when>
<when test="key=='status'">
and t1.status in
<foreach collection="values" item="value" separator="," open="(" close=")">
#{value}
</foreach>
</when>
</choose>
</if>
<if test="key=='status' and values.size == 0">
and (t1.status is null or t1.status != 'Trash')
</if>
</foreach>
</if>
<if test="request.filters == null || request.filters.size() == 0 ">
and (t1.status is null or t1.status != 'Trash')
</if>
<if test="request.moduleIds != null and request.moduleIds.size() > 0">
and a.module_id in
<foreach collection="request.moduleIds" item="nodeId" separator="," open="(" close=")">
@ -574,13 +600,4 @@
#{v}
</foreach>
</update>
<update id="checkOriginalStatusByIds">
update api_test_case
set
original_status = 'Underway'
where (original_status IS NULL OR original_status = 'Trash') AND id in
<foreach collection="ids" item="v" separator="," open="(" close=")">
#{v}
</foreach>
</update>
</mapper>

View File

@ -99,3 +99,6 @@ ALTER TABLE test_plan ADD report_config text CHARACTER SET utf8mb4 COLLATE utf8m
-- 删除不用的记录表
DROP TABLE test_plan_report_resource;
-- 统一接口案例未执行的状态字段
update api_test_case SET `status` = '' WHERE `status` = 'Underway';
update api_test_case SET `original_status` = '' WHERE `original_status` = 'Underway';

View File

@ -285,7 +285,7 @@ export default {
confirmButtonText: this.$t('commons.confirm'),
callback: (action) => {
if (action === 'confirm') {
this.$get('/api/testcase/delete/' + row.id, () => {
this.$get('/api/testcase/deleteToGc/' + row.id, () => {
this.$success(this.$t('commons.delete_success'));
this.$emit('refresh');
});