fix(测试跟踪): 评审用例全选批量编辑筛选失效

--bug=1017673 --user=陈建星 【测试跟踪】github#18372,用例评审,先筛选评审结果为不通过的用例28条,批量全选修改为评审结果为通过;刷新页面评审计划里面1000条用例都被修改为通过了 https://www.tapd.cn/55049933/s/1263563
This commit is contained in:
chenjianxing 2022-10-17 11:43:20 +08:00 committed by jianxing
parent d202da7cde
commit dcbced09e9
4 changed files with 42 additions and 202 deletions

View File

@ -82,12 +82,6 @@
<property name="object" value="${condition}.updateTime"/>
</include>
</if>
<if test="${condition}.method != null">
and test_case.method
<include refid="condition">
<property name="object" value="${condition}.method"/>
</include>
</if>
<if test="${condition}.creator != null">
and test_case.maintainer
<include refid="condition">
@ -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 @@
<if test="request.reviewId != null">
and test_case_review_test_case.review_id = #{request.reviewId}
</if>
<if test="request.method != null">
and test_case.method = #{request.method}
</if>
<include refid="queryVersionCondition">
<property name="versionTable" value="test_case"/>
</include>
@ -190,12 +181,6 @@
#{value}
</foreach>
</when>
<when test="key=='method'">
and test_case.method in
<foreach collection="values" item="value" separator="," open="(" close=")">
#{value}
</foreach>
</when>
<when test="key=='status'">
and test_case.review_status in
<foreach collection="values" item="value" separator="," open="(" close=")">
@ -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
<where>
<if test="request.combine != null">
<include refid="combine">
<property name="condition" value="request.combine"/>
<property name="name" value="request.name"/>
</include>
</if>
<if test="request.name != null">
and (test_case.name like CONCAT('%', #{request.name},'%') or test_case.num like CONCAT('%', #{request.name},'%'))
</if>
<if test="request.id != null">
and test_case.id = #{request.id}
</if>
<if test="request.nodeIds != null and request.nodeIds.size() > 0">
and test_case.node_id in
<foreach collection="request.nodeIds" item="nodeId" separator="," open="(" close=")">
#{nodeId}
</foreach>
</if>
<if test="request.status != null">
and test_case_review_test_case.status = #{request.status}
</if>
<if test="request.reviewer != null">
and test_case_review_test_case.reviewer = #{request.reviewer}
</if>
<if test="request.reviewId != null">
and test_case_review_test_case.review_id = #{request.reviewId}
</if>
<if test="request.method != null">
and test_case.method = #{request.method}
</if>
<if test="request.filters != null and request.filters.size() > 0">
<foreach collection="request.filters.entrySet()" index="key" item="values">
<if test="values != null and values.size() > 0">
<choose>
<when test="key=='priority'">
and test_case.priority in
<foreach collection="values" item="value" separator="," open="(" close=")">
#{value}
</foreach>
</when>
<when test="key=='type'">
and test_case.type in
<foreach collection="values" item="value" separator="," open="(" close=")">
#{value}
</foreach>
</when>
<when test="key=='method'">
and test_case.method in
<foreach collection="values" item="value" separator="," open="(" close=")">
#{value}
</foreach>
</when>
<when test="key=='status'">
and test_case.review_status in
<foreach collection="values" item="value" separator="," open="(" close=")">
#{value}
</foreach>
</when>
</choose>
</if>
</foreach>
</if>
</where>
<include refid="queryWhereCondition"/>
<if test="request.orders != null and request.orders.size() > 0">
order by
<foreach collection="request.orders" separator="," item="order">
@ -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
<where>
<if test="request.combine != null">
<include refid="combine">
<property name="condition" value="request.combine"/>
<property name="name" value="request.name"/>
</include>
</if>
<if test="request.name != null">
and (test_case.name like CONCAT('%', #{request.name},'%') or test_case.num like CONCAT('%', #{request.name},'%'))
</if>
<if test="request.id != null">
and test_case.id = #{request.id}
</if>
<if test="request.nodeIds != null and request.nodeIds.size() > 0">
and test_case.node_id in
<foreach collection="request.nodeIds" item="nodeId" separator="," open="(" close=")">
#{nodeId}
</foreach>
</if>
<if test="request.status != null">
and test_case_review_test_case.status = #{request.status}
</if>
<if test="request.reviewer != null">
and test_case_review_test_case.reviewer = #{request.reviewer}
</if>
<if test="request.reviewId != null">
and test_case_review_test_case.review_id = #{request.reviewId}
</if>
<if test="request.method != null">
and test_case.method = #{request.method}
</if>
<if test="request.filters != null and request.filters.size() > 0">
<foreach collection="request.filters.entrySet()" index="key" item="values">
<if test="values != null and values.size() > 0">
<choose>
<when test="key=='priority'">
and test_case.priority in
<foreach collection="values" item="value" separator="," open="(" close=")">
#{value}
</foreach>
</when>
<when test="key=='type'">
and test_case.type in
<foreach collection="values" item="value" separator="," open="(" close=")">
#{value}
</foreach>
</when>
<when test="key=='method'">
and test_case.method in
<foreach collection="values" item="value" separator="," open="(" close=")">
#{value}
</foreach>
</when>
<when test="key=='status'">
and test_case.review_status in
<foreach collection="values" item="value" separator="," open="(" close=")">
#{value}
</foreach>
</when>
</choose>
</if>
</foreach>
</if>
</where>
<include refid="queryWhereCondition"/>
<if test="request.orders != null and request.orders.size() > 0">
order by
<foreach collection="request.orders" separator="," item="order">
@ -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

View File

@ -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<String> nodeIds;
public class QueryCaseReviewRequest extends BaseQueryRequest {
private List<String> nodePaths;
private List<OrderRequest> orders;
private Map<String, List<String>> filters;
private List<String> reviewIds;
private List<String> projectIds;
private String workspaceId;
private String name;
private String status;
private String node;
private String nodeId;
private String method;
private Map<String, Object> 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;
}

View File

@ -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());
}
}

View File

@ -87,12 +87,6 @@ public class TestReviewTestCaseService {
return list;
}
public List<String> selectIds(QueryCaseReviewRequest request) {
request.setOrders(ServiceUtils.getDefaultSortOrder(request.getOrders()));
List<String> list = extTestReviewCaseMapper.selectIds(request);
return list;
}
private List<String> 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<String> 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<String> 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<String> 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())) {