Browse Source

Add Queryable.InIF(+3)

pull/40/head
sunkaixuan 1 year ago
parent
commit
07b74b187e
  1. 11
      Src/Asp.Net/SqlSugar/Abstract/QueryableProvider/QueryableProvider.cs
  2. 24
      Src/Asp.Net/SqlSugar/Abstract/QueryableProvider/QueryableProvider02-05.cs
  3. 4
      Src/Asp.Net/SqlSugar/Interface/IQueryable.cs

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

@ -901,6 +901,17 @@ namespace SqlSugar
if (list == null) return default(T);
else return list.SingleOrDefault();
}
public ISugarQueryable<T> InIF<TParamter>(bool isIn,string fieldName, params TParamter[] pkValues)
{
if (isIn)
{
return In(fieldName, pkValues);
}
else
{
return this;
}
}
public ISugarQueryable<T> InIF<TParamter>(bool isIn, params TParamter[] pkValues)
{
if (isIn)

24
Src/Asp.Net/SqlSugar/Abstract/QueryableProvider/QueryableProvider02-05.cs

@ -440,6 +440,14 @@ namespace SqlSugar
#endregion
#region In
public new ISugarQueryable<T,T2> InIF<TParamter>(bool isIn, string fieldName, params TParamter[] pkValues)
{
if (isIn)
{
In(fieldName, pkValues);
}
return this;
}
public new ISugarQueryable<T, T2> InIF<TParamter>(bool isIn, params TParamter[] pkValues)
{
if (isIn)
@ -1133,6 +1141,14 @@ namespace SqlSugar
#endregion
#region In
public new ISugarQueryable<T, T2,T3> InIF<TParamter>(bool isIn, string fieldName, params TParamter[] pkValues)
{
if (isIn)
{
In(fieldName, pkValues);
}
return this;
}
public new ISugarQueryable<T, T2, T3> InIF<TParamter>(bool isIn, params TParamter[] pkValues)
{
if (isIn)
@ -1843,6 +1859,14 @@ namespace SqlSugar
#endregion
#region In
public new ISugarQueryable<T, T2, T3,T4> InIF<TParamter>(bool isIn, string fieldName, params TParamter[] pkValues)
{
if (isIn)
{
In(fieldName, pkValues);
}
return this;
}
public new ISugarQueryable<T, T2, T3, T4> InIF<TParamter>(bool isIn, params TParamter[] pkValues)
{
if (isIn)

4
Src/Asp.Net/SqlSugar/Interface/IQueryable.cs

@ -95,6 +95,7 @@ namespace SqlSugar
T InSingle(object pkValue);
Task<T> InSingleAsync(object pkValue);
ISugarQueryable<T> In<TParamter>(params TParamter[] pkValues);
ISugarQueryable<T> InIF<TParamter>(bool isIn, string fieldName, params TParamter[] pkValues);
ISugarQueryable<T> InIF<TParamter>(bool isIn,params TParamter[] pkValues);
ISugarQueryable<T> In<FieldType>(string InFieldName, params FieldType[] inValues);
ISugarQueryable<T> In<FieldType>(Expression<Func<T, object>> expression, params FieldType[] inValues);
@ -371,6 +372,7 @@ namespace SqlSugar
ISugarQueryable<T, T2> In<FieldType>(Expression<Func<T,T2, object>> expression, List<FieldType> inValues);
ISugarQueryable<T, T2> In<FieldType>(Expression<Func<T,T2, object>> expression, ISugarQueryable<FieldType> childQueryExpression);
new ISugarQueryable<T,T2> InIF<TParamter>(bool isIn, params TParamter[] pkValues);
new ISugarQueryable<T,T2> InIF<TParamter>(bool isIn, string fieldName, params TParamter[] pkValues);
#endregion
#region Other
@ -506,6 +508,7 @@ namespace SqlSugar
ISugarQueryable<T, T2, T3> In<FieldType>(Expression<Func<T, T2,T3, object>> expression, ISugarQueryable<FieldType> childQueryExpression);
new ISugarQueryable<T, T2,T3> InIF<TParamter>(bool isIn, params TParamter[] pkValues);
new ISugarQueryable<T, T2,T3> InIF<TParamter>(bool isIn, string fieldName, params TParamter[] pkValues);
#endregion
#region Other
@ -647,6 +650,7 @@ namespace SqlSugar
ISugarQueryable<T, T2, T3, T4> In<FieldType>(Expression<Func<T, T2, T3,T4, object>> expression, ISugarQueryable<FieldType> childQueryExpression);
new ISugarQueryable<T, T2,T3,T4> InIF<TParamter>(bool isIn, params TParamter[] pkValues);
new ISugarQueryable<T, T2, T3,T4> InIF<TParamter>(bool isIn, string fieldName, params TParamter[] pkValues);
#endregion
#region Other

Loading…
Cancel
Save