From 583cc420580a07c595fd6a876c9321c46248bcdf Mon Sep 17 00:00:00 2001
From: wx <wx036@qq.com>
Date: 星期五, 04 十一月 2022 22:11:02 +0800
Subject: [PATCH] 分页增加自定义查询条件
---
ZTICInterface.Application/Repository.cs | 20 ++++++++++++++++++++
1 files changed, 20 insertions(+), 0 deletions(-)
diff --git a/ZTICInterface.Application/Repository.cs b/ZTICInterface.Application/Repository.cs
index c2464f3..ca68cc7 100644
--- a/ZTICInterface.Application/Repository.cs
+++ b/ZTICInterface.Application/Repository.cs
@@ -121,6 +121,8 @@
return res;
}
+
+
/// <summary>
/// 鍒嗛〉
/// </summary>
@@ -140,6 +142,24 @@
}
/// <summary>
+ /// 鍒嗛〉
+ /// </summary>
+ /// <param name="parm">鍒嗛〉鍙傛暟</param>
+ /// <param name="where">鏉′欢</param>
+ /// <param name="order">鎺掑簭鍊�</param>
+ /// <param name="orderEnum">鎺掑簭鏂瑰紡OrderByType</param>
+ /// <returns></returns>
+ public async Task<Page<T>> GetPagesByConditionalAsync(int pageIndex, int pageSize, List<IConditionalModel> where,
+ Expression<Func<T, object>> order, OrderByType orderEnum, bool Async = true)
+ {
+ var query = Context.Queryable<T>()
+ .Where(where)
+ .OrderBy(order, orderEnum);
+ var res = Async ? await query.ToPageAsync(pageIndex, pageSize) : query.ToPage(pageIndex, pageSize);
+ return res;
+ }
+
+ /// <summary>
/// 鑾峰緱鍒楄〃
/// </summary>
/// <param name="parm">PageParm</param>
--
Gitblit v1.8.0