feat: api 保持统一格式

pull/49/head
xingyu4j 2024-11-26 12:50:19 +08:00
parent 6c40712df4
commit 8e613e8b81
3 changed files with 49 additions and 49 deletions

View File

@ -243,70 +243,70 @@ export namespace CodegenApi {
}
// 查询列表代码生成表定义
export const getCodegenTableList = (dataSourceConfigId: number) => {
export function getCodegenTableList(dataSourceConfigId: number) {
return requestClient.get<CodegenApi.CodegenTableRespVO[]>(
`/infra/codegen/table/list?dataSourceConfigId=${dataSourceConfigId}`,
);
};
}
// 查询列表代码生成表定义
export const getCodegenTablePage = (params: PageParam) => {
export function getCodegenTablePage(params: PageParam) {
return requestClient.get<CodegenApi.CodegenTableRespVO[]>(
'/infra/codegen/table/page',
{ params },
);
};
}
// 查询详情代码生成表定义
export const getCodegenTable = (id: number) => {
export function getCodegenTable(id: number) {
return requestClient.get<CodegenApi.CodegenDetailRespVO>(
`/infra/codegen/detail?tableId=${id}`,
);
};
}
// 新增代码生成表定义
export const createCodegenTable = (data: CodegenApi.CodegenCreateListReqVO) => {
export function createCodegenTable(data: CodegenApi.CodegenCreateListReqVO) {
return requestClient.post('/infra/codegen/create', data);
};
}
// 修改代码生成表定义
export const updateCodegenTable = (data: CodegenApi.CodegenUpdateReqVO) => {
export function updateCodegenTable(data: CodegenApi.CodegenUpdateReqVO) {
return requestClient.put('/infra/codegen/update', data);
};
}
// 基于数据库的表结构,同步数据库的表和字段定义
export const syncCodegenFromDB = (id: number) => {
export function syncCodegenFromDB(id: number) {
return requestClient.put(`/infra/codegen/sync-from-db?tableId=${id}`);
};
}
// 预览生成代码
export const previewCodegen = (id: number) => {
export function previewCodegen(id: number) {
return requestClient.get(`/infra/codegen/preview?tableId=${id}`);
};
}
// 下载生成代码
export const downloadCodegen = (id: number) => {
export function downloadCodegen(id: number) {
return requestClient.download(`/infra/codegen/download?tableId=${id}`);
};
}
// 获得表定义
export const getSchemaTableList = (params: {
export function getSchemaTableList(params: {
comment?: string;
dataSourceConfigId: number;
name?: string;
}) => {
}) {
return requestClient.get<CodegenApi.DatabaseTableRespVO[]>(
'/infra/codegen/db/table/list',
{ params },
);
};
}
// 基于数据库的表结构,创建代码生成器的表定义
export const createCodegenList = (data: CodegenApi.CodegenCreateListReqVO) => {
export function createCodegenList(data: CodegenApi.CodegenCreateListReqVO) {
return requestClient.post('/infra/codegen/create-list', data);
};
}
// 删除代码生成表定义
export const deleteCodegenTable = (id: number) => {
export function deleteCodegenTable(id: number) {
return requestClient.delete(`/infra/codegen/delete?tableId=${id}`);
};
}

View File

@ -18,34 +18,34 @@ export namespace DataSourceConfigApi {
}
}
// 新增数据源配置
export const createDataSourceConfig = (
export function createDataSourceConfig(
data: DataSourceConfigApi.DataSourceConfigSaveReqVO,
) => {
) {
return requestClient.post('/infra/data-source-config/create', data);
};
}
// 修改数据源配置
export const updateDataSourceConfig = (
export function updateDataSourceConfig(
data: DataSourceConfigApi.DataSourceConfigSaveReqVO,
) => {
) {
return requestClient.put('/infra/data-source-config/update', data);
};
}
// 删除数据源配置
export const deleteDataSourceConfig = (id: number) => {
export function deleteDataSourceConfig(id: number) {
return requestClient.delete(`/infra/data-source-config/delete?id=${id}`);
};
}
// 查询数据源配置详情
export const getDataSourceConfig = (id: number) => {
export function getDataSourceConfig(id: number) {
return requestClient.get<DataSourceConfigApi.DataSourceConfigRespVO>(
`/infra/data-source-config/get?id=${id}`,
);
};
}
// 查询数据源配置列表
export const getDataSourceConfigList = () => {
export function getDataSourceConfigList() {
return requestClient.get<DataSourceConfigApi.DataSourceConfigRespVO[]>(
'/infra/data-source-config/list',
);
};
}

View File

@ -54,36 +54,36 @@ export namespace DictDataApi {
}
// 查询字典数据(精简)列表
export const getSimpleDictDataList = () => {
export function getSimpleDictDataList() {
return requestClient.get('/system/dict-data/simple-list');
};
}
// 查询字典数据列表
export const getDictDataPage = (params: PageParam) => {
export function getDictDataPage(params: PageParam) {
return requestClient.get('/system/dict-data/page', { params });
};
}
// 查询字典数据详情
export const getDictData = (id: number) => {
export function getDictData(id: number) {
return requestClient.get(`/system/dict-data/get?id=${id}`);
};
}
// 新增字典数据
export const createDictData = (data: DictDataApi.DictDataSaveReqVO) => {
export function createDictData(data: DictDataApi.DictDataSaveReqVO) {
return requestClient.post('/system/dict-data/create', data);
};
}
// 修改字典数据
export const updateDictData = (data: DictDataApi.DictDataSaveReqVO) => {
export function updateDictData(data: DictDataApi.DictDataSaveReqVO) {
return requestClient.put('/system/dict-data/update', data);
};
}
// 删除字典数据
export const deleteDictData = (id: number) => {
export function deleteDictData(id: number) {
return requestClient.delete(`/system/dict-data/delete?id=${id}`);
};
}
// 导出字典类型数据
export const exportDictData = (params: DictDataApi.DictDataPageReqVO) => {
export function exportDictData(params: DictDataApi.DictDataPageReqVO) {
return requestClient.download('/system/dict-data/export', { params });
};
}