mirror of
https://gitee.com/dotnetchina/OpenAuth.Net.git
synced 2025-09-19 18:22:11 +08:00
⚠️feat: 代码生成器增加排序功能
This commit is contained in:
@@ -39,7 +39,15 @@ namespace OpenAuth.App
|
||||
|
||||
{ForeignKeyTemplate}
|
||||
|
||||
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).ToList();
|
||||
result.Count = await objs.CountAsync();
|
||||
|
Reference in New Issue
Block a user