🔄refactor: 统一返回给前端的数据结构

This commit is contained in:
yubaolee
2025-06-11 21:14:41 +08:00
parent 0b930dc6b4
commit 069991504c
52 changed files with 265 additions and 287 deletions

View File

@@ -18,41 +18,33 @@ using OpenAuth.Repository.Domain;
namespace OpenAuth.App.Response
{
/// <summary>
/// table的返回数据
/// 返回动态数据类型的分页数据
/// <para>带有列定义</para>
/// </summary>
public class TableData
public class PagedDynamicDataResp : Infrastructure.Response
{
/// <summary>
/// 状态码
/// </summary>
public int code { get; set; }
/// <summary>
/// 操作消息
/// </summary>
public string msg { get; set; }
/// <summary>
/// 总记录条数
/// </summary>
public int count { get; set; }
public int Count { get; set; }
/// <summary>
/// 返回的表格列定义
/// 该属性基于代码生成使用的列定义
/// </summary>
public List<BuilderTableColumn> columnFields;
public List<BuilderTableColumn> ColumnFields{ get; set; }
/// <summary>
/// 数据内容
/// </summary>
public dynamic data { get; set; }
public dynamic Data { get; set; }
public TableData()
public PagedDynamicDataResp()
{
code = 200;
msg = "加载成功";
columnFields = new List<BuilderTableColumn>();
Code = 200;
Message = "加载成功";
ColumnFields = new List<BuilderTableColumn>();
}
}
}

View File

@@ -0,0 +1,28 @@
using System.Collections.Generic;
using Infrastructure;
namespace OpenAuth.App.Response
{
/// <summary>
/// 返回确定类型的表格数据可以为swagger提供精准的注释
/// </summary>
public class PagedListDataResp<T> : Infrastructure.Response
{
/// <summary>
/// 总记录条数
/// </summary>
public int Count { get; set; }
/// <summary>
/// 数据内容
/// </summary>
public List<T> Data { get; set; }
public PagedListDataResp()
{
Code = 200;
Message = "加载成功";
}
}
}

View File

@@ -1,42 +0,0 @@
using System.Collections.Generic;
using Infrastructure;
namespace OpenAuth.App.Response
{
/// <summary>
/// 返回确定类型的表格数据可以为swagger提供精准的注释
/// </summary>
public class TableResp<T>
{
/// <summary>
/// 状态码
/// </summary>
public int code { get; set; }
/// <summary>
/// 操作消息
/// </summary>
public string msg { get; set; }
/// <summary>
/// 总记录条数
/// </summary>
public int count { get; set; }
/// <summary>
/// 数据内容
/// </summary>
public List<T> data { get; set; }
/// <summary>
/// 返回的列表头信息
/// </summary>
public List<KeyDescription> columnHeaders { get; set; }
public TableResp()
{
code = 200;
msg = "加载成功";
columnHeaders = new List<KeyDescription>();
}
}
}