mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-04-24 18:04:52 +08:00
Update exp to sql
This commit is contained in:
parent
1fd7305527
commit
b8439a5bd3
@ -515,6 +515,11 @@ namespace SqlSugar
|
||||
});
|
||||
parameter.Context.Result.Append(this.Context.GetAsString(asName, sql));
|
||||
}
|
||||
else if (item.NodeType == ExpressionType.Not && (item as UnaryExpression).Operand is MethodCallExpression)
|
||||
{
|
||||
var asValue = packIfElse(GetNewExpressionValue(item)).ObjToString();
|
||||
parameter.Context.Result.Append(this.Context.GetAsString(asName, asValue));
|
||||
}
|
||||
else if (item is MethodCallExpression || item is UnaryExpression || item is ConditionalExpression || item.NodeType == ExpressionType.Coalesce)
|
||||
{
|
||||
this.Expression = item;
|
||||
@ -526,7 +531,15 @@ namespace SqlSugar
|
||||
Check.ThrowNotSupportedException(item.GetType().Name);
|
||||
}
|
||||
}
|
||||
|
||||
public object packIfElse(object methodValue)
|
||||
{
|
||||
methodValue = this.Context.DbMehtods.CaseWhen(new List<KeyValuePair<string, string>>() {
|
||||
new KeyValuePair<string, string>("IF",methodValue.ObjToString()),
|
||||
new KeyValuePair<string, string>("Return","1"),
|
||||
new KeyValuePair<string, string>("End","0")
|
||||
});
|
||||
return methodValue;
|
||||
}
|
||||
private static bool IsNotCaseExpression(Expression item)
|
||||
{
|
||||
if ((item as MethodCallExpression).Method.Name == "IIF")
|
||||
|
Loading…
Reference in New Issue
Block a user