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"> <if test="request.orders != null and request.orders.size() > 0">
order by order by
<foreach collection="request.orders" separator="," item="order"> <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> </foreach>
</if> </if>
</sql> </sql>

View File

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

View File

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

View File

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

View File

@ -8,4 +8,6 @@ import lombok.Setter;
public class OrderRequest { public class OrderRequest {
private String name; private String name;
private String type; 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.constants.TestPlanTestCaseStatus;
import io.metersphere.commons.user.SessionUser; import io.metersphere.commons.user.SessionUser;
import io.metersphere.commons.utils.*; import io.metersphere.commons.utils.*;
import io.metersphere.controller.request.OrderRequest;
import io.metersphere.controller.request.member.QueryMemberRequest; import io.metersphere.controller.request.member.QueryMemberRequest;
import io.metersphere.log.vo.DetailColumn; import io.metersphere.log.vo.DetailColumn;
import io.metersphere.log.vo.OperatingLogDetails; import io.metersphere.log.vo.OperatingLogDetails;
@ -298,6 +299,13 @@ public class TestPlanTestCaseService {
} }
public List<TestPlanCaseDTO> listForMinder(QueryTestPlanCaseRequest request) { 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); 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.exception.MSException;
import io.metersphere.commons.utils.ServiceUtils; import io.metersphere.commons.utils.ServiceUtils;
import io.metersphere.commons.utils.SessionUtils; import io.metersphere.commons.utils.SessionUtils;
import io.metersphere.controller.request.OrderRequest;
import io.metersphere.controller.request.member.QueryMemberRequest; import io.metersphere.controller.request.member.QueryMemberRequest;
import io.metersphere.log.vo.DetailColumn; import io.metersphere.log.vo.DetailColumn;
import io.metersphere.log.vo.OperatingLogDetails; import io.metersphere.log.vo.OperatingLogDetails;
@ -343,6 +344,13 @@ public class TestReviewTestCaseService {
} }
public List<TestReviewCaseDTO> listForMinder(QueryCaseReviewRequest request) { 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); return extTestReviewCaseMapper.listForMinder(request);
} }
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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