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..9635eb28ef 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; @@ -14,5 +15,5 @@ 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..bda99d648f 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 @@ -20,25 +20,37 @@ ORDER BY test_case.update_time DESC - + select test_case.* from test_case + + + and test_case.name like CONCAT('%', #{request.name},'%') + + + and test_case.node_id in + + #{nodeId} + + + + and test_case.project_id = #{request.projectId} + + + + + and test_case.${key} in + + #{value} + + + + + + + order by + + ${order.name} ${order.type} - and t1.case_id = t2.id - - and t2.name like CONCAT('%', #{request.name},'%') - - - and t1.executor = #{request.executor} - \ No newline at end of file diff --git a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestPlanTestCaseMapper.java b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestPlanTestCaseMapper.java index e6969e66eb..b66b8bde17 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestPlanTestCaseMapper.java +++ b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestPlanTestCaseMapper.java @@ -1,6 +1,8 @@ package io.metersphere.base.mapper.ext; +import io.metersphere.controller.request.testplancase.QueryTestPlanCaseRequest; import io.metersphere.dto.TestCaseReportStatusResultDTO; +import io.metersphere.dto.TestPlanCaseDTO; import org.apache.ibatis.annotations.Param; import java.util.List; @@ -10,4 +12,7 @@ public interface ExtTestPlanTestCaseMapper { List getReportMetric(@Param("planId") String planId); List getExecutors(@Param("planId") String planId); + + List list(@Param("request") QueryTestPlanCaseRequest request); + } diff --git a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestPlanTestCaseMapper.xml b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestPlanTestCaseMapper.xml index 037bac726f..b9132ef479 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestPlanTestCaseMapper.xml +++ b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestPlanTestCaseMapper.xml @@ -19,5 +19,41 @@ and plan_id = #{planId}; + + \ 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..c22fb75b79 --- /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 type; +} 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..12a9124cd3 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,21 @@ package io.metersphere.controller.request.testcase; import io.metersphere.base.domain.TestCase; +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..8be81d9827 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,16 +1,21 @@ 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; +import java.util.Map; @Data public class QueryTestPlanCaseRequest extends TestPlanTestCase { private List nodeIds; + private List orders; + + private Map> filters; + 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/TestCaseReportService.java b/backend/src/main/java/io/metersphere/service/TestCaseReportService.java index 51e5865a79..4699151c33 100644 --- a/backend/src/main/java/io/metersphere/service/TestCaseReportService.java +++ b/backend/src/main/java/io/metersphere/service/TestCaseReportService.java @@ -112,7 +112,7 @@ public class TestCaseReportService { QueryTestPlanCaseRequest request = new QueryTestPlanCaseRequest(); request.setPlanId(planId); - List testPlanTestCases = extTestCaseMapper.getTestPlanTestCases(request); + List testPlanTestCases = extTestPlanTestCaseMapper.list(request); Map moduleResultMap = new HashMap<>(); 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/java/io/metersphere/service/TestPlanTestCaseService.java b/backend/src/main/java/io/metersphere/service/TestPlanTestCaseService.java index 5814a0cd5b..8f5ab4e2eb 100644 --- a/backend/src/main/java/io/metersphere/service/TestPlanTestCaseService.java +++ b/backend/src/main/java/io/metersphere/service/TestPlanTestCaseService.java @@ -4,6 +4,7 @@ import io.metersphere.base.domain.TestPlanTestCase; import io.metersphere.base.domain.TestPlanTestCaseExample; import io.metersphere.base.mapper.TestPlanTestCaseMapper; import io.metersphere.base.mapper.ext.ExtTestCaseMapper; +import io.metersphere.base.mapper.ext.ExtTestPlanTestCaseMapper; import io.metersphere.commons.constants.TestPlanTestCaseStatus; import io.metersphere.commons.utils.BeanUtils; import io.metersphere.controller.request.testcase.TestPlanCaseBatchRequest; @@ -24,10 +25,10 @@ public class TestPlanTestCaseService { TestPlanTestCaseMapper testPlanTestCaseMapper; @Resource - ExtTestCaseMapper extTestCaseMapper; + ExtTestPlanTestCaseMapper extTestPlanTestCaseMapper; public List getTestPlanCases(QueryTestPlanCaseRequest request) { - return extTestCaseMapper.getTestPlanTestCases(request); + return extTestPlanTestCaseMapper.list(request); } public void editTestCase(TestPlanTestCase testPlanTestCase) { diff --git a/backend/src/main/resources/application.properties b/backend/src/main/resources/application.properties index 671b65f503..fbae79e9b0 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 acdc85bebc..dc6296d7df 100644 --- a/frontend/src/business/components/track/case/components/TestCaseEdit.vue +++ b/frontend/src/business/components/track/case/components/TestCaseEdit.vue @@ -2,9 +2,10 @@
- + - + @@ -13,13 +14,12 @@ :label="$t('test_track.case.name')" :label-width="formLabelWidth" prop="name"> - + - @@ -173,6 +173,10 @@