Update exp to sql

This commit is contained in:
sunkaixuan 2025-06-27 11:25:16 +08:00
parent c3e1d64cbd
commit 105ba2a697

View File

@ -55,11 +55,10 @@ namespace SqlSugar
var item = memberAssignment.Expression;
item = ExpressionTool.RemoveConvert(item);
//Column IsJson Handler
if (memberAssignment.Member.CustomAttributes != null)
{
var customAttribute = memberAssignment.Member.GetCustomAttribute<SugarColumn>();
if (customAttribute?.IsJson ?? false)
if (entityMaintenance!=null)
{
EntityColumnInfo columnInfo = entityMaintenance.GetEntityInfo(type).Columns.FirstOrDefault(it => it.PropertyName == memberAssignment.Member.Name);
if (columnInfo?.IsJson ?? false)
{
var paramterValue = ExpressionTool.DynamicInvoke(item);
var parameterName = AppendParameter(new SerializeService().SerializeObject(paramterValue));
@ -72,6 +71,15 @@ namespace SqlSugar
continue;
}
else if (UtilMethods.IsParameterConverter(columnInfo))
{
var value = ExpressionTool.DynamicInvoke(item);
var p=UtilMethods.GetParameterConverter(this.Context.ParameterIndex,this.Context.SugarContext.Context, value, memberAssignment.Expression, columnInfo);
this.Context.Result.Append(base.Context.GetEqString(memberName, p.ParameterName));
this.Context.ParameterIndex++;
this.Context.Parameters.Add(p);
continue;
}
}
if ((item is MemberExpression) && ((MemberExpression)item).Expression == null)