|
|
|
@ -134,16 +134,109 @@ public class ServiceResult |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//public class ServicePageResult<T> |
|
|
|
|
//{ |
|
|
|
|
// /// <summary> |
|
|
|
|
// /// 状态码 |
|
|
|
|
// /// </summary> |
|
|
|
|
// public int Status { get; set; } = 200; |
|
|
|
|
// /// <summary> |
|
|
|
|
// /// 操作是否成功 |
|
|
|
|
// /// </summary> |
|
|
|
|
// public bool Success { get; set; } = true; |
|
|
|
|
// /// <summary> |
|
|
|
|
// /// 返回信息 |
|
|
|
|
// /// </summary> |
|
|
|
|
// public string Message { get; set; } = null; |
|
|
|
|
// /// <summary> |
|
|
|
|
// /// 当前页标 |
|
|
|
|
// /// </summary> |
|
|
|
|
// public int Page { get; set; } = 1; |
|
|
|
|
// /// <summary> |
|
|
|
|
// /// 总页数 |
|
|
|
|
// /// </summary> |
|
|
|
|
// public int PageCount => (int)Math.Ceiling((decimal)TotalCount / PageSize); |
|
|
|
|
// /// <summary> |
|
|
|
|
// /// 数据总数 |
|
|
|
|
// /// </summary> |
|
|
|
|
// public int TotalCount { get; set; } = 0; |
|
|
|
|
// /// <summary> |
|
|
|
|
// /// 每页大小 |
|
|
|
|
// /// </summary> |
|
|
|
|
// public int PageSize { set; get; } = 20; |
|
|
|
|
// /// <summary> |
|
|
|
|
// /// 返回数据 |
|
|
|
|
// /// </summary> |
|
|
|
|
// public List<T> Data { get; set; } |
|
|
|
|
|
|
|
|
|
// public ServicePageResult() { } |
|
|
|
|
|
|
|
|
|
// public ServicePageResult(int page, int totalCount, int pageSize, List<T> data) |
|
|
|
|
// { |
|
|
|
|
// this.Page = page; |
|
|
|
|
// this.TotalCount = totalCount; |
|
|
|
|
// PageSize = pageSize; |
|
|
|
|
// this.Data = data; |
|
|
|
|
// } |
|
|
|
|
|
|
|
|
|
// public PageModel<TOut> ConvertTo<TOut>() |
|
|
|
|
// { |
|
|
|
|
// return new PageModel<TOut>(Page, TotalCount, PageSize, default); |
|
|
|
|
// } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// public PageModel<TOut> ConvertTo<TOut>(IMapper mapper) |
|
|
|
|
// { |
|
|
|
|
// var model = ConvertTo<TOut>(); |
|
|
|
|
|
|
|
|
|
// if (Data != null) |
|
|
|
|
// { |
|
|
|
|
// model.data = mapper.Map<List<TOut>>(Data); |
|
|
|
|
// } |
|
|
|
|
|
|
|
|
|
// return model; |
|
|
|
|
// } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// public PageModel<TOut> ConvertTo<TOut>(IMapper mapper, Action<IMappingOperationOptions> options) |
|
|
|
|
// { |
|
|
|
|
// var model = ConvertTo<TOut>(); |
|
|
|
|
// if (Data != null) |
|
|
|
|
// { |
|
|
|
|
// model.data = mapper.Map<List<TOut>>(Data, options); |
|
|
|
|
// } |
|
|
|
|
|
|
|
|
|
// return model; |
|
|
|
|
|
|
|
|
|
// } |
|
|
|
|
|
|
|
|
|
//} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public class DT_TableDataT<T> |
|
|
|
|
{ |
|
|
|
|
/// <summary> |
|
|
|
|
/// 服务层分页响应实体(泛型) |
|
|
|
|
/// 返回数据 |
|
|
|
|
/// </summary> |
|
|
|
|
public class ServicePageResult<T> |
|
|
|
|
public List<T> DT_TableDataT1 { get; set; } = new List<T>(); |
|
|
|
|
|
|
|
|
|
public DT_TablePageInfoT DT_TablePageInfoT1 { get; set; } = new DT_TablePageInfoT(); |
|
|
|
|
} |
|
|
|
|
public class DT_TablePageInfoT |
|
|
|
|
{ |
|
|
|
|
public int PageNum { get; set; } |
|
|
|
|
public int PageSize { get; set; } |
|
|
|
|
public int TotalCount { get; set; } |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
|
/// 状态码 |
|
|
|
|
/// 服务层分页响应实体(泛型) |
|
|
|
|
/// </summary> |
|
|
|
|
public int Status { get; set; } = 200; |
|
|
|
|
public class ServicePageResult<T> |
|
|
|
|
{ |
|
|
|
|
public int code { get; set; } = 0; |
|
|
|
|
public string type { get; set; } = "success"; |
|
|
|
|
/// <summary> |
|
|
|
|
/// 操作是否成功 |
|
|
|
|
/// </summary> |
|
|
|
@ -151,67 +244,18 @@ public class ServicePageResult<T> |
|
|
|
|
/// <summary> |
|
|
|
|
/// 返回信息 |
|
|
|
|
/// </summary> |
|
|
|
|
public string Message { get; set; } = null; |
|
|
|
|
/// <summary> |
|
|
|
|
/// 当前页标 |
|
|
|
|
/// </summary> |
|
|
|
|
public int Page { get; set; } = 1; |
|
|
|
|
/// <summary> |
|
|
|
|
/// 总页数 |
|
|
|
|
/// </summary> |
|
|
|
|
public int PageCount => (int)Math.Ceiling((decimal)TotalCount / PageSize); |
|
|
|
|
/// <summary> |
|
|
|
|
/// 数据总数 |
|
|
|
|
/// </summary> |
|
|
|
|
public int TotalCount { get; set; } = 0; |
|
|
|
|
/// <summary> |
|
|
|
|
/// 每页大小 |
|
|
|
|
/// </summary> |
|
|
|
|
public int PageSize { set; get; } = 20; |
|
|
|
|
/// <summary> |
|
|
|
|
/// 返回数据 |
|
|
|
|
/// </summary> |
|
|
|
|
public List<T> Data { get; set; } |
|
|
|
|
|
|
|
|
|
public ServicePageResult() { } |
|
|
|
|
public string message { get; set; } = null; |
|
|
|
|
|
|
|
|
|
public ServicePageResult(int page, int totalCount, int pageSize, List<T> data) |
|
|
|
|
{ |
|
|
|
|
this.Page = page; |
|
|
|
|
this.TotalCount = totalCount; |
|
|
|
|
PageSize = pageSize; |
|
|
|
|
this.Data = data; |
|
|
|
|
} |
|
|
|
|
public DT_TableDataT<T> result { get; set; } |
|
|
|
|
|
|
|
|
|
public PageModel<TOut> ConvertTo<TOut>() |
|
|
|
|
public ServicePageResult(int page, int totalCount, int pageSize, List<T> data, string message = "查询成功!") |
|
|
|
|
{ |
|
|
|
|
return new PageModel<TOut>(Page, TotalCount, PageSize, default); |
|
|
|
|
var result = new DT_TableDataT<T>(); |
|
|
|
|
result.DT_TableDataT1 = data; |
|
|
|
|
result.DT_TablePageInfoT1.PageNum = page; |
|
|
|
|
result.DT_TablePageInfoT1.PageSize = pageSize; |
|
|
|
|
result.DT_TablePageInfoT1.TotalCount = totalCount; |
|
|
|
|
this.message = message; |
|
|
|
|
this.result = result; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public PageModel<TOut> ConvertTo<TOut>(IMapper mapper) |
|
|
|
|
{ |
|
|
|
|
var model = ConvertTo<TOut>(); |
|
|
|
|
|
|
|
|
|
if (Data != null) |
|
|
|
|
{ |
|
|
|
|
model.data = mapper.Map<List<TOut>>(Data); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return model; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public PageModel<TOut> ConvertTo<TOut>(IMapper mapper, Action<IMappingOperationOptions> options) |
|
|
|
|
{ |
|
|
|
|
var model = ConvertTo<TOut>(); |
|
|
|
|
if (Data != null) |
|
|
|
|
{ |
|
|
|
|
model.data = mapper.Map<List<TOut>>(Data, options); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return model; |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |