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();