From 7d1296b6d046484fac186a600e092e9ad5cfe4ae Mon Sep 17 00:00:00 2001 From: chenjianxing Date: Wed, 16 Dec 2020 17:01:31 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E9=87=8D=E6=9E=84apicaselist?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/controller/ApiTestCaseController.java | 12 + .../dto/definition/ApiTestCaseRequest.java | 1 + .../api/service/ApiTestCaseService.java | 7 + .../base/mapper/ext/ExtApiTestCaseMapper.java | 2 + .../base/mapper/ext/ExtApiTestCaseMapper.xml | 15 + .../api/definition/ApiDefinition.vue | 21 +- .../api/definition/components/ApiCaseList.vue | 443 ------------------ .../components/case/ApiCaseItem.vue | 292 ++++++++++++ .../components/case/ApiCaseList.vue | 232 +++++++++ .../components/list/ApiCaseSimpleList.vue | 378 +++++++++++++++ .../components/{ => list}/ApiList.vue | 32 +- .../components/list/ApiListContainer.vue | 41 ++ .../components/runtest/RunTestDubboPage.vue | 2 +- .../components/runtest/RunTestHTTPPage.vue | 2 +- .../components/runtest/RunTestSQLPage.vue | 2 +- .../components/runtest/RunTestTCPPage.vue | 2 +- 16 files changed, 1015 insertions(+), 469 deletions(-) delete mode 100644 frontend/src/business/components/api/definition/components/ApiCaseList.vue create mode 100644 frontend/src/business/components/api/definition/components/case/ApiCaseItem.vue create mode 100644 frontend/src/business/components/api/definition/components/case/ApiCaseList.vue create mode 100644 frontend/src/business/components/api/definition/components/list/ApiCaseSimpleList.vue rename frontend/src/business/components/api/definition/components/{ => list}/ApiList.vue (92%) create mode 100644 frontend/src/business/components/api/definition/components/list/ApiListContainer.vue diff --git a/backend/src/main/java/io/metersphere/api/controller/ApiTestCaseController.java b/backend/src/main/java/io/metersphere/api/controller/ApiTestCaseController.java index a31ccdeab0..7526d962ff 100644 --- a/backend/src/main/java/io/metersphere/api/controller/ApiTestCaseController.java +++ b/backend/src/main/java/io/metersphere/api/controller/ApiTestCaseController.java @@ -1,11 +1,16 @@ package io.metersphere.api.controller; +import com.github.pagehelper.Page; +import com.github.pagehelper.PageHelper; import io.metersphere.api.dto.definition.ApiTestCaseRequest; import io.metersphere.api.dto.definition.ApiTestCaseResult; import io.metersphere.api.dto.definition.SaveApiTestCaseRequest; import io.metersphere.api.service.ApiTestCaseService; +import io.metersphere.base.domain.ApiTestCase; import io.metersphere.base.domain.ApiTestCaseWithBLOBs; import io.metersphere.commons.constants.RoleConstants; +import io.metersphere.commons.utils.PageUtils; +import io.metersphere.commons.utils.Pager; import io.metersphere.commons.utils.SessionUtils; import org.apache.shiro.authz.annotation.Logical; import org.apache.shiro.authz.annotation.RequiresRoles; @@ -29,6 +34,13 @@ public class ApiTestCaseController { return apiTestCaseService.list(request); } + @PostMapping("/list/{goPage}/{pageSize}") + public Pager> listSimple(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody ApiTestCaseRequest request) { + Page page = PageHelper.startPage(goPage, pageSize, true); + request.setWorkspaceId(SessionUtils.getCurrentWorkspaceId()); + return PageUtils.setPageInfo(page, apiTestCaseService.listSimple(request)); + } + @PostMapping(value = "/create", consumes = {"multipart/form-data"}) public void create(@RequestPart("request") SaveApiTestCaseRequest request, @RequestPart(value = "files") List bodyFiles) { apiTestCaseService.create(request, bodyFiles); diff --git a/backend/src/main/java/io/metersphere/api/dto/definition/ApiTestCaseRequest.java b/backend/src/main/java/io/metersphere/api/dto/definition/ApiTestCaseRequest.java index 3dfb1b9daa..a5deab6105 100644 --- a/backend/src/main/java/io/metersphere/api/dto/definition/ApiTestCaseRequest.java +++ b/backend/src/main/java/io/metersphere/api/dto/definition/ApiTestCaseRequest.java @@ -17,5 +17,6 @@ public class ApiTestCaseRequest { private String environmentId; private String workspaceId; private String apiDefinitionId; + private List moduleIds; private List orders; } 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 fbad044c3b..81e168e44d 100644 --- a/backend/src/main/java/io/metersphere/api/service/ApiTestCaseService.java +++ b/backend/src/main/java/io/metersphere/api/service/ApiTestCaseService.java @@ -1,6 +1,7 @@ package io.metersphere.api.service; import com.alibaba.fastjson.JSONObject; +import io.metersphere.api.dto.definition.ApiDefinitionRequest; import io.metersphere.api.dto.definition.ApiTestCaseRequest; import io.metersphere.api.dto.definition.ApiTestCaseResult; import io.metersphere.api.dto.definition.SaveApiTestCaseRequest; @@ -52,6 +53,12 @@ public class ApiTestCaseService { return extApiTestCaseMapper.list(request); } + public List listSimple(ApiTestCaseRequest request) { + request.setOrders(ServiceUtils.getDefaultOrder(request.getOrders())); + List apiTestCases = extApiTestCaseMapper.listSimple(request); + return apiTestCases; + } + public ApiTestCaseWithBLOBs get(String id) { return apiTestCaseMapper.selectByPrimaryKey(id); } 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 83e229ac0b..3252a00ebf 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 @@ -2,6 +2,7 @@ package io.metersphere.base.mapper.ext; import io.metersphere.api.dto.definition.ApiTestCaseRequest; import io.metersphere.api.dto.definition.ApiTestCaseResult; +import io.metersphere.base.domain.ApiTestCase; import org.apache.ibatis.annotations.Param; import java.util.List; @@ -9,4 +10,5 @@ import java.util.List; public interface ExtApiTestCaseMapper { List list(@Param("request") ApiTestCaseRequest request); + List listSimple(@Param("request") ApiTestCaseRequest request); } \ No newline at end of file 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 88c90a3119..cf45823784 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 @@ -178,4 +178,19 @@ + \ No newline at end of file diff --git a/frontend/src/business/components/api/definition/ApiDefinition.vue b/frontend/src/business/components/api/definition/ApiDefinition.vue index a7765697b5..24e19157b0 100644 --- a/frontend/src/business/components/api/definition/ApiDefinition.vue +++ b/frontend/src/business/components/api/definition/ApiDefinition.vue @@ -45,6 +45,16 @@ @handleCase="handleCase" @showExecResult="showExecResult" ref="apiList"/> + + + + + + + + + +
@@ -74,7 +84,7 @@ - - diff --git a/frontend/src/business/components/api/definition/components/case/ApiCaseItem.vue b/frontend/src/business/components/api/definition/components/case/ApiCaseItem.vue new file mode 100644 index 0000000000..0ca889dffa --- /dev/null +++ b/frontend/src/business/components/api/definition/components/case/ApiCaseItem.vue @@ -0,0 +1,292 @@ + + + + + diff --git a/frontend/src/business/components/api/definition/components/case/ApiCaseList.vue b/frontend/src/business/components/api/definition/components/case/ApiCaseList.vue new file mode 100644 index 0000000000..bacbd09dee --- /dev/null +++ b/frontend/src/business/components/api/definition/components/case/ApiCaseList.vue @@ -0,0 +1,232 @@ + + + + diff --git a/frontend/src/business/components/api/definition/components/list/ApiCaseSimpleList.vue b/frontend/src/business/components/api/definition/components/list/ApiCaseSimpleList.vue new file mode 100644 index 0000000000..31f57272c0 --- /dev/null +++ b/frontend/src/business/components/api/definition/components/list/ApiCaseSimpleList.vue @@ -0,0 +1,378 @@ + + + + + diff --git a/frontend/src/business/components/api/definition/components/ApiList.vue b/frontend/src/business/components/api/definition/components/list/ApiList.vue similarity index 92% rename from frontend/src/business/components/api/definition/components/ApiList.vue rename to frontend/src/business/components/api/definition/components/list/ApiList.vue index 2de37eacab..238486294b 100644 --- a/frontend/src/business/components/api/definition/components/ApiList.vue +++ b/frontend/src/business/components/api/definition/components/list/ApiList.vue @@ -1,6 +1,6 @@