From 5cd575123905d58f72b30363e9ceca0d7a013b1b Mon Sep 17 00:00:00 2001 From: orches Date: Mon, 26 Jun 2023 10:20:21 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9EGroupByIF=E7=9A=84=E9=87=8D?= =?UTF-8?q?=E8=BD=BD=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Abstract/QueryableProvider/QueryableProvider.cs | 12 ++++++++++++ Src/Asp.NetCore2/SqlSugar/Interface/IQueryable.cs | 2 ++ 2 files changed, 14 insertions(+) diff --git a/Src/Asp.NetCore2/SqlSugar/Abstract/QueryableProvider/QueryableProvider.cs b/Src/Asp.NetCore2/SqlSugar/Abstract/QueryableProvider/QueryableProvider.cs index f304f19a8..85dc8d5e4 100644 --- a/Src/Asp.NetCore2/SqlSugar/Abstract/QueryableProvider/QueryableProvider.cs +++ b/Src/Asp.NetCore2/SqlSugar/Abstract/QueryableProvider/QueryableProvider.cs @@ -1078,6 +1078,18 @@ namespace SqlSugar } return this; } + + public ISugarQueryable GroupByIF(bool isGroupBy, string groupFields) + { + if (isGroupBy) + { + GroupBy(groupFields); + } + + return this; + } + + public virtual ISugarQueryable OrderByIF(bool isOrderBy, string orderFileds) { if (isOrderBy) diff --git a/Src/Asp.NetCore2/SqlSugar/Interface/IQueryable.cs b/Src/Asp.NetCore2/SqlSugar/Interface/IQueryable.cs index 9d20283d2..2b458a181 100644 --- a/Src/Asp.NetCore2/SqlSugar/Interface/IQueryable.cs +++ b/Src/Asp.NetCore2/SqlSugar/Interface/IQueryable.cs @@ -117,6 +117,8 @@ namespace SqlSugar ISugarQueryable GroupBy(string groupFileds); ISugarQueryable GroupByIF(bool isGroupBy, Expression> expression); + ISugarQueryable GroupByIF(bool isGroupBy, string groupFields); + ISugarQueryable PartitionBy(Expression> expression); ISugarQueryable PartitionBy(string groupFileds);