Browse Source

Update exp to sql

pull/32/head
sunkaixuan 2 years ago
parent
commit
2435f0170c
  1. 13
      Src/Asp.Net/SqlSugar/ExpressionsToSql/ResolveItems/MethodCallExpressionResolve_Helper.cs

13
Src/Asp.Net/SqlSugar/ExpressionsToSql/ResolveItems/MethodCallExpressionResolve_Helper.cs

@ -279,7 +279,7 @@ namespace SqlSugar
} }
else else
{ {
AppendModel(parameter, model, item,name); AppendModel(parameter, model, item,name, args);
} }
} }
@ -334,7 +334,7 @@ namespace SqlSugar
Check.Exception(true, "The SqlFunc.IIF(arg1,arg2,arg3) , {0} argument do not support ", item.ToString()); Check.Exception(true, "The SqlFunc.IIF(arg1,arg2,arg3) , {0} argument do not support ", item.ToString());
} }
} }
private void AppendModel(ExpressionParameter parameter, MethodCallExpressionModel model, Expression item,string name) private void AppendModel(ExpressionParameter parameter, MethodCallExpressionModel model, Expression item,string name, IEnumerable<Expression> args)
{ {
parameter.CommonTempData = CommonTempDataType.Result; parameter.CommonTempData = CommonTempDataType.Result;
base.Expression = item; base.Expression = item;
@ -412,6 +412,15 @@ namespace SqlSugar
{ {
value = value?.ToString(); value = value?.ToString();
} }
else if (name == "ContainsArray"&&args.Count()==2&& value!= null && value is IList)
{
List<object> result = new List<object>();
foreach (var memItem in (value as IList))
{
result.Add(GetMemberValue(memItem, args.Last()));
}
value = result;
}
methodCallExpressionArgs.MemberValue = value; methodCallExpressionArgs.MemberValue = value;
this.Context.Parameters.Add(new SugarParameter(parameterName, value)); this.Context.Parameters.Add(new SugarParameter(parameterName, value));
} }

Loading…
Cancel
Save