From ed760e9b2c0b94abd42eeb999e670ff8959c89bb Mon Sep 17 00:00:00 2001 From: WangXu10 Date: Mon, 27 Nov 2023 16:33:57 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E7=94=A8=E4=BE=8B=E7=AE=A1=E7=90=86):=20?= =?UTF-8?q?=E6=8B=96=E6=8B=BD=E6=8E=92=E5=BA=8F&=E5=8F=98=E6=9B=B4?= =?UTF-8?q?=E5=8E=86=E5=8F=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../functional/constants/HistoryLogEnum.java | 11 ++++ .../functional/constants/MoveTypeEnum.java | 11 ++++ .../controller/FunctionalCaseController.java | 10 ++- .../mapper/ExtFunctionalCaseMapper.java | 4 ++ .../mapper/ExtFunctionalCaseMapper.xml | 18 ++++++ .../functional/request/PosRequest.java | 36 +++++++++++ .../service/FunctionalCaseHistoryService.java | 2 +- .../service/FunctionalCaseService.java | 26 +++++--- .../functional/util/ServiceUtils.java | 63 +++++++++++++++++++ .../FunctionalCaseControllerTests.java | 17 +++++ .../resources/dml/init_file_metadata_test.sql | 12 ++-- .../FunctionalCaseInterceptor.java | 23 +++++++ 12 files changed, 217 insertions(+), 16 deletions(-) create mode 100644 backend/services/case-management/src/main/java/io/metersphere/functional/constants/HistoryLogEnum.java create mode 100644 backend/services/case-management/src/main/java/io/metersphere/functional/constants/MoveTypeEnum.java create mode 100644 backend/services/case-management/src/main/java/io/metersphere/functional/request/PosRequest.java create mode 100644 backend/services/case-management/src/main/java/io/metersphere/functional/util/ServiceUtils.java create mode 100644 backend/services/system-setting/src/main/java/io/metersphere/system/config/interceptor/FunctionalCaseInterceptor.java diff --git a/backend/services/case-management/src/main/java/io/metersphere/functional/constants/HistoryLogEnum.java b/backend/services/case-management/src/main/java/io/metersphere/functional/constants/HistoryLogEnum.java new file mode 100644 index 0000000000..644d6638c0 --- /dev/null +++ b/backend/services/case-management/src/main/java/io/metersphere/functional/constants/HistoryLogEnum.java @@ -0,0 +1,11 @@ +package io.metersphere.functional.constants; + +/** + * @author wx + */ + +public enum HistoryLogEnum { + IMPORT, + EDIT, + ROLLBACK +} diff --git a/backend/services/case-management/src/main/java/io/metersphere/functional/constants/MoveTypeEnum.java b/backend/services/case-management/src/main/java/io/metersphere/functional/constants/MoveTypeEnum.java new file mode 100644 index 0000000000..eb220bc1fb --- /dev/null +++ b/backend/services/case-management/src/main/java/io/metersphere/functional/constants/MoveTypeEnum.java @@ -0,0 +1,11 @@ +package io.metersphere.functional.constants; + +/** + * @author wx + */ + +public enum MoveTypeEnum { + BEFORE, + AFTER, + APPEND +} diff --git a/backend/services/case-management/src/main/java/io/metersphere/functional/controller/FunctionalCaseController.java b/backend/services/case-management/src/main/java/io/metersphere/functional/controller/FunctionalCaseController.java index 2e23fae19a..4493ad1ee0 100644 --- a/backend/services/case-management/src/main/java/io/metersphere/functional/controller/FunctionalCaseController.java +++ b/backend/services/case-management/src/main/java/io/metersphere/functional/controller/FunctionalCaseController.java @@ -125,7 +125,7 @@ public class FunctionalCaseController { @RequiresPermissions(PermissionConstants.FUNCTIONAL_CASE_READ) public Pager> getFunctionalCasePage(@Validated @RequestBody FunctionalCasePageRequest request) { Page page = PageHelper.startPage(request.getCurrent(), request.getPageSize(), - StringUtils.isNotBlank(request.getSortString()) ? request.getSortString() : "create_time desc"); + StringUtils.isNotBlank(request.getSortString()) ? request.getSortString() : "pos desc"); return PageUtils.setPageInfo(page, functionalCaseService.getFunctionalCasePage(request, false)); } @@ -181,4 +181,12 @@ public class FunctionalCaseController { functionalCaseService.batchEditFunctionalCase(request, userId); } + + @PostMapping("edit/pos") + @Operation(summary = "用例管理-功能用例-拖拽排序") + @RequiresPermissions(PermissionConstants.FUNCTIONAL_CASE_READ_UPDATE) + public void editPos(@Validated @RequestBody PosRequest request) { + functionalCaseService.editPos(request); + } + } diff --git a/backend/services/case-management/src/main/java/io/metersphere/functional/mapper/ExtFunctionalCaseMapper.java b/backend/services/case-management/src/main/java/io/metersphere/functional/mapper/ExtFunctionalCaseMapper.java index 1a4a8e6737..968ef5e466 100644 --- a/backend/services/case-management/src/main/java/io/metersphere/functional/mapper/ExtFunctionalCaseMapper.java +++ b/backend/services/case-management/src/main/java/io/metersphere/functional/mapper/ExtFunctionalCaseMapper.java @@ -54,4 +54,8 @@ public interface ExtFunctionalCaseMapper { long caseCount(@Param("request") FunctionalCasePageRequest request, @Param("deleted") boolean deleted); + Long getPrePos(@Param("projectId") String projectId, @Param("basePos") Long basePos); + + Long getLastPos(@Param("projectId") String projectId, @Param("basePos") Long basePos); + } diff --git a/backend/services/case-management/src/main/java/io/metersphere/functional/mapper/ExtFunctionalCaseMapper.xml b/backend/services/case-management/src/main/java/io/metersphere/functional/mapper/ExtFunctionalCaseMapper.xml index 842bec00e5..eaea29a126 100644 --- a/backend/services/case-management/src/main/java/io/metersphere/functional/mapper/ExtFunctionalCaseMapper.xml +++ b/backend/services/case-management/src/main/java/io/metersphere/functional/mapper/ExtFunctionalCaseMapper.xml @@ -547,4 +547,22 @@ + + + + + + \ No newline at end of file diff --git a/backend/services/case-management/src/main/java/io/metersphere/functional/request/PosRequest.java b/backend/services/case-management/src/main/java/io/metersphere/functional/request/PosRequest.java new file mode 100644 index 0000000000..7ae8095fe9 --- /dev/null +++ b/backend/services/case-management/src/main/java/io/metersphere/functional/request/PosRequest.java @@ -0,0 +1,36 @@ +package io.metersphere.functional.request; + +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.io.Serial; +import java.io.Serializable; + +/** + * @author wx + */ +@Data +@EqualsAndHashCode(callSuper = false) +public class PosRequest implements Serializable { + + @Serial + private static final long serialVersionUID = 1L; + + @Schema(description = "项目id", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "{case_review.project_id.not_blank}") + private String projectId; + + @Schema(description = "目标用例id", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "{case_review.name.not_blank}") + private String targetId; + + @Schema(description = "移动类型", requiredMode = Schema.RequiredMode.REQUIRED, allowableValues = {"BEFORE", "AFTER", "APPEND"}) + @NotBlank(message = "{case_review.module_id.not_blank}") + private String moveMode; + + @Schema(description = "移动用例id", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "{case_review.module_id.not_blank}") + private String moveId; +} diff --git a/backend/services/case-management/src/main/java/io/metersphere/functional/service/FunctionalCaseHistoryService.java b/backend/services/case-management/src/main/java/io/metersphere/functional/service/FunctionalCaseHistoryService.java index 63ba8cfbee..fa0bd0cbec 100644 --- a/backend/services/case-management/src/main/java/io/metersphere/functional/service/FunctionalCaseHistoryService.java +++ b/backend/services/case-management/src/main/java/io/metersphere/functional/service/FunctionalCaseHistoryService.java @@ -3,5 +3,5 @@ package io.metersphere.functional.service; import java.util.List; public interface FunctionalCaseHistoryService { - void saveHistoryLog(List caseIds); + void saveHistoryLog(List caseIds, String type, String userId); } diff --git a/backend/services/case-management/src/main/java/io/metersphere/functional/service/FunctionalCaseService.java b/backend/services/case-management/src/main/java/io/metersphere/functional/service/FunctionalCaseService.java index 16aaee6f23..44110f19a9 100644 --- a/backend/services/case-management/src/main/java/io/metersphere/functional/service/FunctionalCaseService.java +++ b/backend/services/case-management/src/main/java/io/metersphere/functional/service/FunctionalCaseService.java @@ -1,6 +1,7 @@ package io.metersphere.functional.service; import io.metersphere.functional.constants.FunctionalCaseReviewStatus; +import io.metersphere.functional.constants.HistoryLogEnum; import io.metersphere.functional.domain.*; import io.metersphere.functional.dto.*; import io.metersphere.functional.mapper.ExtFunctionalCaseMapper; @@ -9,6 +10,7 @@ import io.metersphere.functional.mapper.FunctionalCaseFollowerMapper; import io.metersphere.functional.mapper.FunctionalCaseMapper; import io.metersphere.functional.request.*; import io.metersphere.functional.result.CaseManagementResultCode; +import io.metersphere.functional.util.ServiceUtils; import io.metersphere.project.domain.FileAssociation; import io.metersphere.project.dto.ModuleCountDTO; import io.metersphere.project.mapper.ExtBaseProjectVersionMapper; @@ -46,7 +48,6 @@ import java.util.stream.Collectors; @Transactional(rollbackFor = Exception.class) public class FunctionalCaseService { - public static final int ORDER_STEP = 5000; @Resource private ExtFunctionalCaseMapper extFunctionalCaseMapper; @@ -100,15 +101,15 @@ public class FunctionalCaseService { functionalCaseAttachmentService.association(request.getRelateFileMetaIds(), caseId, userId, ADD_FUNCTIONAL_CASE_FILE_LOG_URL, request.getProjectId()); } - saveHistory(Collections.singletonList(caseId)); + saveHistory(Collections.singletonList(caseId), HistoryLogEnum.EDIT.name(), userId); return functionalCase; } - private void saveHistory(List ids) { + private void saveHistory(List ids, String type, String userId) { FunctionalCaseHistoryService functionalCaseHistoryService = CommonBeanFactory.getBean(FunctionalCaseHistoryService.class); if (functionalCaseHistoryService != null) { - functionalCaseHistoryService.saveHistoryLog(ids); + functionalCaseHistoryService.saveHistoryLog(ids, type, userId); } } @@ -160,7 +161,7 @@ public class FunctionalCaseService { public Long getNextOrder(String projectId) { Long pos = extFunctionalCaseMapper.getPos(projectId); - return (pos == null ? 0 : pos) + ORDER_STEP; + return (pos == null ? 0 : pos) + ServiceUtils.POS_STEP; } public long getNextNum(String projectId) { @@ -281,7 +282,7 @@ public class FunctionalCaseService { functionalCaseAttachmentService.association(request.getRelateFileMetaIds(), request.getId(), userId, UPDATE_FUNCTIONAL_CASE_FILE_LOG_URL, request.getProjectId()); } - saveHistory(Collections.singletonList(request.getId())); + saveHistory(Collections.singletonList(request.getId()), HistoryLogEnum.EDIT.name(), userId); return functionalCase; @@ -490,7 +491,7 @@ public class FunctionalCaseService { functional.setNum(getNextNum(request.getProjectId())); functional.setName(getCopyName(functionalCase.getName())); functional.setReviewStatus(FunctionalCaseReviewStatus.UN_REVIEWED.name()); - functional.setPos(nextOrder + ORDER_STEP); + functional.setPos(nextOrder + ServiceUtils.POS_STEP); functional.setLastExecuteResult(FunctionalCaseExecuteResult.UN_EXECUTED.name()); functional.setCreateUser(userId); functional.setCreateTime(System.currentTimeMillis()); @@ -564,7 +565,7 @@ public class FunctionalCaseService { handleTags(request, userId, ids); //自定义字段处理 handleCustomFields(request, userId, ids); - saveHistory(ids); + saveHistory(ids, HistoryLogEnum.EDIT.name(), userId); } } @@ -630,4 +631,13 @@ public class FunctionalCaseService { return moduleCountMap; } + + public void editPos(PosRequest request) { + ServiceUtils.updateOrderField(request, + FunctionalCase.class, + functionalCaseMapper::selectByPrimaryKey, + extFunctionalCaseMapper::getPrePos, + extFunctionalCaseMapper::getLastPos, + functionalCaseMapper::updateByPrimaryKeySelective); + } } diff --git a/backend/services/case-management/src/main/java/io/metersphere/functional/util/ServiceUtils.java b/backend/services/case-management/src/main/java/io/metersphere/functional/util/ServiceUtils.java new file mode 100644 index 0000000000..cfcb12da93 --- /dev/null +++ b/backend/services/case-management/src/main/java/io/metersphere/functional/util/ServiceUtils.java @@ -0,0 +1,63 @@ +package io.metersphere.functional.util; + +import io.metersphere.functional.constants.MoveTypeEnum; +import io.metersphere.functional.request.PosRequest; +import io.metersphere.sdk.exception.MSException; + +import java.lang.reflect.Method; +import java.util.function.BiFunction; +import java.util.function.Consumer; +import java.util.function.Function; + +public class ServiceUtils { + + public static final int POS_STEP = 5000; + + public static void updateOrderField(PosRequest request, Class clazz, + Function selectByPrimaryKeyFunc, + BiFunction getPreOrderFunc, + BiFunction getLastOrderFunc, + Consumer updateByPrimaryKeySelectiveFuc) { + Long pos; + Long lastOrPrePos; + try { + Method getPos = clazz.getMethod("getPos"); + Method setId = clazz.getMethod("setId", String.class); + Method setPos = clazz.getMethod("setPos", Long.class); + + // 获取移动的参考对象 + T target = selectByPrimaryKeyFunc.apply(request.getTargetId()); + + if (target == null) { + // 如果参考对象被删除,则不处理 + return; + } + + Long targetOrder = (Long) getPos.invoke(target); + + if (request.getMoveMode().equals(MoveTypeEnum.AFTER.name())) { + // 追加到参考对象的之后 + pos = targetOrder - ServiceUtils.POS_STEP; + // ,因为是降序排,则查找比目标 order 小的一个order + lastOrPrePos = getPreOrderFunc.apply(request.getProjectId(), targetOrder); + } else { + // 追加到前面 + pos = targetOrder + ServiceUtils.POS_STEP; + // 因为是降序排,则查找比目标 order 更大的一个order + lastOrPrePos = getLastOrderFunc.apply(request.getProjectId(), targetOrder); + } + if (lastOrPrePos != null) { + // 如果不是第一个或最后一个则取中间值 + pos = (targetOrder + lastOrPrePos) / 2; + } + + // 更新order值 + T updateObj = (T) clazz.getDeclaredConstructor().newInstance(); + setId.invoke(updateObj, request.getMoveId()); + setPos.invoke(updateObj, pos); + updateByPrimaryKeySelectiveFuc.accept(updateObj); + } catch (Exception e) { + throw new MSException("更新 order 字段失败"); + } + } +} diff --git a/backend/services/case-management/src/test/java/io/metersphere/functional/controller/FunctionalCaseControllerTests.java b/backend/services/case-management/src/test/java/io/metersphere/functional/controller/FunctionalCaseControllerTests.java index c4a982b8a9..012b673502 100644 --- a/backend/services/case-management/src/test/java/io/metersphere/functional/controller/FunctionalCaseControllerTests.java +++ b/backend/services/case-management/src/test/java/io/metersphere/functional/controller/FunctionalCaseControllerTests.java @@ -52,6 +52,7 @@ public class FunctionalCaseControllerTests extends BaseTest { public static final String FUNCTIONAL_CASE_BATCH_COPY_URL = "/functional/case/batch/copy"; public static final String FUNCTIONAL_CASE_VERSION_URL = "/functional/case/version/"; public static final String FUNCTIONAL_CASE_BATCH_EDIT_URL = "/functional/case/batch/edit"; + public static final String FUNCTIONAL_CASE_POS_URL = "/functional/case/edit/pos"; @Resource private NotificationMapper notificationMapper; @@ -388,4 +389,20 @@ public class FunctionalCaseControllerTests extends BaseTest { this.requestPostWithOkAndReturn(FUNCTIONAL_CASE_BATCH_EDIT_URL, request); } + + + @Test + @Order(18) + public void testPos() throws Exception { + PosRequest posRequest = new PosRequest(); + posRequest.setProjectId(DEFAULT_PROJECT_ID); + posRequest.setTargetId("TEST_FUNCTIONAL_CASE_ID_2"); + posRequest.setMoveId("TEST_FUNCTIONAL_CASE_ID_6"); + posRequest.setMoveMode("AFTER"); + this.requestPostWithOkAndReturn(FUNCTIONAL_CASE_POS_URL, posRequest); + + posRequest.setMoveMode("BEFORE"); + this.requestPostWithOkAndReturn(FUNCTIONAL_CASE_POS_URL, posRequest); + + } } diff --git a/backend/services/case-management/src/test/resources/dml/init_file_metadata_test.sql b/backend/services/case-management/src/test/resources/dml/init_file_metadata_test.sql index eb3ea21992..4771fab576 100644 --- a/backend/services/case-management/src/test/resources/dml/init_file_metadata_test.sql +++ b/backend/services/case-management/src/test/resources/dml/init_file_metadata_test.sql @@ -8,22 +8,22 @@ INSERT INTO functional_case(id, num, module_id, project_id, template_id, name, r VALUES ('TEST_FUNCTIONAL_CASE_ID', 1, 'TEST_MODULE_ID', '100001100001', '100001', '测试', 'UN_REVIEWED', NULL, 'STEP', 0, 'v1.0.0', 'v1.0.0', 'UN_EXECUTED', b'0', b'0', b'1', 'admin', 'admin', '', 1698058347559, 1698058347559, NULL); INSERT INTO functional_case(id, num, module_id, project_id, template_id, name, review_status, tags, case_edit_type, pos, version_id, ref_id, last_execute_result, deleted, public_case, latest, create_user, update_user, delete_user, create_time, update_time, delete_time) -VALUES ('TEST_FUNCTIONAL_CASE_ID_1', 2, 'TEST_MODULE_ID', '100001100001', '100001', '测试多版本', 'UN_REVIEWED', '["测试标签_1"]', 'STEP', 0, 'v1.0.0', 'TEST_REF_ID', 'UN_EXECUTED', b'0', b'0', b'1', 'admin', 'admin', '', 1698058347559, 1698058347559, NULL); +VALUES ('TEST_FUNCTIONAL_CASE_ID_1', 2, 'TEST_MODULE_ID', '100001100001', '100001', '测试多版本', 'UN_REVIEWED', '["测试标签_1"]', 'STEP', 5000, 'v1.0.0', 'TEST_REF_ID', 'UN_EXECUTED', b'0', b'0', b'1', 'admin', 'admin', '', 1698058347559, 1698058347559, NULL); INSERT INTO functional_case(id, num, module_id, project_id, template_id, name, review_status, tags, case_edit_type, pos, version_id, ref_id, last_execute_result, deleted, public_case, latest, create_user, update_user, delete_user, create_time, update_time, delete_time) -VALUES ('TEST_FUNCTIONAL_CASE_ID_2', 3, 'TEST_MODULE_ID', '100001100001', '100001', 'copy_测试多版本', 'UN_REVIEWED', NULL, 'STEP', 0, 'v2.0.0', 'TEST_REF_ID', 'UN_EXECUTED', b'0', b'0', b'1', 'admin', 'admin', '', 1698058347559, 1698058347559, NULL); +VALUES ('TEST_FUNCTIONAL_CASE_ID_2', 3, 'TEST_MODULE_ID', '100001100001', '100001', 'copy_测试多版本', 'UN_REVIEWED', NULL, 'STEP', 15000, 'v2.0.0', 'TEST_REF_ID', 'UN_EXECUTED', b'0', b'0', b'1', 'admin', 'admin', '', 1698058347559, 1698058347559, NULL); INSERT INTO functional_case(id, num, module_id, project_id, template_id, name, review_status, tags, case_edit_type, pos, version_id, ref_id, last_execute_result, deleted, public_case, latest, create_user, update_user, delete_user, create_time, update_time, delete_time) -VALUES ('TEST_FUNCTIONAL_CASE_ID_3', 3, 'TEST_MODULE_ID', '100001100001', '100001', 'copy_测试多版本', 'UN_REVIEWED', NULL, 'STEP', 0, 'v3.0.0', 'TEST_REF_ID', 'UN_EXECUTED', b'0', b'0', b'1', 'admin', 'admin', '', 1698058347559, 1698058347559, NULL); +VALUES ('TEST_FUNCTIONAL_CASE_ID_3', 3, 'TEST_MODULE_ID', '100001100001', '100001', 'copy_测试多版本', 'UN_REVIEWED', NULL, 'STEP', 25000, 'v3.0.0', 'TEST_REF_ID', 'UN_EXECUTED', b'0', b'0', b'1', 'admin', 'admin', '', 1698058347559, 1698058347559, NULL); INSERT INTO functional_case(id, num, module_id, project_id, template_id, name, review_status, tags, case_edit_type, pos, version_id, ref_id, last_execute_result, deleted, public_case, latest, create_user, update_user, delete_user, create_time, update_time, delete_time) -VALUES ('TEST_FUNCTIONAL_CASE_ID_4', 4, 'TEST_MODULE_ID', '100001100001', '100001', 'copy_测试多版本', 'UN_REVIEWED', NULL, 'STEP', 0, 'v3.0.0', 'TEST_REF_ID', 'UN_EXECUTED', b'0', b'0', b'1', 'admin', 'admin', '', 1698058347559, 1698058347559, NULL); +VALUES ('TEST_FUNCTIONAL_CASE_ID_4', 4, 'TEST_MODULE_ID', '100001100001', '100001', 'copy_测试多版本', 'UN_REVIEWED', NULL, 'STEP', 40000, 'v3.0.0', 'TEST_REF_ID', 'UN_EXECUTED', b'0', b'0', b'1', 'admin', 'admin', '', 1698058347559, 1698058347559, NULL); INSERT INTO functional_case(id, num, module_id, project_id, template_id, name, review_status, tags, case_edit_type, pos, version_id, ref_id, last_execute_result, deleted, public_case, latest, create_user, update_user, delete_user, create_time, update_time, delete_time) -VALUES ('TEST_FUNCTIONAL_CASE_ID_5', 5, 'TEST_MODULE_ID', '100001100001', '100001', 'copy_测试多版本', 'UN_REVIEWED', NULL, 'STEP', 0, 'v3.0.0', 'TEST_REF_ID_1', 'UN_EXECUTED', b'0', b'0', b'1', 'admin', 'admin', '', 1698058347559, 1698058347559, NULL); +VALUES ('TEST_FUNCTIONAL_CASE_ID_5', 5, 'TEST_MODULE_ID', '100001100001', '100001', 'copy_测试多版本', 'UN_REVIEWED', NULL, 'STEP', 45000, 'v3.0.0', 'TEST_REF_ID_1', 'UN_EXECUTED', b'0', b'0', b'1', 'admin', 'admin', '', 1698058347559, 1698058347559, NULL); INSERT INTO functional_case(id, num, module_id, project_id, template_id, name, review_status, tags, case_edit_type, pos, version_id, ref_id, last_execute_result, deleted, public_case, latest, create_user, update_user, delete_user, create_time, update_time, delete_time) -VALUES ('TEST_FUNCTIONAL_CASE_ID_6', 6, 'TEST_MODULE_ID', '100001100001', '100001', 'copy_测试多版本', 'UN_REVIEWED', NULL, 'STEP', 0, 'v3.0.0', 'TEST_REF_ID_1', 'UN_EXECUTED', b'0', b'0', b'1', 'admin', 'admin', '', 1698058347559, 1698058347559, NULL); +VALUES ('TEST_FUNCTIONAL_CASE_ID_6', 6, 'TEST_MODULE_ID', '100001100001', '100001', 'copy_测试多版本', 'UN_REVIEWED', NULL, 'STEP', 55000, 'v3.0.0', 'TEST_REF_ID_1', 'UN_EXECUTED', b'0', b'0', b'1', 'admin', 'admin', '', 1698058347559, 1698058347559, NULL); INSERT INTO functional_case(id, num, module_id, project_id, template_id, name, review_status, tags, case_edit_type, pos, version_id, ref_id, last_execute_result, deleted, public_case, latest, create_user, update_user, delete_user, create_time, update_time, delete_time) VALUES ('TEST_FUNCTIONAL_CASE_ID_7', 7, 'TEST_MODULE_ID', '100001100001', '100001', 'copy_long_name_11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111', 'UN_REVIEWED', NULL, 'STEP', 0, 'v3.0.0', 'TEST_REF_ID_2', 'UN_EXECUTED', b'0', b'0', b'1', 'admin', 'admin', '', 1698058347559, 1698058347559, NULL); diff --git a/backend/services/system-setting/src/main/java/io/metersphere/system/config/interceptor/FunctionalCaseInterceptor.java b/backend/services/system-setting/src/main/java/io/metersphere/system/config/interceptor/FunctionalCaseInterceptor.java new file mode 100644 index 0000000000..64c8f811bd --- /dev/null +++ b/backend/services/system-setting/src/main/java/io/metersphere/system/config/interceptor/FunctionalCaseInterceptor.java @@ -0,0 +1,23 @@ +package io.metersphere.system.config.interceptor; + +import io.metersphere.functional.domain.FunctionalCaseHistory; +import io.metersphere.sdk.util.CompressUtils; +import io.metersphere.system.utils.MybatisInterceptorConfig; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +import java.util.ArrayList; +import java.util.List; + +@Configuration +public class FunctionalCaseInterceptor { + @Bean + public List functionalCaseCompressConfigs() { + List configList = new ArrayList<>(); + + configList.add(new MybatisInterceptorConfig(FunctionalCaseHistory.class, "content", CompressUtils.class, "zip", "unzip")); + + + return configList; + } +}