fix(接口定义): 从回收站恢复接口用例增加重名校验

This commit is contained in:
wxg0103 2022-07-28 16:18:50 +08:00 committed by f2c-ci-robot[bot]
parent e492d69947
commit e6a10f4d98
2 changed files with 32 additions and 9 deletions

View File

@ -384,7 +384,7 @@ public class ApiTestCaseService {
public void checkNameExist(SaveApiTestCaseRequest request) { public void checkNameExist(SaveApiTestCaseRequest request) {
if (hasSameCase(request)) { if (hasSameCase(request)) {
MSException.throwException(Translator.get("load_test_already_exists")); MSException.throwException(Translator.get("load_test_already_exists") + ": " + request.getName());
} }
} }
@ -1020,7 +1020,19 @@ public class ApiTestCaseService {
if (request.isSelectAll()) { if (request.isSelectAll()) {
ids = this.getAllApiCaseIdsByFontedSelect(request.getFilters(), request.getModuleIds(), request.getName(), request.getProjectId(), request.getProtocol(), request.getUnSelectIds(), request.getStatus(), null, request.getCombine()); ids = this.getAllApiCaseIdsByFontedSelect(request.getFilters(), request.getModuleIds(), request.getName(), request.getProjectId(), request.getProtocol(), request.getUnSelectIds(), request.getStatus(), null, request.getCombine());
} }
ApiTestCaseExample apiTestCaseExample = new ApiTestCaseExample();
apiTestCaseExample.createCriteria().andIdIn(ids);
List<ApiTestCase> apiCaseList = apiTestCaseMapper.selectByExample(apiTestCaseExample);
SaveApiTestCaseRequest saveApiTestCaseRequest = new SaveApiTestCaseRequest();
if (CollectionUtils.isNotEmpty(apiCaseList)) {
for (ApiTestCase apiTestCaseDTO : apiCaseList) {
saveApiTestCaseRequest.setName(apiTestCaseDTO.getName());
saveApiTestCaseRequest.setApiDefinitionId(apiTestCaseDTO.getApiDefinitionId());
saveApiTestCaseRequest.setId(apiTestCaseDTO.getId());
saveApiTestCaseRequest.setVersionId(apiTestCaseDTO.getVersionId());
checkNameExist(saveApiTestCaseRequest);
}
}
List<String> cannotReductionAPiName = new ArrayList<>(); List<String> cannotReductionAPiName = new ArrayList<>();
if (CollectionUtils.isNotEmpty(ids)) { if (CollectionUtils.isNotEmpty(ids)) {
List<ApiTestCaseDTO> cannotReductionApiCaseList = extApiTestCaseMapper.getCannotReductionApiCaseList(ids); List<ApiTestCaseDTO> cannotReductionApiCaseList = extApiTestCaseMapper.getCannotReductionApiCaseList(ids);

View File

@ -92,7 +92,7 @@
</template> </template>
</ms-table-column> </ms-table-column>
<ms-table-column <ms-table-column v-if="!trashEnable"
prop="caseStatus" prop="caseStatus"
:filters="STATUS_FILTERS" :filters="STATUS_FILTERS"
:field="item" :field="item"
@ -104,6 +104,17 @@
</template> </template>
</ms-table-column> </ms-table-column>
<ms-table-column v-if="trashEnable"
prop="caseStatus"
:field="item"
:fields-width="fieldsWidth"
min-width="120px"
:label="$t('commons.status')">
<template v-slot:default="scope">
<plan-status-table-item :value="scope.row.status"/>
</template>
</ms-table-column>
<ms-table-column <ms-table-column
prop="execResult" prop="execResult"
:filters="statusFilters" :filters="statusFilters"