feat:【antd】【ele】统一 codegen、file 的 API 参数

This commit is contained in:
YunaiV
2025-09-22 09:59:22 +08:00
parent c9f123be2a
commit 6ca2b0f1ca
4 changed files with 28 additions and 13 deletions

View File

@@ -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<InfraCodegenApi.CodegenPreview[]>(
`/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 },
});
}
/** 获得表定义 */

View File

@@ -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<InfraFileApi.FilePresignedUrlResp>(
return requestClient.get<InfraFileApi.FilePresignedUrlRespVO>(
'/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也会传递给后端

View File

@@ -135,7 +135,7 @@ export function getUploadUrl(): string {
* @param file 文件
*/
function createFile0(
vo: InfraFileApi.FilePresignedUrlResp,
vo: InfraFileApi.FilePresignedUrlRespVO,
file: File,
): InfraFileApi.File {
const fileVO = {

View File

@@ -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 },
},
);
}
/** 预览生成代码 */