refactor: 更新API接口与数据结构,统一分页返回格式

This commit is contained in:
Ray.Hao
2026-01-09 00:07:25 +08:00
parent 4a8efc770e
commit a5885d0710
64 changed files with 1085 additions and 910 deletions

View File

@@ -2,6 +2,8 @@
* AI 模块类型定义
*/
import type { BaseQueryParams } from "./common";
/** AI命令请求参数 */
export interface AiCommandRequest {
/** 用户输入的自然语言命令 */
@@ -81,10 +83,12 @@ export interface AiExecuteResponse {
}
/** AI命令记录分页查询参数 */
export interface AiCommandRecordPageQuery extends PageQuery {
export interface AiAssistantRecordQueryParams extends BaseQueryParams {
/** 搜索关键字 */
keywords?: string;
/** 执行状态 */
status?: string;
/** 执行状态(0:待执行;1:成功;-1:失败) */
executeStatus?: number;
/** 解析状态 */
parseStatus?: number;
@@ -101,7 +105,7 @@ export interface AiCommandRecordPageQuery extends PageQuery {
}
/** AI命令记录视图对象 */
export interface AiCommandRecordVo {
export interface AiAssistantRecordItem {
/** 记录ID */
id: string;
/** 用户ID */

View File

@@ -2,8 +2,10 @@
* CodeGen 代码生成类型定义
*/
import type { BaseQueryParams } from "./common";
/** 代码生成预览对象 */
export interface GeneratorPreviewVo {
export interface GeneratorPreviewItem {
/** 文件生成路径 */
path: string;
/** 文件名称 */
@@ -13,13 +15,13 @@ export interface GeneratorPreviewVo {
}
/** 数据表分页查询参数 */
export interface TablePageQuery extends PageQuery {
export interface TableQueryParams extends BaseQueryParams {
/** 搜索关键字(表名) */
keywords?: string;
}
/** 数据表分页对象 */
export interface TablePageVo {
export interface TableItem {
/** 表名称 */
tableName: string;
/** 表描述 */

View File

@@ -10,32 +10,49 @@ export interface ApiResponse<T = any> {
data: T;
/** 响应消息 */
msg: string;
/** 分页信息(非列表接口通常不存在该字段) */
page?: PageMeta | null;
}
/** 分页查询参数 */
export interface PageQuery {
/** 基础查询参数 */
export interface BaseQueryParams {
/** 页码 */
pageNum: number;
/** 每页记录数 */
pageSize: number;
/** 排序字段 */
sortBy?: string;
/** 排序方式(正序:ASC反序:DESC */
order?: string;
}
/** 分页响应结构 */
export interface PageResult<T> {
/** 数据列表 */
list: T;
/** 总记录数 */
/** 分页元信息 */
export interface PageMeta {
pageNum: number;
pageSize: number;
total: number;
}
/** 列表响应结构(统一) */
export interface PageResult<T> {
/** 数据列表 */
data: T[];
/** 分页信息,不分页时为 null */
page: PageMeta | null;
}
/** 下拉选项 */
export interface OptionType {
export interface OptionItem {
/** 选项值 */
value: string | number;
/** 选项标签 */
label: string;
/** 子选项 */
children?: OptionType[];
children?: OptionItem[];
}
/** Excel 导入结果 */

View File

@@ -2,8 +2,10 @@
* Config 配置类型定义
*/
import type { BaseQueryParams } from "./common";
/** 配置分页查询参数 */
export interface ConfigPageQuery extends PageQuery {
export interface ConfigQueryParams extends BaseQueryParams {
/** 搜索关键字 */
keywords?: string;
}
@@ -23,7 +25,7 @@ export interface ConfigForm {
}
/** 配置分页对象 */
export interface ConfigPageVo {
export interface ConfigItem {
/** 配置ID */
id?: string;
/** 配置名称 */

View File

@@ -3,7 +3,7 @@
*/
/** 部门查询参数 */
export interface DeptQuery {
export interface DeptQueryParams {
/** 搜索关键字 */
keywords?: string;
/** 状态 */
@@ -11,9 +11,9 @@ export interface DeptQuery {
}
/** 部门视图对象 */
export interface DeptVo {
export interface DeptItem {
/** 子部门 */
children?: DeptVo[];
children?: DeptItem[];
/** 创建时间 */
createTime?: Date;
/** 部门ID */

View File

@@ -2,9 +2,11 @@
* Dict 字典类型定义
*/
import type { BaseQueryParams } from "./common";
/** 字典分页查询参数 */
export interface DictPageQuery extends PageQuery {
export interface DictTypeQueryParams extends BaseQueryParams {
/** 搜索关键字 */
keywords?: string;
/** 状态(1:启用;0:禁用) */
@@ -12,7 +14,7 @@ export interface DictPageQuery extends PageQuery {
}
/** 字典分页对象 */
export interface DictPageVo {
export interface DictTypeItem {
/** 字典ID */
id: string;
/** 字典名称 */
@@ -24,7 +26,7 @@ export interface DictPageVo {
}
/** 字典表单对象 */
export interface DictForm {
export interface DictTypeForm {
/** 字典ID */
id?: string;
/** 字典名称 */
@@ -38,7 +40,7 @@ export interface DictForm {
}
/** 字典项分页查询参数 */
export interface DictItemPageQuery extends PageQuery {
export interface DictItemQueryParams extends BaseQueryParams {
/** 搜索关键字 */
keywords?: string;
/** 字典编码 */
@@ -46,7 +48,7 @@ export interface DictItemPageQuery extends PageQuery {
}
/** 字典项分页对象 */
export interface DictItemPageVo {
export interface DictItem {
/** 字典项ID */
id: string;
/** 字典编码 */

View File

@@ -2,8 +2,10 @@
* Log 日志类型定义
*/
import type { BaseQueryParams } from "./common";
/** 日志分页查询参数 */
export interface LogPageQuery extends PageQuery {
export interface LogQueryParams extends BaseQueryParams {
/** 搜索关键字 */
keywords?: string;
/** 操作时间 */
@@ -11,7 +13,7 @@ export interface LogPageQuery extends PageQuery {
}
/** 日志分页对象 */
export interface LogPageVo {
export interface LogItem {
/** 日志ID */
id: string;
/** 日志模块 */

View File

@@ -3,15 +3,15 @@
*/
/** 菜单查询参数 */
export interface MenuQuery {
export interface MenuQueryParams {
/** 搜索关键字 */
keywords?: string;
}
/** 菜单视图对象 */
export interface MenuVo {
export interface MenuItem {
/** 子菜单 */
children?: MenuVo[];
children?: MenuItem[];
/** 组件路径 */
component?: string;
/** ICON */
@@ -79,9 +79,9 @@ export interface MenuOption {
}
/** 路由对象 */
export interface RouteVo {
export interface RouteItem {
/** 子路由列表 */
children: RouteVo[];
children: RouteItem[];
/** 组件路径 */
component?: string;
/** 路由名称 */

View File

@@ -2,8 +2,10 @@
* Notice 通知类型定义
*/
import type { BaseQueryParams } from "./common";
/** 通知分页查询参数 */
export interface NoticePageQuery extends PageQuery {
export interface NoticeQueryParams extends BaseQueryParams {
/** 通知标题 */
title?: string;
/** 发布状态(0:草稿;1:已发布;2:已撤回) */
@@ -33,7 +35,7 @@ export interface NoticeForm {
}
/** 通知分页对象 */
export interface NoticePageVo {
export interface NoticeItem {
/** 通知ID */
id: string;
/** 通知标题 */
@@ -55,7 +57,7 @@ export interface NoticePageVo {
}
/** 通知详情对象 */
export interface NoticeDetailVo {
export interface NoticeDetail {
/** 通知ID */
id?: string;
/** 通知标题 */

View File

@@ -2,14 +2,16 @@
* Role 角色类型定义
*/
import type { BaseQueryParams } from "./common";
/** 角色分页查询参数 */
export interface RolePageQuery extends PageQuery {
export interface RoleQueryParams extends BaseQueryParams {
/** 搜索关键字 */
keywords?: string;
}
/** 角色分页对象 */
export interface RolePageVo {
export interface RoleItem {
/** 角色ID */
id?: string;
/** 角色编码 */

View File

@@ -3,7 +3,7 @@
*/
/** 访问趋势查询参数 */
export interface VisitTrendQuery {
export interface VisitTrendQueryParams {
/** 开始日期 */
startDate: string;
/** 结束日期 */
@@ -11,7 +11,7 @@ export interface VisitTrendQuery {
}
/** 访问趋势视图对象 */
export interface VisitTrendVo {
export interface VisitTrendDetail {
/** 日期列表 */
dates: string[];
/** 浏览量(PV)列表 */
@@ -23,7 +23,7 @@ export interface VisitTrendVo {
}
/** 访问量统计视图对象 */
export interface VisitStatsVo {
export interface VisitStatsDetail {
/** 今日独立访客数(UV) */
todayUvCount: number;
/** 累计独立访客数(UV) */

View File

@@ -2,7 +2,7 @@
* Tenant 租户类型定义
*/
import type { PageQuery } from "./common";
import type { BaseQueryParams } from "./common";
/** 租户信息 */
export interface TenantInfo {
@@ -15,7 +15,7 @@ export interface TenantInfo {
}
/** 租户分页查询参数 */
export interface TenantPageQuery extends PageQuery {
export interface TenantQueryParams extends BaseQueryParams {
/** 关键字(租户名称/租户编码/域名) */
keywords?: string;
/** 租户状态(1-正常 0-禁用) */
@@ -23,7 +23,7 @@ export interface TenantPageQuery extends PageQuery {
}
/** 租户分页对象 */
export interface TenantPageVo {
export interface TenantItem {
id?: string;
name?: string;
code?: string;
@@ -69,7 +69,7 @@ export interface TenantCreateForm {
}
/** 新增租户结果 */
export interface TenantCreateResultVo {
export interface TenantCreateResult {
tenantId?: string;
tenantCode?: string;
tenantName?: string;

View File

@@ -2,6 +2,8 @@
* User 用户类型定义
*/
import type { BaseQueryParams } from "./common";
/** 登录用户信息 */
export interface UserInfo {
/** 用户ID */
@@ -19,7 +21,7 @@ export interface UserInfo {
}
/** 用户分页查询参数 */
export interface UserPageQuery extends PageQuery {
export interface UserQueryParams extends BaseQueryParams {
/** 搜索关键字 */
keywords?: string;
/** 用户状态 */
@@ -31,7 +33,7 @@ export interface UserPageQuery extends PageQuery {
}
/** 用户分页对象 */
export interface UserPageVo {
export interface UserItem {
/** 用户ID */
id: string;
/** 用户头像地址 */
@@ -81,7 +83,7 @@ export interface UserForm {
}
/** 个人中心用户信息 */
export interface UserProfileVo {
export interface UserProfileDetail {
/** 用户ID */
id?: string;
/** 用户名 */

View File

@@ -6,7 +6,7 @@
// Generated by unplugin-vue-components
// Read more: https://github.com/vuejs/core/pull/3399
export {};
export {}
/* prettier-ignore */
declare module 'vue' {

View File

@@ -5,9 +5,9 @@
*/
declare global {
type ApiResponse<T = any> = import("@/types/api").ApiResponse<T>;
type PageQuery = import("@/types/api").PageQuery;
type BaseQueryParams = import("@/types/api").BaseQueryParams;
type PageResult<T> = import("@/types/api").PageResult<T>;
type OptionType = import("@/types/api").OptionType;
type OptionItem = import("@/types/api").OptionItem;
type ExcelResult = import("@/types/api").ExcelResult;
type TagView = import("@/types/ui").TagView;
type AppSettings = import("@/types/ui").AppSettings;