mirror of
https://github.com/fastapiadmin/FastapiAdmin.git
synced 2026-10-05 17:27:47 +00:00
feat(module_gencode): 新增代码生成模块并重构示例模块
重构示例模块为代码生成模块,包括新增模型、服务、控制器等核心组件 更新数据库配置从MySQL切换为PostgreSQL并调整相关参数 优化代码生成模板逻辑,移除无用字段和功能 添加PostgreSQL菜单SQL生成测试用例 更新前端API路径和菜单配置 移除旧的示例模块相关代码
This commit is contained in:
@@ -0,0 +1,101 @@
|
||||
import request from "@/utils/request";
|
||||
|
||||
const API_PATH = "/gencode/demo";
|
||||
|
||||
const DemoAPI = {
|
||||
getDemoList(query: DemoPageQuery) {
|
||||
return request<ApiResponse<PageResult<DemoTable[]>>>({
|
||||
url: `${API_PATH}/list`,
|
||||
method: "get",
|
||||
params: query,
|
||||
});
|
||||
},
|
||||
|
||||
getDemoDetail(query: number) {
|
||||
return request<ApiResponse<DemoTable>>({
|
||||
url: `${API_PATH}/detail/${query}`,
|
||||
method: "get",
|
||||
});
|
||||
},
|
||||
|
||||
createDemo(body: DemoForm) {
|
||||
return request<ApiResponse>({
|
||||
url: `${API_PATH}/create`,
|
||||
method: "post",
|
||||
data: body,
|
||||
});
|
||||
},
|
||||
|
||||
updateDemo(id: number, body: DemoForm) {
|
||||
return request<ApiResponse>({
|
||||
url: `${API_PATH}/update/${id}`,
|
||||
method: "put",
|
||||
data: body,
|
||||
});
|
||||
},
|
||||
|
||||
deleteDemo(body: number[]) {
|
||||
return request<ApiResponse>({
|
||||
url: `${API_PATH}/delete`,
|
||||
method: "delete",
|
||||
data: body,
|
||||
});
|
||||
},
|
||||
|
||||
batchDemo(body: BatchType) {
|
||||
return request<ApiResponse>({
|
||||
url: `${API_PATH}/available/setting`,
|
||||
method: "patch",
|
||||
data: body,
|
||||
});
|
||||
},
|
||||
|
||||
exportDemo(body: DemoPageQuery) {
|
||||
return request<Blob>({
|
||||
url: `${API_PATH}/export`,
|
||||
method: "post",
|
||||
data: body,
|
||||
responseType: "blob",
|
||||
});
|
||||
},
|
||||
|
||||
downloadTemplateDemo() {
|
||||
return request<ApiResponse>({
|
||||
url: `${API_PATH}/download/template`,
|
||||
method: "post",
|
||||
responseType: "blob",
|
||||
});
|
||||
},
|
||||
|
||||
importDemo(body: FormData) {
|
||||
return request<ApiResponse>({
|
||||
url: `${API_PATH}/import`,
|
||||
method: "post",
|
||||
data: body,
|
||||
headers: {
|
||||
"Content-Type": "multipart/form-data",
|
||||
},
|
||||
});
|
||||
},
|
||||
};
|
||||
|
||||
export default DemoAPI;
|
||||
|
||||
export interface DemoPageQuery extends PageQuery {
|
||||
name?: string;
|
||||
status?: string;
|
||||
created_time?: string[];
|
||||
updated_time?: string[];
|
||||
created_id?: number;
|
||||
updated_id?: number;
|
||||
}
|
||||
|
||||
export interface DemoTable extends BaseType {
|
||||
name?: string;
|
||||
created_by?: creatorType;
|
||||
updated_by?: updatorType;
|
||||
}
|
||||
|
||||
export interface DemoForm extends BaseFormType {
|
||||
name?: string;
|
||||
}
|
||||
Reference in New Issue
Block a user