mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-10-15 18:55:07 +08:00
Update exp to sql
This commit is contained in:
@@ -559,5 +559,21 @@ namespace SqlSugar
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
internal static bool IsIsNullSubQuery(Expression it)
|
||||
{
|
||||
if (it is MethodCallExpression)
|
||||
{
|
||||
var method = (MethodCallExpression)it;
|
||||
if (method.Method.Name == "IsNull")
|
||||
{
|
||||
if (method.Arguments.Count==2&&IsSubQuery(method.Arguments[0]))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -116,6 +116,22 @@ namespace SqlSugar
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (this.Context.IsSingle && args.Any(it => ExpressionTool.IsIsNullSubQuery(it)) )
|
||||
{
|
||||
var exp = base.BaseParameter?.BaseParameter?.BaseParameter?.CurrentExpression;
|
||||
if (exp is LambdaExpression)
|
||||
{
|
||||
SetShortName(exp);
|
||||
}
|
||||
else if (exp is UnaryExpression)
|
||||
{
|
||||
exp = base.BaseParameter?.BaseParameter?.BaseParameter?.BaseParameter?.CurrentExpression;
|
||||
if (exp is LambdaExpression)
|
||||
{
|
||||
SetShortName(exp);
|
||||
}
|
||||
}
|
||||
}
|
||||
var isBinaryExpression = item is BinaryExpression || item is MethodCallExpression;
|
||||
var isConst = item is ConstantExpression;
|
||||
var isIIF = name == "IIF";
|
||||
|
Reference in New Issue
Block a user