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.

54 lines
1.4 KiB
C#

using DS.Module.Core.Extensions;
using SqlSugar;
namespace DS.Module.Core;
12 months ago
/// <summary>
/// 查询请求实体
/// </summary>
public class PageRequest
{
/// <summary>
/// 查询条件
/// </summary>
public string QueryCondition { get; set; } = string.Empty;
/// <summary>
/// 其他查询条件
/// </summary>
public string? OtherQueryCondition { get; set; }
12 months ago
/// <summary>
/// 分页排序条件
/// </summary>
public PageCondition? PageCondition { get; set; }
/// <summary>
/// 获取当前实例的查询条件
/// </summary>
/// <param name="client">SqlSugar对象</param>
/// <returns></returns>
/// <exception cref="ArgumentNullException">当<paramref name="client"/>为null时引发</exception>
public List<IConditionalModel> GetConditionalModels(ISqlSugarClient client)
{
if (QueryCondition.IsNullOrEmpty())
return [];
ArgumentNullException.ThrowIfNull(client, nameof(client));
return client.ConfigQuery.Context.Utilities.JsonToConditionalModels(QueryCondition);
}
}
/// <summary>
/// 查询请求实体的泛型版本
/// </summary>
/// <typeparam name="T">查他查询条件的类型</typeparam>
public class PageRequest<T> : PageRequest
{
/// <summary>
/// 其他查询条件
/// </summary>
public new T? OtherQueryCondition { get; set; }
}