Update exp to sql

This commit is contained in:
sunkaixuan
2022-10-01 10:04:23 +08:00
parent 81a0da7361
commit f8cea00027

View File

@@ -490,12 +490,23 @@ namespace SqlSugar
{ {
//var property=item.Type.GetProperties().Where(it => it.Name == newExpressionInfo.l).First(); //var property=item.Type.GetProperties().Where(it => it.Name == newExpressionInfo.l).First();
//asName = GetAsName(item, newExpressionInfo.ShortName, property); //asName = GetAsName(item, newExpressionInfo.ShortName, property);
if (newExpressionInfo.Type == nameof(ConstantExpression))
{
parameter.Context.Result.Append(
newExpressionInfo.RightDbName +" AS "+
this.Context.SqlTranslationLeft + asName + "." + newExpressionInfo.LeftNameName + this.Context.SqlTranslationRight
);
}
else
{
parameter.Context.Result.Append(this.Context.GetAsString( parameter.Context.Result.Append(this.Context.GetAsString(
this.Context.SqlTranslationLeft+asName + "." + newExpressionInfo.LeftNameName+this.Context.SqlTranslationRight, this.Context.SqlTranslationLeft + asName + "." + newExpressionInfo.LeftNameName + this.Context.SqlTranslationRight,
newExpressionInfo.ShortName+"."+newExpressionInfo.RightDbName newExpressionInfo.ShortName + "." + newExpressionInfo.RightDbName
)); ));
} }
} }
}
else if (!this.Context.IsJoin && (item is MemberInitExpression || item is NewExpression)) else if (!this.Context.IsJoin && (item is MemberInitExpression || item is NewExpression))
{ {
List<NewExpressionInfo> newExpressionInfos = new List<NewExpressionInfo>(); List<NewExpressionInfo> newExpressionInfos = new List<NewExpressionInfo>();