You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

25 lines
668 B
C#

namespace Myshipping.Core;
/// <summary>
/// 通用输入帮助类
/// </summary>
public class PageInputOrder
{
/// <summary>
/// 排序方式(默认降序)
/// </summary>
/// <returns></returns>
public static string OrderBuilder(string SortField,bool descSort = true)
{
// 约定默认每张表都有Id排序
var orderStr = descSort ? "Id Desc" : "Id Asc";
// 排序是否可用-排序字段和排序顺序都为非空才启用排序
if (!string.IsNullOrEmpty(SortField))
{
orderStr = $"{SortField} {(descSort ? "Desc" : "Asc")}";
}
return orderStr;
}
}