fix: 测试计划用例评审脑图顺序跟列表一致

This commit is contained in:
chenjianxing 2021-09-03 17:28:04 +08:00 committed by jianxing
parent b95aa50b5e
commit 9ac645a4df
13 changed files with 69 additions and 10 deletions

View File

@ -7,7 +7,14 @@
<if test="request.orders != null and request.orders.size() > 0">
order by
<foreach collection="request.orders" separator="," item="order">
${order.name} ${order.type}
<choose>
<when test="order.prefix != null and order.prefix != ''">
${order.prefix}.${order.name} ${order.type}
</when>
<otherwise>
${order.name} ${order.type}
</otherwise>
</choose>
</foreach>
</if>
</sql>

View File

@ -451,7 +451,7 @@
pc.plan_id = #{request.planId}
and t.node_id = #{request.nodeId}
</where>
order by pc.update_time desc;
<include refid="io.metersphere.base.mapper.ext.ExtBaseMapper.orders"/>
</select>
<select id="listTestCaseTest" resultType="io.metersphere.track.dto.TestCaseTestDTO">
select * from test_case_test where test_case_id = #{caseId};

View File

@ -422,6 +422,6 @@
tcrtc.review_id = #{request.reviewId}
and test_case.node_id = #{request.nodeId}
</where>
order by tcrtc.update_time desc;
<include refid="io.metersphere.base.mapper.ext.ExtBaseMapper.orders"/>
</select>
</mapper>

View File

