From 8feab21acdfa24bd11b104f60f156f451963bda8 Mon Sep 17 00:00:00 2001 From: wxg0103 <727495428@qq.com> Date: Tue, 31 May 2022 18:31:05 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=8E=A5=E5=8F=A3=E6=B5=8B=E8=AF=95):=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8Dcase=E5=88=97=E8=A1=A8=E9=87=8D=E5=A4=8D?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E7=9A=84=E7=BC=BA=E9=99=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1013292 --user=王孝刚 【接口测试】接口CASE列重复显示CASE https://www.tapd.cn/55049933/s/1170470 --- .../api/service/ApiTestCaseService.java | 11 +-------- .../base/mapper/ext/ExtApiTestCaseMapper.java | 2 ++ .../base/mapper/ext/ExtApiTestCaseMapper.xml | 23 ++++++++++++++++++- 3 files changed, 25 insertions(+), 11 deletions(-) diff --git a/backend/src/main/java/io/metersphere/api/service/ApiTestCaseService.java b/backend/src/main/java/io/metersphere/api/service/ApiTestCaseService.java index fb35c047b7..b86c2365a0 100644 --- a/backend/src/main/java/io/metersphere/api/service/ApiTestCaseService.java +++ b/backend/src/main/java/io/metersphere/api/service/ApiTestCaseService.java @@ -350,16 +350,7 @@ public class ApiTestCaseService { } public ApiTestCase getSameCase(SaveApiTestCaseRequest request) { - ApiTestCaseExample example = new ApiTestCaseExample(); - ApiTestCaseExample.Criteria criteria = example.createCriteria(); - criteria.andStatusNotEqualTo("Trash").andNameEqualTo(request.getName()).andApiDefinitionIdEqualTo(request.getApiDefinitionId()); - if (StringUtils.isNotBlank(request.getId())) { - criteria.andIdNotEqualTo(request.getId()); - } - if (StringUtils.isNotBlank(request.getVersionId())) { - criteria.andVersionIdEqualTo(request.getVersionId()); - } - List apiTestCases = apiTestCaseMapper.selectByExample(example); + List apiTestCases = extApiTestCaseMapper.checkName(request); if (CollectionUtils.isNotEmpty(apiTestCases)) { return apiTestCases.get(0); } diff --git a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiTestCaseMapper.java b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiTestCaseMapper.java index b38b0ab345..001858a2bd 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiTestCaseMapper.java +++ b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiTestCaseMapper.java @@ -74,4 +74,6 @@ public interface ExtApiTestCaseMapper { List getApiCaseEnvironments(@Param("caseIds") List caseIds); void insertNewVersionCases(@Param("api") ApiDefinition apiDefinition, @Param("old") ApiDefinition old); + + List checkName(@Param("request") SaveApiTestCaseRequest request); } diff --git a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiTestCaseMapper.xml b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiTestCaseMapper.xml index a535c17cfc..856640dc2c 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiTestCaseMapper.xml +++ b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiTestCaseMapper.xml @@ -780,7 +780,28 @@ + update api_test_case