From 4df45d190cc15eaad7ca341e605ccccecc78910d Mon Sep 17 00:00:00 2001 From: chenjianxing Date: Sat, 9 May 2020 17:55:13 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B5=8B=E8=AF=95=E7=94=A8=E4=BE=8B=E7=AD=9B?= =?UTF-8?q?=E9=80=89=E6=8E=92=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../base/mapper/ext/ExtTestCaseMapper.java | 3 ++ .../base/mapper/ext/ExtTestCaseMapper.xml | 34 +++++++++++++ .../controller/TestCaseController.java | 4 +- .../controller/request/OrderRequest.java | 9 ++++ .../testcase/QueryTestCaseRequest.java | 7 +++ .../QueryTestPlanCaseRequest.java | 4 +- .../java/io/metersphere/dto/TestCaseDTO.java | 18 +++++++ .../io/metersphere/dto/TestPlanCaseDTO.java | 26 +--------- .../metersphere/service/TestCaseService.java | 16 ++---- .../src/main/resources/application.properties | 1 + .../track/case/components/TestCaseEdit.vue | 4 +- .../track/case/components/TestCaseList.vue | 49 ++++++++++++++++--- frontend/src/common/js/utils.js | 5 ++ 13 files changed, 132 insertions(+), 48 deletions(-) create mode 100644 backend/src/main/java/io/metersphere/controller/request/OrderRequest.java create mode 100644 backend/src/main/java/io/metersphere/dto/TestCaseDTO.java diff --git a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestCaseMapper.java b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestCaseMapper.java index 804119e525..9c15ab07aa 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestCaseMapper.java +++ b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestCaseMapper.java @@ -5,6 +5,7 @@ import io.metersphere.controller.request.ReportRequest; import io.metersphere.controller.request.testcase.QueryTestCaseRequest; import io.metersphere.controller.request.testplancase.QueryTestPlanCaseRequest; import io.metersphere.dto.ReportDTO; +import io.metersphere.dto.TestCaseDTO; import io.metersphere.dto.TestPlanCaseDTO; import org.apache.ibatis.annotations.Param; @@ -15,4 +16,6 @@ public interface ExtTestCaseMapper { List getTestCaseNames(@Param("request") QueryTestCaseRequest request); List getTestPlanTestCases(@Param("request") QueryTestPlanCaseRequest request); + + List list(@Param("request") QueryTestCaseRequest request); } diff --git a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestCaseMapper.xml b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestCaseMapper.xml index f1af223d20..38d88c3676 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestCaseMapper.xml +++ b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestCaseMapper.xml @@ -41,4 +41,38 @@ and t1.executor = #{request.executor} + + + \ No newline at end of file diff --git a/backend/src/main/java/io/metersphere/controller/TestCaseController.java b/backend/src/main/java/io/metersphere/controller/TestCaseController.java index 264a8756c7..4a6630adb7 100644 --- a/backend/src/main/java/io/metersphere/controller/TestCaseController.java +++ b/backend/src/main/java/io/metersphere/controller/TestCaseController.java @@ -8,6 +8,7 @@ import io.metersphere.commons.utils.Pager; import io.metersphere.controller.request.testcase.QueryTestCaseRequest; import io.metersphere.controller.request.testcase.TestCaseBatchRequest; import io.metersphere.controller.request.testcase.TestPlanCaseBatchRequest; +import io.metersphere.dto.TestCaseDTO; import io.metersphere.excel.domain.ExcelResponse; import io.metersphere.service.TestCaseService; import io.metersphere.user.SessionUtils; @@ -16,6 +17,7 @@ import org.springframework.web.multipart.MultipartFile; import javax.annotation.Resource; import javax.servlet.http.HttpServletResponse; +import java.util.HashMap; import java.util.List; @RequestMapping("/test/case") @@ -26,7 +28,7 @@ public class TestCaseController { TestCaseService testCaseService; @PostMapping("/list/{goPage}/{pageSize}") - public Pager> list(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody QueryTestCaseRequest request) { + public Pager> list(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody QueryTestCaseRequest request) { Page page = PageHelper.startPage(goPage, pageSize, true); return PageUtils.setPageInfo(page, testCaseService.listTestCase(request)); } diff --git a/backend/src/main/java/io/metersphere/controller/request/OrderRequest.java b/backend/src/main/java/io/metersphere/controller/request/OrderRequest.java new file mode 100644 index 0000000000..3a35eab451 --- /dev/null +++ b/backend/src/main/java/io/metersphere/controller/request/OrderRequest.java @@ -0,0 +1,9 @@ +package io.metersphere.controller.request; + +import lombok.Data; + +@Data +public class OrderRequest { + private String name; + private String value; +} diff --git a/backend/src/main/java/io/metersphere/controller/request/testcase/QueryTestCaseRequest.java b/backend/src/main/java/io/metersphere/controller/request/testcase/QueryTestCaseRequest.java index 27728ef715..daa1bc9149 100644 --- a/backend/src/main/java/io/metersphere/controller/request/testcase/QueryTestCaseRequest.java +++ b/backend/src/main/java/io/metersphere/controller/request/testcase/QueryTestCaseRequest.java @@ -1,15 +1,22 @@ package io.metersphere.controller.request.testcase; import io.metersphere.base.domain.TestCase; +import io.metersphere.controller.request.FilterRequest; +import io.metersphere.controller.request.OrderRequest; import lombok.Data; import java.util.List; +import java.util.Map; @Data public class QueryTestCaseRequest extends TestCase { private List nodeIds; + private List orders; + + private Map> filters; + private String planId; private String workspaceId; diff --git a/backend/src/main/java/io/metersphere/controller/request/testplancase/QueryTestPlanCaseRequest.java b/backend/src/main/java/io/metersphere/controller/request/testplancase/QueryTestPlanCaseRequest.java index a2273976fd..5f49ca9266 100644 --- a/backend/src/main/java/io/metersphere/controller/request/testplancase/QueryTestPlanCaseRequest.java +++ b/backend/src/main/java/io/metersphere/controller/request/testplancase/QueryTestPlanCaseRequest.java @@ -1,7 +1,7 @@ package io.metersphere.controller.request.testplancase; -import io.metersphere.base.domain.TestCase; import io.metersphere.base.domain.TestPlanTestCase; +import io.metersphere.controller.request.OrderRequest; import lombok.Data; import java.util.List; @@ -11,6 +11,8 @@ public class QueryTestPlanCaseRequest extends TestPlanTestCase { private List nodeIds; + private List orders; + private String workspaceId; private String name; diff --git a/backend/src/main/java/io/metersphere/dto/TestCaseDTO.java b/backend/src/main/java/io/metersphere/dto/TestCaseDTO.java new file mode 100644 index 0000000000..e2c8585dd0 --- /dev/null +++ b/backend/src/main/java/io/metersphere/dto/TestCaseDTO.java @@ -0,0 +1,18 @@ +package io.metersphere.dto; + +import io.metersphere.base.domain.TestCaseWithBLOBs; +import lombok.Data; + +@Data +public class TestCaseDTO extends TestCaseWithBLOBs{ + + private String maintainerName; + + public String getMaintainerName() { + return maintainerName; + } + + public void setMaintainerName(String maintainerName) { + this.maintainerName = maintainerName; + } +} diff --git a/backend/src/main/java/io/metersphere/dto/TestPlanCaseDTO.java b/backend/src/main/java/io/metersphere/dto/TestPlanCaseDTO.java index a877778bb5..067589985f 100644 --- a/backend/src/main/java/io/metersphere/dto/TestPlanCaseDTO.java +++ b/backend/src/main/java/io/metersphere/dto/TestPlanCaseDTO.java @@ -2,34 +2,12 @@ package io.metersphere.dto; import io.metersphere.base.domain.TestCase; import io.metersphere.base.domain.TestCaseWithBLOBs; +import lombok.Data; +@Data public class TestPlanCaseDTO extends TestCaseWithBLOBs { private String executor; private String status; private String results; - - public String getExecutor() { - return executor; - } - - public void setExecutor(String executor) { - this.executor = executor; - } - - public String getStatus() { - return status; - } - - public void setStatus(String status) { - this.status = status; - } - - public String getResults() { - return results; - } - - public void setResults(String results) { - this.results = results; - } } diff --git a/backend/src/main/java/io/metersphere/service/TestCaseService.java b/backend/src/main/java/io/metersphere/service/TestCaseService.java index 4ef7f24130..66719976e0 100644 --- a/backend/src/main/java/io/metersphere/service/TestCaseService.java +++ b/backend/src/main/java/io/metersphere/service/TestCaseService.java @@ -12,6 +12,7 @@ import io.metersphere.commons.utils.LogUtil; import io.metersphere.controller.request.testcase.QueryTestCaseRequest; import io.metersphere.controller.request.testcase.TestCaseBatchRequest; import io.metersphere.controller.request.testcase.TestPlanCaseBatchRequest; +import io.metersphere.dto.TestCaseDTO; import io.metersphere.excel.domain.ExcelErrData; import io.metersphere.excel.domain.ExcelResponse; import io.metersphere.excel.domain.TestCaseExcelData; @@ -101,19 +102,8 @@ public class TestCaseService { return testCaseMapper.deleteByPrimaryKey(testCaseId); } - public List listTestCase(QueryTestCaseRequest request) { - TestCaseExample testCaseExample = new TestCaseExample(); - TestCaseExample.Criteria criteria = testCaseExample.createCriteria(); - if ( StringUtils.isNotBlank(request.getName()) ) { - criteria.andNameLike("%" + request.getName() + "%"); - } - if ( StringUtils.isNotBlank(request.getProjectId()) ) { - criteria.andProjectIdEqualTo(request.getProjectId()); - } - if ( request.getNodeIds() != null && request.getNodeIds().size() > 0) { - criteria.andNodeIdIn(request.getNodeIds()); - } - return testCaseMapper.selectByExampleWithBLOBs(testCaseExample); + public List listTestCase(QueryTestCaseRequest request) { + return extTestCaseMapper.list(request); } /** diff --git a/backend/src/main/resources/application.properties b/backend/src/main/resources/application.properties index 2805932dce..00e4f89b70 100644 --- a/backend/src/main/resources/application.properties +++ b/backend/src/main/resources/application.properties @@ -21,6 +21,7 @@ mybatis.configuration.multiple-result-sets-enabled=true mybatis.configuration.use-column-label=true mybatis.configuration.auto-mapping-behavior=full mybatis.configuration.default-statement-timeout=25000 +mybatis.configuration.map-underscore-to-camel-case=true logging.file.path=/opt/metersphere/logs/${spring.application.name} diff --git a/frontend/src/business/components/track/case/components/TestCaseEdit.vue b/frontend/src/business/components/track/case/components/TestCaseEdit.vue index 725f145aa3..4e554b80f6 100644 --- a/frontend/src/business/components/track/case/components/TestCaseEdit.vue +++ b/frontend/src/business/components/track/case/components/TestCaseEdit.vue @@ -3,9 +3,9 @@
+ :visible.sync="dialogFormVisible" width="65%"> - + diff --git a/frontend/src/business/components/track/case/components/TestCaseList.vue b/frontend/src/business/components/track/case/components/TestCaseList.vue index d6675c76a5..ff92da6666 100644 --- a/frontend/src/business/components/track/case/components/TestCaseList.vue +++ b/frontend/src/business/components/track/case/components/TestCaseList.vue @@ -22,6 +22,8 @@