From 25737726fe87047cbdb022d0bc8bceea312c7ad5 Mon Sep 17 00:00:00 2001 From: sunkaixuan <610262374@qq.com> Date: Tue, 4 Jul 2023 19:16:59 +0800 Subject: [PATCH] Synchronization code --- .../SqlSugar/Abstract/SqlBuilderProvider/QueryBuilder.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Src/Asp.Net/SqlSugar/Abstract/SqlBuilderProvider/QueryBuilder.cs b/Src/Asp.Net/SqlSugar/Abstract/SqlBuilderProvider/QueryBuilder.cs index 4117dc5d0..7022bdce7 100644 --- a/Src/Asp.Net/SqlSugar/Abstract/SqlBuilderProvider/QueryBuilder.cs +++ b/Src/Asp.Net/SqlSugar/Abstract/SqlBuilderProvider/QueryBuilder.cs @@ -495,7 +495,8 @@ namespace SqlSugar { var easyInfo = JoinQueryInfos.FirstOrDefault(it => it.TableName.Equals(entityInfo.DbTableName, StringComparison.CurrentCultureIgnoreCase) || - it.TableName.Equals(entityInfo.EntityName, StringComparison.CurrentCultureIgnoreCase)); + it.TableName.Equals(entityInfo.EntityName, StringComparison.CurrentCultureIgnoreCase)|| + it.EntityType==ChildType); if (easyInfo == null) { if (ChildType.IsInterface && JoinQueryInfos.Any(it =>it.EntityType!=null&&it.EntityType.GetInterfaces().Any(z => z == ChildType))) @@ -529,7 +530,7 @@ namespace SqlSugar var shortName = this.Builder.GetTranslationColumnName(joinInfo.ShortName.Trim()) + "."; sql = sql.Replace(itName, shortName); } - if (isInterface||joinInfo.TableName.EqualCase(entityInfo.EntityName)|| joinInfo.TableName.EqualCase(entityInfo.DbTableName)) + if (isInterface||joinInfo.TableName.EqualCase(entityInfo.EntityName)|| joinInfo.TableName.EqualCase(entityInfo.DbTableName)||joinInfo.EntityType==ChildType) { var mysql = sql; if (isSameName) @@ -553,7 +554,7 @@ namespace SqlSugar private string ReplaceFilterColumnName(string sql, Type filterType,string shortName=null) { - foreach (var column in this.Context.EntityMaintenance.GetEntityInfo(filterType).Columns.Where(it => it.IsIgnore == false)) + foreach (var column in this.Context.EntityMaintenance.GetEntityInfoWithAttr(filterType).Columns.Where(it => it.IsIgnore == false)) { if (shortName == null) {