From dcbced09e9be12766f80c668b8d7d642f93f71df Mon Sep 17 00:00:00 2001 From: chenjianxing Date: Mon, 17 Oct 2022 11:43:20 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=B5=8B=E8=AF=95=E8=B7=9F=E8=B8=AA):=20?= =?UTF-8?q?=E8=AF=84=E5=AE=A1=E7=94=A8=E4=BE=8B=E5=85=A8=E9=80=89=E6=89=B9?= =?UTF-8?q?=E9=87=8F=E7=BC=96=E8=BE=91=E7=AD=9B=E9=80=89=E5=A4=B1=E6=95=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1017673 --user=陈建星 【测试跟踪】github#18372,用例评审,先筛选评审结果为不通过的用例28条,批量全选修改为评审结果为通过;刷新页面评审计划里面1000条用例都被修改为通过了 https://www.tapd.cn/55049933/s/1263563 --- .../mapper/ext/ExtTestReviewCaseMapper.xml | 149 +----------------- .../testreview/QueryCaseReviewRequest.java | 46 +++--- .../metersphere/service/TestCaseService.java | 16 +- .../service/TestReviewTestCaseService.java | 33 +--- 4 files changed, 42 insertions(+), 202 deletions(-) diff --git a/test-track/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestReviewCaseMapper.xml b/test-track/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestReviewCaseMapper.xml index 1b26d4e3d8..316542d6e4 100644 --- a/test-track/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestReviewCaseMapper.xml +++ b/test-track/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestReviewCaseMapper.xml @@ -82,12 +82,6 @@ - - and test_case.method - - - - and test_case.maintainer @@ -99,7 +93,7 @@ select test_case_review_test_case.id as id, test_case_review_test_case.reviewer, test_case_review_test_case.update_time, test_case_review_test_case.review_id as reviewId, test_case.id as caseId, test_case.name, test_case.priority, test_case.test_id as testId, - test_case.type, test_case.node_path, test_case.method, test_case.num, + test_case.type, test_case.node_path, test_case.num, test_case.custom_num, test_case_review_test_case.status reviewStatus, test_case.remark as remark, test_case.maintainer, test_case.steps as steps, test_case.node_id as nodeId, test_case.project_id, @@ -163,9 +157,6 @@ and test_case_review_test_case.review_id = #{request.reviewId} - - and test_case.method = #{request.method} - @@ -190,12 +181,6 @@ #{value} - - and test_case.method in - - #{value} - - and test_case.review_status in @@ -226,70 +211,7 @@ inner join test_case on test_case_review_test_case.case_id = test_case.id left join test_case_node on test_case_node.id=test_case.node_id inner join project on project.id = test_case.project_id - - - - - - - - - and (test_case.name like CONCAT('%', #{request.name},'%') or test_case.num like CONCAT('%', #{request.name},'%')) - - - and test_case.id = #{request.id} - - - and test_case.node_id in - - #{nodeId} - - - - and test_case_review_test_case.status = #{request.status} - - - and test_case_review_test_case.reviewer = #{request.reviewer} - - - and test_case_review_test_case.review_id = #{request.reviewId} - - - and test_case.method = #{request.method} - - - - - - - and test_case.priority in - - #{value} - - - - and test_case.type in - - #{value} - - - - and test_case.method in - - #{value} - - - - and test_case.review_status in - - #{value} - - - - - - - + order by @@ -314,70 +236,7 @@ inner join test_case on test_case_review_test_case.case_id = test_case.id left join test_case_node on test_case_node.id=test_case.node_id inner join project on project.id = test_case.project_id - - - - - - - - - and (test_case.name like CONCAT('%', #{request.name},'%') or test_case.num like CONCAT('%', #{request.name},'%')) - - - and test_case.id = #{request.id} - - - and test_case.node_id in - - #{nodeId} - - - - and test_case_review_test_case.status = #{request.status} - - - and test_case_review_test_case.reviewer = #{request.reviewer} - - - and test_case_review_test_case.review_id = #{request.reviewId} - - - and test_case.method = #{request.method} - - - - - - - and test_case.priority in - - #{value} - - - - and test_case.type in - - #{value} - - - - and test_case.method in - - #{value} - - - - and test_case.review_status in - - #{value} - - - - - - - + order by @@ -422,7 +281,7 @@ select tcrtc.id as id, tcrtc.review_id as reviewId, test_case.id as caseId, test_case.name, test_case.priority, - test_case.type, test_case.node_path, test_case.method, test_case.review_status, + test_case.type, test_case.node_path, test_case.review_status, test_case.remark as remark, test_case.maintainer, test_case.steps as steps, test_case.node_id as nodeId, test_case.prerequisite, test_case.step_description, test_case.expected_result, test_case.step_model diff --git a/test-track/backend/src/main/java/io/metersphere/request/testreview/QueryCaseReviewRequest.java b/test-track/backend/src/main/java/io/metersphere/request/testreview/QueryCaseReviewRequest.java index e38dfd86ee..5d321d8ebb 100644 --- a/test-track/backend/src/main/java/io/metersphere/request/testreview/QueryCaseReviewRequest.java +++ b/test-track/backend/src/main/java/io/metersphere/request/testreview/QueryCaseReviewRequest.java @@ -1,49 +1,49 @@ package io.metersphere.request.testreview; -import io.metersphere.base.domain.TestCaseReviewTestCase; -import io.metersphere.request.OrderRequest; +import io.metersphere.request.BaseQueryRequest; import lombok.Getter; import lombok.Setter; import java.util.List; -import java.util.Map; @Getter @Setter -public class QueryCaseReviewRequest extends TestCaseReviewTestCase { - private List nodeIds; - +public class QueryCaseReviewRequest extends BaseQueryRequest { private List nodePaths; - private List orders; - - private Map> filters; - private List reviewIds; private List projectIds; - private String workspaceId; - - private String name; - - private String status; - private String node; private String nodeId; - private String method; - - private Map combine; - - private String projectId; - private String projectName; private String reviewerId; private String versionId; - private String refId; + private String id; + + private String reviewId; + + private String caseId; + + private String result; + + private String reviewer; + + private Long createTime; + + private Long updateTime; + + private String createUser; + + private Long order; + + private String status; + + private Boolean isDel; } diff --git a/test-track/backend/src/main/java/io/metersphere/service/TestCaseService.java b/test-track/backend/src/main/java/io/metersphere/service/TestCaseService.java index 31065b83bb..eaec208733 100644 --- a/test-track/backend/src/main/java/io/metersphere/service/TestCaseService.java +++ b/test-track/backend/src/main/java/io/metersphere/service/TestCaseService.java @@ -30,6 +30,7 @@ import io.metersphere.log.utils.ReflexObjectUtil; import io.metersphere.log.vo.DetailColumn; import io.metersphere.log.vo.OperatingLogDetails; import io.metersphere.log.vo.track.TestCaseReference; +import io.metersphere.plan.service.TestPlanTestCaseService; import io.metersphere.request.OrderRequest; import io.metersphere.request.ProjectVersionRequest; import io.metersphere.request.ResetOrderRequest; @@ -176,9 +177,9 @@ public class TestCaseService { private CustomFieldTestCaseService customFieldTestCaseService; @Resource private FunctionCaseExecutionInfoService functionCaseExecutionInfoService; - // @Lazy -// @Resource -// private TestPlanTestCaseService testPlanTestCaseService; + @Lazy + @Resource + private TestPlanTestCaseService testPlanTestCaseService; @Lazy @Resource private TestReviewTestCaseService testReviewTestCaseService; @@ -696,8 +697,7 @@ public class TestCaseService { DeleteTestCaseRequest request = new DeleteTestCaseRequest(); BeanUtils.copyBean(request, testCase); - // todo check -// testPlanTestCaseService.deleteToGc(Arrays.asList(testCaseId)); + testPlanTestCaseService.deleteToGc(Arrays.asList(testCaseId)); testReviewTestCaseService.deleteToGc(Arrays.asList(testCaseId)); return extTestCaseMapper.deleteToGc(request); } @@ -726,8 +726,7 @@ public class TestCaseService { DeleteTestCaseRequest request = new DeleteTestCaseRequest(); BeanUtils.copyBean(request, testCase); request.setIds(ids); - // todo check -// testPlanTestCaseService.deleteToGc(ids); + testPlanTestCaseService.deleteToGc(ids); testReviewTestCaseService.deleteToGc(ids); return extTestCaseMapper.deleteToGc(request); } @@ -2475,8 +2474,7 @@ public class TestCaseService { } } extTestCaseMapper.reduction(request.getIds()); - // todo check -// testPlanTestCaseService.reduction(request.getIds()); + testPlanTestCaseService.reduction(request.getIds()); testReviewTestCaseService.reduction(request.getIds()); } } diff --git a/test-track/backend/src/main/java/io/metersphere/service/TestReviewTestCaseService.java b/test-track/backend/src/main/java/io/metersphere/service/TestReviewTestCaseService.java index b9c9a144ef..03dc434522 100644 --- a/test-track/backend/src/main/java/io/metersphere/service/TestReviewTestCaseService.java +++ b/test-track/backend/src/main/java/io/metersphere/service/TestReviewTestCaseService.java @@ -87,12 +87,6 @@ public class TestReviewTestCaseService { return list; } - public List selectIds(QueryCaseReviewRequest request) { - request.setOrders(ServiceUtils.getDefaultSortOrder(request.getOrders())); - List list = extTestReviewCaseMapper.selectIds(request); - return list; - } - private List getReviewUserIds(String reviewId) { TestCaseReviewUsersExample testCaseReviewUsersExample = new TestCaseReviewUsersExample(); testCaseReviewUsersExample.createCriteria().andReviewIdEqualTo(reviewId); @@ -148,13 +142,10 @@ public class TestReviewTestCaseService { public void deleteTestCaseBatch(TestReviewCaseBatchRequest request) { checkReviewer(request.getReviewId()); + ServiceUtils.getSelectAllIds(request, request.getCondition(), + (query) -> extTestReviewCaseMapper.selectIds((QueryCaseReviewRequest) query)); + List ids = request.getIds(); - if (request.getCondition() != null && request.getCondition().isSelectAll()) { - ids = this.selectIds(request.getCondition()); - if (request.getCondition().getUnSelectIds() != null) { - ids.removeAll(request.getCondition().getUnSelectIds()); - } - } TestCaseReviewTestCaseExample example = new TestCaseReviewTestCaseExample(); example.createCriteria().andIdIn(ids); testCaseReviewTestCaseMapper.deleteByExample(example); @@ -217,14 +208,10 @@ public class TestReviewTestCaseService { // } public void editTestCaseBatchStatus(TestReviewCaseBatchRequest request) { + ServiceUtils.getSelectAllIds(request, request.getCondition(), + (query) -> extTestReviewCaseMapper.selectTestCaseIds((QueryCaseReviewRequest) query)); + List ids = request.getIds(); - request.getCondition().setOrder(null); - if (request.getCondition() != null && request.getCondition().isSelectAll()) { - ids = extTestReviewCaseMapper.selectTestCaseIds(request.getCondition()); - if (request.getCondition().getUnSelectIds() != null) { - ids.removeAll(request.getCondition().getUnSelectIds()); - } - } if (CollectionUtils.isEmpty(ids)) { return; } @@ -315,13 +302,9 @@ public class TestReviewTestCaseService { } public String batchLogDetails(TestReviewCaseBatchRequest request) { + ServiceUtils.getSelectAllIds(request, request.getCondition(), + (query) -> extTestReviewCaseMapper.selectTestCaseIds((QueryCaseReviewRequest) query)); List ids = request.getIds(); - if (request.getCondition() != null && request.getCondition().isSelectAll()) { - ids = extTestReviewCaseMapper.selectTestCaseIds(request.getCondition()); - if (request.getCondition().getUnSelectIds() != null) { - ids.removeAll(request.getCondition().getUnSelectIds()); - } - } // 更新状态 if (StringUtils.isNotBlank(request.getStatus())) {