mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-05-17 05:29:33 +08:00
Update exp to sql (Optimization null)
This commit is contained in:
parent
6f2c101798
commit
27b77fecd0
@ -172,7 +172,12 @@ namespace SqlSugar
|
||||
string appendValue = Context.SqlParameterKeyWord
|
||||
+ ((MemberExpression)oppoSiteExpression).Member.Name
|
||||
+ Context.ParameterIndex;
|
||||
if (value.ObjToString() != "NULL" && !parameter.ValueIsNull)
|
||||
if (IsNullValue(parameter, value))
|
||||
{
|
||||
appendValue = $" NULL ";
|
||||
parameter.BaseParameter.ValueIsNull = true;
|
||||
}
|
||||
else if (value.ObjToString() != "NULL" && !parameter.ValueIsNull)
|
||||
{
|
||||
EntityColumnInfo columnInfo = GetColumnInfo(oppoSiteExpression);
|
||||
if (columnInfo != null && columnInfo.SqlParameterDbType != null && columnInfo.SqlParameterDbType is System.Data.DbType)
|
||||
@ -726,7 +731,14 @@ namespace SqlSugar
|
||||
#endregion
|
||||
|
||||
#region Validate
|
||||
|
||||
private bool IsNullValue(ExpressionParameter parameter, object value)
|
||||
{
|
||||
return value == null
|
||||
&& !parameter.ValueIsNull
|
||||
&& parameter.BaseParameter != null
|
||||
&& parameter.BaseParameter.OperatorValue.IsIn("=","<>")
|
||||
&& this.Context.ResolveType.IsIn(ResolveExpressType.WhereMultiple, ResolveExpressType.WhereSingle);
|
||||
}
|
||||
private static bool IsNotCaseExpression(Expression item)
|
||||
{
|
||||
if ((item as MethodCallExpression).Method.Name == "IIF")
|
||||
|
Loading…
Reference in New Issue
Block a user