mirror of
https://github.com/nsnail/FreeSql.git
synced 2025-04-22 10:42:52 +08:00
- 增加 HavingIf 方法;#1095
This commit is contained in:
parent
41432cde0a
commit
ae1b053189
@ -19,11 +19,18 @@ namespace FreeSql
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// 按聚合条件过滤,Where(a => a.Count() > 10)
|
||||
/// 按聚合条件过滤,Having(a => a.Count() > 10)
|
||||
/// </summary>
|
||||
/// <param name="exp">lambda表达式</param>
|
||||
/// <returns></returns>
|
||||
ISelectGrouping<TKey, TValue> Having(Expression<Func<ISelectGroupingAggregate<TKey, TValue>, bool>> exp);
|
||||
/// <summary>
|
||||
/// 按聚合条件过滤,HavingIf(true, a => a.Count() > 10)
|
||||
/// </summary>
|
||||
/// <param name="condition">true 时生效</param>
|
||||
/// <param name="exp">lambda表达式</param>
|
||||
/// <returns></returns>
|
||||
ISelectGrouping<TKey, TValue> HavingIf(bool condition, Expression<Func<ISelectGroupingAggregate<TKey, TValue>, bool>> exp);
|
||||
|
||||
/// <summary>
|
||||
/// 按列排序,OrderBy(a => a.Time)
|
||||
|
@ -226,6 +226,7 @@ namespace FreeSql.Internal.CommonProvider
|
||||
return this;
|
||||
}
|
||||
|
||||
public ISelectGrouping<TKey, TValue> HavingIf(bool condition, Expression<Func<ISelectGroupingAggregate<TKey, TValue>, bool>> exp) => condition ? Having(exp) : this;
|
||||
public ISelectGrouping<TKey, TValue> Having(Expression<Func<ISelectGroupingAggregate<TKey, TValue>, bool>> exp)
|
||||
{
|
||||
_lambdaParameter = exp?.Parameters[0];
|
||||
|
Loading…
x
Reference in New Issue
Block a user