Update exp to sql

This commit is contained in:
sunkaixuan
2023-01-12 19:35:08 +08:00
parent b4dfe7dc98
commit 683b8f0e9b
4 changed files with 12 additions and 2 deletions

View File

@@ -209,6 +209,7 @@ namespace SqlSugar
else if (expResult.IsNavicate)
{
whereString = whereString.Replace(expression.Parameters.First().Name + ".", this.SqlBuilder.GetTranslationTableName(this.EntityInfo.DbTableName) + ".");
whereString = whereString.Replace(this.SqlBuilder.GetTranslationColumnName(expression.Parameters.First().Name) + ".", this.SqlBuilder.GetTranslationTableName(this.EntityInfo.DbTableName) + ".");
}
DeleteBuilder.WhereInfos.Add(whereString);
return this;

View File

@@ -572,6 +572,7 @@ namespace SqlSugar
else if (expResult.IsNavicate)
{
whereString = whereString.Replace(expression.Parameters.First().Name + ".", this.SqlBuilder.GetTranslationTableName(this.EntityInfo.DbTableName) + ".");
whereString = whereString.Replace(this.SqlBuilder.GetTranslationColumnName(expression.Parameters.First().Name) + ".", this.SqlBuilder.GetTranslationTableName(this.EntityInfo.DbTableName) + ".");
}
UpdateBuilder.WhereValues.Add(whereString);
return this;

View File

@@ -85,7 +85,11 @@ namespace SqlSugar
}
var selfParameterName = this.Context.GetTranslationColumnName((argExp as LambdaExpression).Parameters.First().Name) + UtilConstants.Dot;
if (this.Context.JoinIndex == 0)
if (this.Context.JoinIndex == 0 && result.Contains(" FROM "))
{
this.Context.CurrentShortName = selfParameterName;
}
else if (this.Context.JoinIndex == 0)
result = result.Replace(selfParameterName, SubTools.GetSubReplace(this.Context));
return result;
}

View File

@@ -87,7 +87,11 @@ namespace SqlSugar
}
var selfParameterName = Context.GetTranslationColumnName((argExp as LambdaExpression).Parameters.First().Name) + UtilConstants.Dot;
if (this.Context.JoinIndex == 0)
if (this.Context.JoinIndex == 0&&result.Contains(" FROM "))
{
this.Context.CurrentShortName= selfParameterName;
}
else if (this.Context.JoinIndex == 0)
result = result.Replace(selfParameterName, SubTools.GetSubReplace(this.Context));
if (!string.IsNullOrEmpty(selfParameterName) && this.Context.IsSingle&& this.Context.JoinIndex == 0)
{