diff --git a/backend/src/main/java/io/metersphere/base/domain/TestCaseReviewTestCase.java b/backend/src/main/java/io/metersphere/base/domain/TestCaseReviewTestCase.java index 57ee239129..8eb587f353 100644 --- a/backend/src/main/java/io/metersphere/base/domain/TestCaseReviewTestCase.java +++ b/backend/src/main/java/io/metersphere/base/domain/TestCaseReviewTestCase.java @@ -23,5 +23,7 @@ public class TestCaseReviewTestCase implements Serializable { private String createUser; + private Long order; + private static final long serialVersionUID = 1L; -} \ No newline at end of file +} diff --git a/backend/src/main/java/io/metersphere/base/domain/TestCaseReviewTestCaseExample.java b/backend/src/main/java/io/metersphere/base/domain/TestCaseReviewTestCaseExample.java index 1942553bf5..910f082a44 100644 --- a/backend/src/main/java/io/metersphere/base/domain/TestCaseReviewTestCaseExample.java +++ b/backend/src/main/java/io/metersphere/base/domain/TestCaseReviewTestCaseExample.java @@ -713,6 +713,66 @@ public class TestCaseReviewTestCaseExample { addCriterion("create_user not between", value1, value2, "createUser"); return (Criteria) this; } + + public Criteria andOrderIsNull() { + addCriterion("`order` is null"); + return (Criteria) this; + } + + public Criteria andOrderIsNotNull() { + addCriterion("`order` is not null"); + return (Criteria) this; + } + + public Criteria andOrderEqualTo(Long value) { + addCriterion("`order` =", value, "order"); + return (Criteria) this; + } + + public Criteria andOrderNotEqualTo(Long value) { + addCriterion("`order` <>", value, "order"); + return (Criteria) this; + } + + public Criteria andOrderGreaterThan(Long value) { + addCriterion("`order` >", value, "order"); + return (Criteria) this; + } + + public Criteria andOrderGreaterThanOrEqualTo(Long value) { + addCriterion("`order` >=", value, "order"); + return (Criteria) this; + } + + public Criteria andOrderLessThan(Long value) { + addCriterion("`order` <", value, "order"); + return (Criteria) this; + } + + public Criteria andOrderLessThanOrEqualTo(Long value) { + addCriterion("`order` <=", value, "order"); + return (Criteria) this; + } + + public Criteria andOrderIn(List values) { + addCriterion("`order` in", values, "order"); + return (Criteria) this; + } + + public Criteria andOrderNotIn(List values) { + addCriterion("`order` not in", values, "order"); + return (Criteria) this; + } + + public Criteria andOrderBetween(Long value1, Long value2) { + addCriterion("`order` between", value1, value2, "order"); + return (Criteria) this; + } + + public Criteria andOrderNotBetween(Long value1, Long value2) { + addCriterion("`order` not between", value1, value2, "order"); + return (Criteria) this; + } } public static class Criteria extends GeneratedCriteria { @@ -807,4 +867,4 @@ public class TestCaseReviewTestCaseExample { this(condition, value, secondValue, null); } } -} \ No newline at end of file +} diff --git a/backend/src/main/java/io/metersphere/base/mapper/TestCaseReviewTestCaseMapper.xml b/backend/src/main/java/io/metersphere/base/mapper/TestCaseReviewTestCaseMapper.xml index 71ec423e60..f761467d23 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/TestCaseReviewTestCaseMapper.xml +++ b/backend/src/main/java/io/metersphere/base/mapper/TestCaseReviewTestCaseMapper.xml @@ -11,6 +11,7 @@ + @@ -71,7 +72,8 @@ - id, review_id, case_id, `status`, `result`, reviewer, create_time, update_time, create_user + id, review_id, case_id, `status`, `result`, reviewer, create_time, update_time, create_user, + `order` @@ -210,6 +218,9 @@ create_user = #{record.createUser,jdbcType=VARCHAR}, + + `order` = #{record.order,jdbcType=BIGINT}, + @@ -225,7 +236,8 @@ reviewer = #{record.reviewer,jdbcType=VARCHAR}, create_time = #{record.createTime,jdbcType=BIGINT}, update_time = #{record.updateTime,jdbcType=BIGINT}, - create_user = #{record.createUser,jdbcType=VARCHAR} + create_user = #{record.createUser,jdbcType=VARCHAR}, + `order` = #{record.order,jdbcType=BIGINT} @@ -257,6 +269,9 @@ create_user = #{createUser,jdbcType=VARCHAR}, + + `order` = #{order,jdbcType=BIGINT}, + where id = #{id,jdbcType=VARCHAR} @@ -269,7 +284,8 @@ reviewer = #{reviewer,jdbcType=VARCHAR}, create_time = #{createTime,jdbcType=BIGINT}, update_time = #{updateTime,jdbcType=BIGINT}, - create_user = #{createUser,jdbcType=VARCHAR} + create_user = #{createUser,jdbcType=VARCHAR}, + `order` = #{order,jdbcType=BIGINT} where id = #{id,jdbcType=VARCHAR} - \ No newline at end of file + diff --git a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestReviewCaseMapper.java b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestReviewCaseMapper.java index 284e11820f..c83f7de6e2 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestReviewCaseMapper.java +++ b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestReviewCaseMapper.java @@ -36,4 +36,13 @@ public interface ExtTestReviewCaseMapper { List selectTestCaseIds(@Param("request") QueryCaseReviewRequest request); List listForMinder(@Param("request") QueryCaseReviewRequest request); + + + List selectReviewIds(); + + List getIdsOrderByUpdateTime(@Param("reviewId") String reviewId); + + Long getPreOrder(@Param("reviewId")String reviewId, @Param("baseOrder") Long baseOrder); + + Long getLastOrder(@Param("reviewId")String reviewId, @Param("baseOrder") Long baseOrder); } diff --git a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestReviewCaseMapper.xml b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestReviewCaseMapper.xml index 65bdfd98ad..8811afd032 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestReviewCaseMapper.xml +++ b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestReviewCaseMapper.xml @@ -427,4 +427,28 @@ + + + + + + + + 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 8c12a976a2..8e259c5d10 100644 --- a/backend/src/main/java/io/metersphere/commons/utils/ServiceUtils.java +++ b/backend/src/main/java/io/metersphere/commons/utils/ServiceUtils.java @@ -35,6 +35,10 @@ public class ServiceUtils { return getDefaultOrderByField(null, orders, "order"); } + public static List getDefaultSortOrder(String prefix, List orders) { + return getDefaultOrderByField(prefix, orders, "order"); + } + public static List getDefaultOrder(String prefix, List orders) { return getDefaultOrderByField(prefix, orders, "update_time"); } diff --git a/backend/src/main/java/io/metersphere/listener/AppStartListener.java b/backend/src/main/java/io/metersphere/listener/AppStartListener.java index 9404f87571..cc943418ef 100644 --- a/backend/src/main/java/io/metersphere/listener/AppStartListener.java +++ b/backend/src/main/java/io/metersphere/listener/AppStartListener.java @@ -61,6 +61,8 @@ public class AppStartListener implements ApplicationListener { + for (String caseId : testCaseIds) { TestCaseReviewTestCase caseReview = new TestCaseReviewTestCase(); caseReview.setId(UUID.randomUUID().toString()); caseReview.setReviewer(SessionUtils.getUser().getId()); @@ -306,8 +306,10 @@ public class TestCaseReviewService { caseReview.setUpdateTime(System.currentTimeMillis()); caseReview.setReviewId(request.getReviewId()); caseReview.setStatus(TestCaseReviewStatus.Prepare.name()); + caseReview.setOrder(nextOrder); batchMapper.insert(caseReview); - }); + nextOrder += 5000; + } } sqlSession.flushStatements(); 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 c88672778b..7ed1df2d61 100644 --- a/backend/src/main/java/io/metersphere/track/service/TestReviewTestCaseService.java +++ b/backend/src/main/java/io/metersphere/track/service/TestReviewTestCaseService.java @@ -9,6 +9,7 @@ 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.ResetOrderRequest; import io.metersphere.controller.request.member.QueryMemberRequest; import io.metersphere.log.vo.DetailColumn; import io.metersphere.log.vo.OperatingLogDetails; @@ -60,7 +61,7 @@ public class TestReviewTestCaseService { ExtTestPlanTestCaseMapper extTestPlanTestCaseMapper; public List list(QueryCaseReviewRequest request) { - request.setOrders(ServiceUtils.getDefaultOrder(request.getOrders())); + request.setOrders(ServiceUtils.getDefaultSortOrder(request.getOrders())); List list = extTestReviewCaseMapper.list(request); QueryMemberRequest queryMemberRequest = new QueryMemberRequest(); queryMemberRequest.setWorkspaceId(SessionUtils.getCurrentProjectId()); @@ -75,7 +76,7 @@ public class TestReviewTestCaseService { } public List selectIds(QueryCaseReviewRequest request) { - request.setOrders(ServiceUtils.getDefaultOrder(request.getOrders())); + request.setOrders(ServiceUtils.getDefaultSortOrder(request.getOrders())); List list = extTestReviewCaseMapper.selectIds(request); return list; } @@ -150,7 +151,7 @@ public class TestReviewTestCaseService { } public List getTestCaseReviewDTOList(QueryCaseReviewRequest request) { - request.setOrders(ServiceUtils.getDefaultOrder(request.getOrders())); + request.setOrders(ServiceUtils.getDefaultSortOrder(request.getOrders())); return extTestReviewCaseMapper.list(request); } @@ -344,7 +345,7 @@ public class TestReviewTestCaseService { } public List listForMinder(QueryCaseReviewRequest request) { - List orders = ServiceUtils.getDefaultOrder("tcrtc", request.getOrders()); + List orders = ServiceUtils.getDefaultSortOrder("tcrtc", request.getOrders()); orders.forEach(order -> { if (order.getName().equals("update_time")) { order.setPrefix("tcrtc"); @@ -353,4 +354,22 @@ public class TestReviewTestCaseService { request.setOrders(orders); return extTestReviewCaseMapper.listForMinder(request); } + + public void initOrderField() { + ServiceUtils.initOrderField(TestCaseReviewTestCase.class, TestCaseReviewMapper.class, + extTestReviewCaseMapper::selectReviewIds, + extTestReviewCaseMapper::getIdsOrderByUpdateTime); + } + + /** + * 用例自定义排序 + * @param request + */ + public void updateOrder(ResetOrderRequest request) { + ServiceUtils.updateOrderField(request, TestCaseReviewTestCase.class, + testCaseReviewTestCaseMapper::selectByPrimaryKey, + extTestReviewCaseMapper::getPreOrder, + extTestReviewCaseMapper::getLastOrder, + testCaseReviewTestCaseMapper::updateByPrimaryKeySelective); + } } diff --git a/backend/src/main/resources/db/migration/V96__v1.13.1__release.sql b/backend/src/main/resources/db/migration/V96__v1.13.1__release.sql index 496aaa9545..c22ced36b7 100644 --- a/backend/src/main/resources/db/migration/V96__v1.13.1__release.sql +++ b/backend/src/main/resources/db/migration/V96__v1.13.1__release.sql @@ -1,2 +1,4 @@ CREATE INDEX load_test_report_test_resource_pool_id_index - ON load_test_report (test_resource_pool_id); \ No newline at end of file + ON load_test_report (test_resource_pool_id); + +ALTER TABLE test_case_review_test_case ADD `order` bigint(20) NOT NULL COMMENT '自定义排序,间隔5000'; diff --git a/backend/src/main/resources/i18n/messages_en_US.properties b/backend/src/main/resources/i18n/messages_en_US.properties index 34ea53303e..e2e516dfaa 100644 --- a/backend/src/main/resources/i18n/messages_en_US.properties +++ b/backend/src/main/resources/i18n/messages_en_US.properties @@ -193,7 +193,7 @@ quota_max_threads_excess_workspace=The maximum number of concurrent threads exce quota_max_threads_excess_organization=The maximum number of concurrent threads exceeds the organization quota quota_duration_excess_workspace=The stress test duration exceeds the work space quota quota_duration_excess_organization=The stress test duration exceeds the organization quota -import_xmind_count_error=The number of use cases imported into the mind map cannot exceed 500 +import_xmind_count_error=The number of use cases imported into the mind map cannot exceed 800 import_xmind_not_found=Test case not found license_valid_license_error=Authorization authentication failed test_review_task_notice=Test review task notice @@ -282,4 +282,4 @@ scenario_case=SCENARIO create_user=Create user test_case_status=Case status -id_not_rightful=ID is not rightful \ No newline at end of file +id_not_rightful=ID is not rightful diff --git a/backend/src/main/resources/i18n/messages_zh_CN.properties b/backend/src/main/resources/i18n/messages_zh_CN.properties index 84c3e784bd..da7ce149ce 100644 --- a/backend/src/main/resources/i18n/messages_zh_CN.properties +++ b/backend/src/main/resources/i18n/messages_zh_CN.properties @@ -193,7 +193,7 @@ quota_max_threads_excess_workspace=最大并发数超过工作空间限额 quota_max_threads_excess_organization=最大并发数超过组织限额 quota_duration_excess_workspace=压测时长超过工作空间限额 quota_duration_excess_organization=压测时长超过组织限额 -import_xmind_count_error=思维导图导入用例数量不能超过 500 条 +import_xmind_count_error=思维导图导入用例数量不能超过 800 条 license_valid_license_error=授权认证失败 import_xmind_not_found=未找到测试用例 test_review_task_notice=测试评审任务通知 diff --git a/backend/src/main/resources/i18n/messages_zh_TW.properties b/backend/src/main/resources/i18n/messages_zh_TW.properties index 77d054c2f3..d1acf792d0 100644 --- a/backend/src/main/resources/i18n/messages_zh_TW.properties +++ b/backend/src/main/resources/i18n/messages_zh_TW.properties @@ -195,7 +195,7 @@ quota_duration_excess_workspace=壓測時長超過工作空間限額 quota_duration_excess_organization=壓測時長超過組織限額 license_valid_license_error=授權驗證失敗 license_valid_license_code=授權碼已經存在 -import_xmind_count_error=思維導圖導入用例數量不能超過 500 條 +import_xmind_count_error=思維導圖導入用例數量不能超過 800 條 import_xmind_not_found=未找到测试用例 test_review_task_notice=測試評審任務通知 swagger_url_scheduled_import_notification=swagger_url定時導入通知 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 2d361ab5ef..83846e986e 100644 --- a/frontend/src/business/components/track/review/view/components/TestReviewTestCaseList.vue +++ b/frontend/src/business/components/track/review/view/components/TestReviewTestCaseList.vue @@ -30,6 +30,9 @@ @handleRowClick="showDetail" :fields.sync="fields" :remember-order="true" + :enable-order-drag="true" + :row-order-func="editTestReviewTestCaseOrder" + :row-order-group-id="reviewId" @refresh="initTableData" ref="table" > @@ -181,6 +184,7 @@ import HeaderLabelOperate from "@/business/components/common/head/HeaderLabelOpe import MsTableHeaderSelectPopover from "@/business/components/common/components/table/MsTableHeaderSelectPopover"; import MsTableColumn from "@/business/components/common/components/table/MsTableColumn"; import MsTable from "@/business/components/common/components/table/MsTable"; +import {editTestReviewTestCaseOrder} from "@/network/testCase"; export default { name: "TestReviewTestCaseList", @@ -286,6 +290,9 @@ export default { computed: { selectNodeIds() { return this.$store.state.testReviewSelectNodeIds; + }, + editTestReviewTestCaseOrder() { + return editTestReviewTestCaseOrder; } }, created() { diff --git a/frontend/src/network/testCase.js b/frontend/src/network/testCase.js index 5d40a732e5..a423a60819 100644 --- a/frontend/src/network/testCase.js +++ b/frontend/src/network/testCase.js @@ -59,3 +59,7 @@ export function getMinderExtraNode(groupId, nodeId, callback) { return baseGet('/minder/extra/node/list/' + groupId + '/' + nodeId, callback); } +export function editTestReviewTestCaseOrder(request, callback) { + return basePost('/test/review/case/edit/order', request, callback); +} +