From 1d1b4706c3b1fa0a9f4f788e6d06d4719bcf0677 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=86=B7=E5=86=B7?= <2270033969@qq.com> Date: Tue, 27 Aug 2024 13:20:07 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E4=BB=A3=E7=A0=81=E7=94=9F=E6=88=90):=20?= =?UTF-8?q?=E8=AF=BB=E5=8F=96=E8=A1=A8=E4=BF=A1=E6=81=AF=E5=8E=BB=E6=8E=89?= =?UTF-8?q?=E7=BC=93=E5=AD=98=EF=BC=8C=E9=81=BF=E5=85=8D=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E5=BA=93=E5=90=8C=E6=AD=A5=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pig/codegen/config/PigCodeGenDefaultProperties.java | 9 ++++++++- .../pig/codegen/service/impl/GenTableServiceImpl.java | 5 +++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/config/PigCodeGenDefaultProperties.java b/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/config/PigCodeGenDefaultProperties.java index 0e8a48f5..78253677 100644 --- a/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/config/PigCodeGenDefaultProperties.java +++ b/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/config/PigCodeGenDefaultProperties.java @@ -2,6 +2,8 @@ package com.pig4cloud.pig.codegen.config; import cn.smallbun.screw.core.constant.DefaultConstants; import lombok.Data; +import org.anyline.util.ConfigTable; +import org.springframework.beans.factory.InitializingBean; import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.context.annotation.Configuration; @@ -14,7 +16,7 @@ import org.springframework.context.annotation.Configuration; @Data @Configuration(proxyBeanMethods = false) @ConfigurationProperties(prefix = PigCodeGenDefaultProperties.PREFIX) -public class PigCodeGenDefaultProperties { +public class PigCodeGenDefaultProperties implements InitializingBean { public static final String PREFIX = "codegen"; @@ -73,4 +75,9 @@ public class PigCodeGenDefaultProperties { */ private String generatorType = "0"; + @Override + public void afterPropertiesSet() throws Exception { + ConfigTable.KEEP_ADAPTER = 0; + } + } diff --git a/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/service/impl/GenTableServiceImpl.java b/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/service/impl/GenTableServiceImpl.java index c89003e6..462ba344 100644 --- a/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/service/impl/GenTableServiceImpl.java +++ b/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/service/impl/GenTableServiceImpl.java @@ -41,6 +41,7 @@ import lombok.RequiredArgsConstructor; import org.anyline.metadata.Column; import org.anyline.metadata.Database; import org.anyline.metadata.Table; +import org.anyline.proxy.CacheProxy; import org.anyline.proxy.ServiceProxy; import org.anyline.service.AnylineService; import org.jetbrains.annotations.NotNull; @@ -96,6 +97,7 @@ public class GenTableServiceImpl extends ServiceImpl i public List queryTableColumn(String dsName, String tableName) { // 手动切换数据源 DynamicDataSourceContextHolder.push(dsName); + CacheProxy.clear(); return ServiceProxy.metadata().columns(tableName).values().stream().map(Column::getName).toList(); } @@ -109,6 +111,7 @@ public class GenTableServiceImpl extends ServiceImpl i public IPage queryTablePage(Page page, GenTable table) { // 手动切换数据源 DynamicDataSourceContextHolder.push(table.getDsName()); + CacheProxy.clear(); List
tableList = ServiceProxy.metadata().tables().values().stream().filter(t -> { if (StrUtil.isBlank(table.getTableName())) { return true; @@ -132,6 +135,7 @@ public class GenTableServiceImpl extends ServiceImpl i public List queryTableList(String dsName) { // 手动切换数据源 DynamicDataSourceContextHolder.push(dsName); + CacheProxy.clear(); return ServiceProxy.metadata().tables().values().stream().map(Table::getName).toList(); } @@ -170,6 +174,7 @@ public class GenTableServiceImpl extends ServiceImpl i // 查询表是否存在 GenTable table = new GenTable(); // 从数据库获取表信息 + CacheProxy.clear(); AnylineService service = ServiceProxy.service(); Table tableMetadata = service.metadata().table(tableName); Database database = service.metadata().database();