From 6ca2b0f1ca5eb7d442e6b66c52461319a6d54bd6 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Mon, 22 Sep 2025 09:59:22 +0800 Subject: [PATCH] =?UTF-8?q?feat=EF=BC=9A=E3=80=90antd=E3=80=91=E3=80=90ele?= =?UTF-8?q?=E3=80=91=E7=BB=9F=E4=B8=80=20codegen=E3=80=81file=20=E7=9A=84?= =?UTF-8?q?=20API=20=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/web-antd/src/api/infra/codegen/index.ts | 21 ++++++++++++++----- apps/web-antd/src/api/infra/file/index.ts | 8 +++---- .../src/components/upload/use-upload.ts | 2 +- apps/web-ele/src/api/infra/codegen/index.ts | 10 ++++++--- 4 files changed, 28 insertions(+), 13 deletions(-) diff --git a/apps/web-antd/src/api/infra/codegen/index.ts b/apps/web-antd/src/api/infra/codegen/index.ts index 759c8ee2..992d41d2 100644 --- a/apps/web-antd/src/api/infra/codegen/index.ts +++ b/apps/web-antd/src/api/infra/codegen/index.ts @@ -65,7 +65,7 @@ export namespace InfraCodegenApi { } /** 更新代码生成请求 */ - export interface CodegenUpdateReq { + export interface CodegenUpdateReqVO { table: any | CodegenTable; columns: CodegenColumn[]; } @@ -106,25 +106,36 @@ export function getCodegenTable(tableId: number) { } /** 修改代码生成表定义 */ -export function updateCodegenTable(data: InfraCodegenApi.CodegenUpdateReq) { +export function updateCodegenTable(data: InfraCodegenApi.CodegenUpdateReqVO) { return requestClient.put('/infra/codegen/update', data); } /** 基于数据库的表结构,同步数据库的表和字段定义 */ export function syncCodegenFromDB(tableId: number) { - return requestClient.put(`/infra/codegen/sync-from-db?tableId=${tableId}`); + return requestClient.put( + '/infra/codegen/sync-from-db', + {}, + { + params: { tableId }, + }, + ); } /** 预览生成代码 */ export function previewCodegen(tableId: number) { return requestClient.get( - `/infra/codegen/preview?tableId=${tableId}`, + '/infra/codegen/preview', + { + params: { tableId }, + }, ); } /** 下载生成代码 */ export function downloadCodegen(tableId: number) { - return requestClient.download(`/infra/codegen/download?tableId=${tableId}`); + return requestClient.download('/infra/codegen/download', { + params: { tableId }, + }); } /** 获得表定义 */ diff --git a/apps/web-antd/src/api/infra/file/index.ts b/apps/web-antd/src/api/infra/file/index.ts index e7dc7891..edf06933 100644 --- a/apps/web-antd/src/api/infra/file/index.ts +++ b/apps/web-antd/src/api/infra/file/index.ts @@ -19,7 +19,7 @@ export namespace InfraFileApi { } /** 文件预签名地址 */ - export interface FilePresignedUrlResp { + export interface FilePresignedUrlRespVO { configId: number; // 文件配置编号 uploadUrl: string; // 文件上传 URL url: string; // 文件 URL @@ -27,7 +27,7 @@ export namespace InfraFileApi { } /** 上传文件 */ - export interface FileUploadReq { + export interface FileUploadReqVO { file: globalThis.File; directory?: string; } @@ -52,7 +52,7 @@ export function deleteFileList(ids: number[]) { /** 获取文件预签名地址 */ export function getFilePresignedUrl(name: string, directory?: string) { - return requestClient.get( + return requestClient.get( '/infra/file/presigned-url', { params: { name, directory }, @@ -67,7 +67,7 @@ export function createFile(data: InfraFileApi.File) { /** 上传文件 */ export function uploadFile( - data: InfraFileApi.FileUploadReq, + data: InfraFileApi.FileUploadReqVO, onUploadProgress?: AxiosProgressEvent, ) { // 特殊:由于 upload 内部封装,即使 directory 为 undefined,也会传递给后端 diff --git a/apps/web-antd/src/components/upload/use-upload.ts b/apps/web-antd/src/components/upload/use-upload.ts index ec3b2d58..2f46f9e9 100644 --- a/apps/web-antd/src/components/upload/use-upload.ts +++ b/apps/web-antd/src/components/upload/use-upload.ts @@ -135,7 +135,7 @@ export function getUploadUrl(): string { * @param file 文件 */ function createFile0( - vo: InfraFileApi.FilePresignedUrlResp, + vo: InfraFileApi.FilePresignedUrlRespVO, file: File, ): InfraFileApi.File { const fileVO = { diff --git a/apps/web-ele/src/api/infra/codegen/index.ts b/apps/web-ele/src/api/infra/codegen/index.ts index 5e83caf8..992d41d2 100644 --- a/apps/web-ele/src/api/infra/codegen/index.ts +++ b/apps/web-ele/src/api/infra/codegen/index.ts @@ -112,9 +112,13 @@ export function updateCodegenTable(data: InfraCodegenApi.CodegenUpdateReqVO) { /** 基于数据库的表结构,同步数据库的表和字段定义 */ export function syncCodegenFromDB(tableId: number) { - return requestClient.put('/infra/codegen/sync-from-db', { - params: { tableId }, - }); + return requestClient.put( + '/infra/codegen/sync-from-db', + {}, + { + params: { tableId }, + }, + ); } /** 预览生成代码 */