From 5f673e5e2205872e404115e585ff51f73d5c7a62 Mon Sep 17 00:00:00 2001 From: sunkaixuan <610262374@qq.com> Date: Fri, 12 May 2023 20:48:43 +0800 Subject: [PATCH] Synchronization code --- .../Abstract/QueryableProvider/QueryableHelper.cs | 10 +++++++--- .../PostgreSQL/SqlBuilder/PostgreSQLBuilder.cs | 4 ++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/Src/Asp.NetCore2/SqlSugar/Abstract/QueryableProvider/QueryableHelper.cs b/Src/Asp.NetCore2/SqlSugar/Abstract/QueryableProvider/QueryableHelper.cs index 8dafe55e8..1ad24533d 100644 --- a/Src/Asp.NetCore2/SqlSugar/Abstract/QueryableProvider/QueryableHelper.cs +++ b/Src/Asp.NetCore2/SqlSugar/Abstract/QueryableProvider/QueryableHelper.cs @@ -1198,10 +1198,14 @@ namespace SqlSugar tableName = this.QueryBuilder.LambdaExpressions.DbMehtods.GetTableWithDataBase (this.QueryBuilder.Builder.GetTranslationColumnName(dbName), this.QueryBuilder.Builder.GetTranslationColumnName(tableName)); } - var dbLinkName = this.Context.CurrentConnectionConfig.DbLinkName; - if (dbLinkName.HasValue()) + + if (attr != null && configId != attr.configId.ObjToString()) { - tableName = dbLinkName+"."+this.QueryBuilder.Builder.GetTranslationColumnName(oldTableName); + var dbLinkName = this.Context.Root.GetConnection(attr.configId).CurrentConnectionConfig.DbLinkName; + if (dbLinkName != null) + { + tableName = dbLinkName + "." + this.QueryBuilder.Builder.GetTranslationColumnName(oldTableName); + } } return tableName; } diff --git a/Src/Asp.NetCore2/SqlSugar/Realization/PostgreSQL/SqlBuilder/PostgreSQLBuilder.cs b/Src/Asp.NetCore2/SqlSugar/Realization/PostgreSQL/SqlBuilder/PostgreSQLBuilder.cs index abdb89ac0..cca706191 100644 --- a/Src/Asp.NetCore2/SqlSugar/Realization/PostgreSQL/SqlBuilder/PostgreSQLBuilder.cs +++ b/Src/Asp.NetCore2/SqlSugar/Realization/PostgreSQL/SqlBuilder/PostgreSQLBuilder.cs @@ -80,6 +80,10 @@ namespace SqlSugar var mappingInfo = context .MappingTables .FirstOrDefault(it => it.EntityName.Equals(name, StringComparison.CurrentCultureIgnoreCase)); + if (mappingInfo == null && name.Contains(".") && name.Contains("\"")) + { + return name; + } name = (mappingInfo == null ? name : mappingInfo.DbTableName); if (name.Contains(".")&& !name.Contains("(")&&!name.Contains("\".\"")) {