@ -8,6 +8,7 @@ import io.metersphere.controller.request.OrderRequest;
import io.metersphere.service.ProjectService;
import io.metersphere.service.UserService;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import java.lang.reflect.Method;
import java.util.ArrayList;
@ -20,10 +21,17 @@ import java.util.stream.Collectors;
public class ServiceUtils {
public static List<OrderRequest> getDefaultOrder(List<OrderRequest> orders) {
return getDefaultOrder(null, orders);
}
public static List<OrderRequest> getDefaultOrder(String prefix, List<OrderRequest> orders) {
if (orders == null || orders.size() < 1) {
OrderRequest orderRequest = new OrderRequest();
orderRequest.setName("update_time");
orderRequest.setType("desc");
if (StringUtils.isNotBlank(prefix)) {
orderRequest.setPrefix(prefix);
}
orders = new ArrayList<>();
orders.add(orderRequest);
return orders;

View File

@ -8,4 +8,6 @@ import lombok.Setter;
public class OrderRequest {
private String name;
private String type;
// 表前缀
private String prefix;
}

View File

@ -8,6 +8,7 @@ import io.metersphere.base.mapper.ext.ExtTestPlanTestCaseMapper;
import io.metersphere.commons.constants.TestPlanTestCaseStatus;
import io.metersphere.commons.user.SessionUser;
import io.metersphere.commons.utils.*;
import io.metersphere.controller.request.OrderRequest;
import io.metersphere.controller.request.member.QueryMemberRequest;
import io.metersphere.log.vo.DetailColumn;
import io.metersphere.log.vo.OperatingLogDetails;
@ -298,6 +299,13 @@ public class TestPlanTestCaseService {
}
public List<TestPlanCaseDTO> listForMinder(QueryTestPlanCaseRequest request) {
List<OrderRequest> orders = ServiceUtils.getDefaultOrder(request.getOrders());
orders.forEach(order -> {
if (order.getName().equals("create_time")) {
order.setPrefix("pc");
}
});
request.setOrders(orders);
return extTestPlanTestCaseMapper.listForMinder(request);
}

View File

@ -8,6 +8,7 @@ import io.metersphere.base.mapper.ext.ExtTestReviewCaseMapper;
import io.metersphere.commons.exception.MSException;
import io.metersphere.commons.utils.ServiceUtils;
import io.metersphere.commons.utils.SessionUtils;
import io.metersphere.controller.request.OrderRequest;
import io.metersphere.controller.request.member.QueryMemberRequest;
import io.metersphere.log.vo.DetailColumn;
import io.metersphere.log.vo.OperatingLogDetails;
@ -343,6 +344,13 @@ public class TestReviewTestCaseService {
}
public List<TestReviewCaseDTO> listForMinder(QueryCaseReviewRequest request) {
List<OrderRequest> orders = ServiceUtils.getDefaultOrder("tcrtc", request.getOrders());
orders.forEach(order -> {
if (order.getName().equals("update_time")) {
order.setPrefix("tcrtc");
}
});
request.setOrders(orders);
return extTestReviewCaseMapper.listForMinder(request);
}
}

View File

@ -45,7 +45,8 @@ name: "TestPlanMinder",
planId: {
type: String
},
projectId: String
projectId: String,
condition: Object
},
computed: {
selectNode() {
@ -71,7 +72,10 @@ name: "TestPlanMinder",
handleAfterMount() {
listenNodeSelected(() => {
let param = {
request: {planId: this.planId},
request: {
planId: this.planId,
orders: this.condition.orders
},
result: this.result,
isDisable: true
}

View File

@ -44,7 +44,8 @@ name: "TestReviewMinder",
reviewId: {
type: String
},
projectId: String
projectId: String,
condition: Object
},
mounted() {
if (this.selectNode && this.selectNode.data) {
@ -76,6 +77,7 @@ name: "TestReviewMinder",
let param = {
request: {
reviewId: this.reviewId,
orders: this.condition.orders
},
result: this.result,
isDisable: true

View File

@ -400,9 +400,13 @@ export default {
this.updata = !this.updata;
},
deep: true
}
},
condition() {
this.$emit('setCondition', this.condition);
},
},
mounted() {
this.$emit('setCondition', this.condition);
hub.$on("openFailureTestCase", row => {
this.isReadOnly = true;
this.condition.status = 'Failure';

View File

@ -21,6 +21,7 @@
v-if="activeDom === 'left'"
@openTestCaseRelevanceDialog="openTestCaseRelevanceDialog"
@refresh="refresh"
@setCondition="setCondition"
:plan-id="planId"
:clickType="clickType"
:select-node-ids="selectNodeIds"
@ -28,6 +29,7 @@
<test-plan-minder
:tree-nodes="treeNodes"
:project-id="projectId"
:condition="condition"
:plan-id="planId"
v-if="activeDom === 'right'"
/>
@ -69,7 +71,8 @@ export default {
selectNodeIds: [],
treeNodes: [],
activeDom: 'left',
selectNode: {}
selectNode: {},
condition: {}
};
},
props: [
@ -130,6 +133,9 @@ export default {
});
}
},
setCondition(data) {
this.condition = data;
},
openTestCaseEdit(path) {
if (path.indexOf("/plan/view/edit") >= 0) {
let caseId = this.$route.params.caseId;

View File

@ -22,12 +22,14 @@
v-if="activeDom === 'left'"
@openTestReviewRelevanceDialog="openTestReviewRelevanceDialog"
@refresh="refresh"
@setCondition="setCondition"
:review-id="reviewId"
:clickType="clickType"
ref="testPlanTestCaseList"/>
<test-review-minder
:tree-nodes="treeNodes"
:project-id="projectId"
:condition="condition"
:review-id="reviewId"
v-if="activeDom === 'right'"
/>
@ -67,6 +69,7 @@ export default {
treeNodes: [],
isMenuShow: true,
activeDom: 'left',
condition: {}
}
},
props: [
@ -86,6 +89,9 @@ export default {
},
},
methods: {
setCondition(data) {
this.condition = data;
},
refresh() {
this.$store.commit('setTestReviewSelectNode', {});
this.$store.commit('setTestReviewSelectNodeIds', []);

View File

@ -275,7 +275,10 @@ export default {
},
selectNodeIds() {
this.search();
}
},
condition() {
this.$emit('setCondition', this.condition);
},
},
computed: {
selectNodeIds() {
@ -283,6 +286,7 @@ export default {
}
},
mounted() {
this.$emit('setCondition', this.condition);
this.refreshTableAndReview();
this.isTestManagerOrTestUser = true;
this.initTableHeader();