Browse Source

Synchronization code

pull/40/head
sunkaixuan 1 year ago
parent
commit
25737726fe
  1. 7
      Src/Asp.Net/SqlSugar/Abstract/SqlBuilderProvider/QueryBuilder.cs

7
Src/Asp.Net/SqlSugar/Abstract/SqlBuilderProvider/QueryBuilder.cs

@ -495,7 +495,8 @@ namespace SqlSugar
{ {
var easyInfo = JoinQueryInfos.FirstOrDefault(it => var easyInfo = JoinQueryInfos.FirstOrDefault(it =>
it.TableName.Equals(entityInfo.DbTableName, StringComparison.CurrentCultureIgnoreCase) || 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 (easyInfo == null)
{ {
if (ChildType.IsInterface && JoinQueryInfos.Any(it =>it.EntityType!=null&&it.EntityType.GetInterfaces().Any(z => z == ChildType))) 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()) + "."; var shortName = this.Builder.GetTranslationColumnName(joinInfo.ShortName.Trim()) + ".";
sql = sql.Replace(itName, shortName); 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; var mysql = sql;
if (isSameName) if (isSameName)
@ -553,7 +554,7 @@ namespace SqlSugar
private string ReplaceFilterColumnName(string sql, Type filterType,string shortName=null) 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) if (shortName == null)
{ {

Loading…
Cancel
Save