From b275847f3bf8346a04510352907903488f6a2c77 Mon Sep 17 00:00:00 2001 From: yubaolee Date: Sat, 14 Jun 2025 11:07:26 +0800 Subject: [PATCH] =?UTF-8?q?=E2=9A=A0=EF=B8=8Ffeat:=20=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E6=8E=92=E5=BA=8F=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .cursorignore | 1 + OpenAuth.App/Base/PageReq.cs | 6 ++++++ OpenAuth.App/WmsInbound/WmsInboundOrderTblApp.cs | 11 ++++++++++- 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/.cursorignore b/.cursorignore index e5aaf116..fc63e469 100644 --- a/.cursorignore +++ b/.cursorignore @@ -13,5 +13,6 @@ /newdocs/docs/.vuepress/.cache /newdocs/docs/.vuepress/.temp /newdocs/docs/.vuepress/dist +/Vue2/node_modules diff --git a/OpenAuth.App/Base/PageReq.cs b/OpenAuth.App/Base/PageReq.cs index 1a8193b4..712ff617 100644 --- a/OpenAuth.App/Base/PageReq.cs +++ b/OpenAuth.App/Base/PageReq.cs @@ -15,6 +15,12 @@ public string key { get; set; } + /// + /// 排序字段 + /// + /// sort=id,asc + public string sort { get; set; } + /// /// 自定义sql条件 /// diff --git a/OpenAuth.App/WmsInbound/WmsInboundOrderTblApp.cs b/OpenAuth.App/WmsInbound/WmsInboundOrderTblApp.cs index 46e20509..9b18bca3 100644 --- a/OpenAuth.App/WmsInbound/WmsInboundOrderTblApp.cs +++ b/OpenAuth.App/WmsInbound/WmsInboundOrderTblApp.cs @@ -39,7 +39,16 @@ namespace OpenAuth.App objs = objs.Where(request.sqlWhere); } var propertyStr = string.Join(',', columns.Select(u => u.ColumnName)); - result.Data = objs.OrderBy(u => u.Id) + + if (!string.IsNullOrEmpty(request.sort)) + { + var sortfields = request.sort.Split(','); + + objs = objs.OrderBy($"{sortfields[0]} {sortfields[1]}"); + }else{ + objs = objs.OrderBy(u => u.Id); + } + result.Data = objs .Skip((request.page - 1) * request.limit) .Take(request.limit).Select($"{propertyStr}").ToList(); result.Count = await objs.CountAsync();