using Newtonsoft.Json; namespace Gs.Toolbox { public class ReturnDto { public ReturnDto() { RtnData = default(T); RtnCode = ReturnCode.Default; RtnMsg = string.Empty; } [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore, NullValueHandling = NullValueHandling.Ignore, PropertyName = "RtnCode")] public ReturnCode RtnCode { set; get; } [JsonProperty(NullValueHandling = NullValueHandling.Include, PropertyName = "RtnData")] public T RtnData { set; get; } [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore, NullValueHandling = NullValueHandling.Ignore, PropertyName = "RtnMsg")] public string RtnMsg { get; set; } /// /// 快速返回数据 /// /// /// /// public static ReturnDto QuickReturn(T t, ReturnCode code, string msg) { ReturnDto result = new ReturnDto(); result.RtnData = t; result.RtnCode = code; result.RtnMsg = msg; return result; } } public enum ReturnCode : int { Default = -100,//默认 Unauthorized = -101,//非法调用 Exception = -102,//系统代码异常 Success = 1 //成功 } public class PageList { /// /// 列表 /// public List list; /// /// 总页数 /// public int pages; /// /// 总记录数 /// public int total; /// /// 每页大小 /// public int everyPageSize; /// /// 扩展用,单文本,比如金额合计等其它项目 /// public string? extendText; /// /// 扩展用,列表 /// public List? extendList; } /// /// 查询实体 /// public class PageQuery { /// /// 当前页 /// public int currentPage { get; set; } /// /// 每页大小 /// public int everyPageSize { get; set; } /// /// 排序名 /// public string sortName { get; set; } /// /// 排序方式 /// public string sortOrder { get; set; } /// /// 查询关键字 /// public string keyWord { get; set; } /// /// 查询表达式 /// public string keyWhere { get; set; } } }