diff --git a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtBaseMapper.xml b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtBaseMapper.xml
index a3ac8dc6e9..75f24f4eca 100644
--- a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtBaseMapper.xml
+++ b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtBaseMapper.xml
@@ -7,7 +7,14 @@
order by
- ${order.name} ${order.type}
+
+
+ ${order.prefix}.${order.name} ${order.type}
+
+
+ ${order.name} ${order.type}
+
+
@@ -56,4 +63,4 @@
-
\ No newline at end of file
+
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 88b5cd3232..bba25942c7 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
@@ -451,7 +451,7 @@
pc.plan_id = #{request.planId}
and t.node_id = #{request.nodeId}
- order by pc.update_time desc;
+
diff --git a/backend/src/main/java/io/metersphere/commons/utils/ServiceUtils.java b/backend/src/main/java/io/metersphere/commons/utils/ServiceUtils.java
index 5fbf52e014..4648affe17 100644
--- a/backend/src/main/java/io/metersphere/commons/utils/ServiceUtils.java
+++ b/backend/src/main/java/io/metersphere/commons/utils/ServiceUtils.java
@@ -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 getDefaultOrder(List orders) {
+ return getDefaultOrder(null, orders);
+ }
+
+ public static List getDefaultOrder(String prefix, List 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;
diff --git a/backend/src/main/java/io/metersphere/controller/request/OrderRequest.java b/backend/src/main/java/io/metersphere/controller/request/OrderRequest.java
index b877fb011c..8fd28aa275 100644
--- a/backend/src/main/java/io/metersphere/controller/request/OrderRequest.java
+++ b/backend/src/main/java/io/metersphere/controller/request/OrderRequest.java
@@ -8,4 +8,6 @@ import lombok.Setter;
public class OrderRequest {
private String name;
private String type;
+ // 表前缀
+ private String prefix;
}
diff --git a/backend/src/main/java/io/metersphere/track/service/TestPlanTestCaseService.java b/backend/src/main/java/io/metersphere/track/service/TestPlanTestCaseService.java
index c586dd25de..ef6de34057 100644
--- a/backend/src/main/java/io/metersphere/track/service/TestPlanTestCaseService.java
+++ b/backend/src/main/java/io/metersphere/track/service/TestPlanTestCaseService.java
@@ -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 listForMinder(QueryTestPlanCaseRequest request) {
+ List orders = ServiceUtils.getDefaultOrder(request.getOrders());
+ orders.forEach(order -> {
+ if (order.getName().equals("create_time")) {
+ order.setPrefix("pc");
+ }
+ });
+ request.setOrders(orders);
return extTestPlanTestCaseMapper.listForMinder(request);
}
diff --git a/backend/src/main/java/io/metersphere/track/service/TestReviewTestCaseService.java b/backend/src/main/java/io/metersphere/track/service/TestReviewTestCaseService.java
index 9e9380cad4..c88672778b 100644
--- a/backend/src/main/java/io/metersphere/track/service/TestReviewTestCaseService.java
+++ b/backend/src/main/java/io/metersphere/track/service/TestReviewTestCaseService.java
@@ -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 listForMinder(QueryCaseReviewRequest request) {
+ List 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);
}
}
diff --git a/frontend/src/business/components/track/common/minder/TestPlanMinder.vue b/frontend/src/business/components/track/common/minder/TestPlanMinder.vue
index 4f58cabc32..3ffa7012fe 100644
--- a/frontend/src/business/components/track/common/minder/TestPlanMinder.vue
+++ b/frontend/src/business/components/track/common/minder/TestPlanMinder.vue
@@ -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
}
diff --git a/frontend/src/business/components/track/common/minder/TestReviewMinder.vue b/frontend/src/business/components/track/common/minder/TestReviewMinder.vue
index 10137625ce..96dfdf3cef 100644
--- a/frontend/src/business/components/track/common/minder/TestReviewMinder.vue
+++ b/frontend/src/business/components/track/common/minder/TestReviewMinder.vue
@@ -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
diff --git a/frontend/src/business/components/track/plan/view/comonents/functional/FunctionalTestCaseList.vue b/frontend/src/business/components/track/plan/view/comonents/functional/FunctionalTestCaseList.vue
index 23c2444d96..278af4f340 100644
--- a/frontend/src/business/components/track/plan/view/comonents/functional/FunctionalTestCaseList.vue
+++ b/frontend/src/business/components/track/plan/view/comonents/functional/FunctionalTestCaseList.vue
@@ -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';
diff --git a/frontend/src/business/components/track/plan/view/comonents/functional/TestPlanFunctional.vue b/frontend/src/business/components/track/plan/view/comonents/functional/TestPlanFunctional.vue
index 0d4d45e40f..3fac341ebe 100644
--- a/frontend/src/business/components/track/plan/view/comonents/functional/TestPlanFunctional.vue
+++ b/frontend/src/business/components/track/plan/view/comonents/functional/TestPlanFunctional.vue
@@ -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 @@
@@ -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;
diff --git a/frontend/src/business/components/track/review/view/components/TestReviewFunction.vue b/frontend/src/business/components/track/review/view/components/TestReviewFunction.vue
index cf21dfe022..978157cd2a 100644
--- a/frontend/src/business/components/track/review/view/components/TestReviewFunction.vue
+++ b/frontend/src/business/components/track/review/view/components/TestReviewFunction.vue
@@ -22,12 +22,14 @@
v-if="activeDom === 'left'"
@openTestReviewRelevanceDialog="openTestReviewRelevanceDialog"
@refresh="refresh"
+ @setCondition="setCondition"
:review-id="reviewId"
:clickType="clickType"
ref="testPlanTestCaseList"/>
@@ -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', []);
diff --git a/frontend/src/business/components/track/review/view/components/TestReviewTestCaseList.vue b/frontend/src/business/components/track/review/view/components/TestReviewTestCaseList.vue
index 52d818d080..6d49355ee9 100644
--- a/frontend/src/business/components/track/review/view/components/TestReviewTestCaseList.vue
+++ b/frontend/src/business/components/track/review/view/components/TestReviewTestCaseList.vue
@@ -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();