Browse Source

ConditionalType.EqualNull

pull/1/head
skx 4 years ago
parent
commit
8ec7b49e30
  1. 11
      Src/Asp.Net/SqlSugar/Abstract/SqlBuilderProvider/SqlBuilderProvider.cs
  2. 1
      Src/Asp.Net/SqlSugar/Enum/ConditionalType.cs

11
Src/Asp.Net/SqlSugar/Abstract/SqlBuilderProvider/SqlBuilderProvider.cs

@ -208,6 +208,17 @@ namespace SqlSugar
parameters.Add(new SugarParameter(parameterName, item.FieldValue));
}
break;
case ConditionalType.EqualNull:
if (GetFieldValue(item) == null)
{
builder.AppendFormat(temp, type, item.FieldName.ToSqlFilter(), " IS ", " NULL ");
}
else
{
builder.AppendFormat(temp, type, item.FieldName.ToSqlFilter(), "=", parameterName);
parameters.Add(new SugarParameter(parameterName, GetFieldValue(item)));
}
break;
default:
break;
}

1
Src/Asp.Net/SqlSugar/Enum/ConditionalType.cs

@ -21,5 +21,6 @@ namespace SqlSugar
IsNullOrEmpty=11,
IsNot=12,
NoLike = 13,
EqualNull = 14,
}
}

Loading…
Cancel
Save