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