From 1c0b5862f6e579e50be8c38cd78985f173fa0865 Mon Sep 17 00:00:00 2001 From: fit2-zhao Date: Tue, 14 Feb 2023 16:13:12 +0800 Subject: [PATCH] =?UTF-8?q?refactor(=E6=8E=A5=E5=8F=A3=E6=B5=8B=E8=AF=95):?= =?UTF-8?q?=20=E6=8A=A5=E5=91=8A=E8=AF=A6=E6=83=85=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E5=8E=8B=E7=BC=A9=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../commons/config/DatabaseConfig.java | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 api-test/backend/src/main/java/io/metersphere/commons/config/DatabaseConfig.java diff --git a/api-test/backend/src/main/java/io/metersphere/commons/config/DatabaseConfig.java b/api-test/backend/src/main/java/io/metersphere/commons/config/DatabaseConfig.java new file mode 100644 index 0000000000..6806d161a2 --- /dev/null +++ b/api-test/backend/src/main/java/io/metersphere/commons/config/DatabaseConfig.java @@ -0,0 +1,29 @@ +package io.metersphere.commons.config; + +import io.metersphere.base.domain.*; +import io.metersphere.commons.utils.CompressUtils; +import io.metersphere.interceptor.MybatisInterceptor; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +import java.util.ArrayList; +import java.util.List; + +@Configuration +public class DatabaseConfig { + @Bean + public MybatisInterceptor dbInterceptor() { + MybatisInterceptor interceptor = new MybatisInterceptor(); + List configList = new ArrayList<>(); + configList.add(new io.metersphere.commons.utils.MybatisInterceptorConfig(FileContent.class, "file", CompressUtils.class, "zip", "unzip")); + configList.add(new io.metersphere.commons.utils.MybatisInterceptorConfig(TestResource.class, "configuration")); + configList.add(new io.metersphere.commons.utils.MybatisInterceptorConfig(AuthSource.class, "configuration")); + + configList.add(new io.metersphere.commons.utils.MybatisInterceptorConfig(ApiDefinitionExecResultWithBLOBs.class, "content", CompressUtils.class, "zipString", "unzipString")); + configList.add(new io.metersphere.commons.utils.MybatisInterceptorConfig(ApiScenarioReportStructureWithBLOBs.class, "resourceTree", CompressUtils.class, "zip", "unzip")); + configList.add(new io.metersphere.commons.utils.MybatisInterceptorConfig(ApiScenarioReportResultWithBLOBs.class, "content", CompressUtils.class, "zip", "unzip")); + configList.add(new io.metersphere.commons.utils.MybatisInterceptorConfig(ApiScenarioReportResultWithBLOBs.class, "baseInfo", CompressUtils.class, "zipString", "unzipString")); + interceptor.setInterceptorConfigList(configList); + return interceptor; + } +}