diff --git a/api-test/backend/src/main/java/io/metersphere/api/parse/api/Swagger2Parser.java b/api-test/backend/src/main/java/io/metersphere/api/parse/api/Swagger2Parser.java index d636ecc251..664e1ca2cb 100644 --- a/api-test/backend/src/main/java/io/metersphere/api/parse/api/Swagger2Parser.java +++ b/api-test/backend/src/main/java/io/metersphere/api/parse/api/Swagger2Parser.java @@ -133,6 +133,7 @@ public class Swagger2Parser extends SwaggerAbstractParser { MsHTTPSamplerProxy request = buildRequest(operation, pathName, method.name()); request.setFollowRedirects(true); ApiDefinitionWithBLOBs apiDefinition = buildApiDefinition(request.getId(), operation, pathName, method.name(), importRequest); + apiDefinition.setDescription(operation.getDescription()); parseParameters(operation, request); addBodyHeader(request); if (StringUtils.isNotBlank(basePath)) { diff --git a/api-test/backend/src/main/java/io/metersphere/controller/definition/ApiTestCaseController.java b/api-test/backend/src/main/java/io/metersphere/controller/definition/ApiTestCaseController.java index 6308a1d777..474603c732 100644 --- a/api-test/backend/src/main/java/io/metersphere/controller/definition/ApiTestCaseController.java +++ b/api-test/backend/src/main/java/io/metersphere/controller/definition/ApiTestCaseController.java @@ -69,7 +69,6 @@ public class ApiTestCaseController { @PostMapping("/list/{goPage}/{pageSize}") public Pager> listSimple(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody ApiTestCaseRequest request) { - apiTestCaseService.initRequestBySearch(request); Page page = PageHelper.startPage(goPage, pageSize, true); request.setSelectEnvironment(true); return PageUtils.setPageInfo(page, apiTestCaseService.listSimple(request)); diff --git a/api-test/backend/src/main/java/io/metersphere/service/definition/ApiTestCaseService.java b/api-test/backend/src/main/java/io/metersphere/service/definition/ApiTestCaseService.java index 0086cb800b..7320b88170 100644 --- a/api-test/backend/src/main/java/io/metersphere/service/definition/ApiTestCaseService.java +++ b/api-test/backend/src/main/java/io/metersphere/service/definition/ApiTestCaseService.java @@ -141,17 +141,21 @@ public class ApiTestCaseService { } public List listSimple(ApiTestCaseRequest request) { + //工作台逻辑 + initRequestBySearch(request); request = this.initRequest(request, true, true); List apiTestCases = extApiTestCaseMapper.listSimple(request); if (CollectionUtils.isEmpty(apiTestCases)) { return apiTestCases; } - buildUserInfo(apiTestCases, request.isSelectEnvironment()); return apiTestCases; } public Long getToBeUpdatedTime(String projectId) { + if (StringUtils.isBlank(projectId)) { + return getTimeMills(System.currentTimeMillis(), DEFAULT_TIME_DATE); + } ProjectApplicationExample example = new ProjectApplicationExample(); example.createCriteria().andTypeEqualTo(ProjectApplicationType.OPEN_UPDATE_TIME.name()).andProjectIdEqualTo(projectId); List projectApplications = projectApplicationMapper.selectByExample(example); @@ -1113,20 +1117,17 @@ public class ApiTestCaseService { if (!request.isToBeUpdated()) { return; } - if (StringUtils.isBlank(request.getProjectId())) { - long toBeUpdatedTime = getTimeMills(System.currentTimeMillis(), DEFAULT_TIME_DATE); - request.setToBeUpdateTime(toBeUpdatedTime); - request.setUpdateTime(toBeUpdatedTime); - List syncRuleCaseStatus = new ArrayList<>(); - syncRuleCaseStatus.add(ApiReportStatus.ERROR.name()); - request.setStatusList(syncRuleCaseStatus); - return; - } Long toBeUpdatedTime = this.getToBeUpdatedTime(request.getProjectId()); if (toBeUpdatedTime != null) { request.setToBeUpdateTime(toBeUpdatedTime); request.setUpdateTime(toBeUpdatedTime); } + if (StringUtils.isBlank(request.getProjectId())) { + List syncRuleCaseStatus = new ArrayList<>(); + syncRuleCaseStatus.add(ApiReportStatus.ERROR.name()); + request.setStatusList(syncRuleCaseStatus); + return; + } if (request.isNoSearchStatus()) { request.setStatusList(new ArrayList<>()); } else {