refactor(codegen): 代码生成API模板的接口定义方式和文件路径添加模块
This commit is contained in:
@@ -2,36 +2,36 @@ import request from "@/utils/request";
|
||||
|
||||
const ${entityName.toUpperCase()}_BASE_URL = "/api/v1/${lowerFirstEntityName}s";
|
||||
|
||||
class ${entityName}API {
|
||||
const ${entityName}API = {
|
||||
/** 获取${businessName}分页数据 */
|
||||
static getPage(queryParams?: ${entityName}PageQuery) {
|
||||
getPage(queryParams?: ${entityName}PageQuery) {
|
||||
return request<any, PageResult<${entityName}PageVO[]>>({
|
||||
url: `${${entityName.toUpperCase()}_BASE_URL}/page`,
|
||||
method: "get",
|
||||
params: queryParams,
|
||||
});
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 获取${businessName}表单数据
|
||||
*
|
||||
* @param id ${entityName}ID
|
||||
* @returns ${entityName}表单数据
|
||||
*/
|
||||
static getFormData(id: number) {
|
||||
getFormData(id: number) {
|
||||
return request<any, ${entityName}Form>({
|
||||
url: `${${entityName.toUpperCase()}_BASE_URL}/${id}/form`,
|
||||
method: "get",
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
/** 添加${businessName}*/
|
||||
static add(data: ${entityName}Form) {
|
||||
add(data: ${entityName}Form) {
|
||||
return request({
|
||||
url: `${${entityName.toUpperCase()}_BASE_URL}`,
|
||||
method: "post",
|
||||
data: data,
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 更新${businessName}
|
||||
@@ -39,20 +39,20 @@ class ${entityName}API {
|
||||
* @param id ${entityName}ID
|
||||
* @param data ${entityName}表单数据
|
||||
*/
|
||||
static update(id: number, data: ${entityName}Form) {
|
||||
update(id: number, data: ${entityName}Form) {
|
||||
return request({
|
||||
url: `${${entityName.toUpperCase()}_BASE_URL}/${id}`,
|
||||
method: "put",
|
||||
data: data,
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 批量删除${businessName},多个以英文逗号(,)分割
|
||||
*
|
||||
* @param ids ${businessName}ID字符串,多个以英文逗号(,)分割
|
||||
*/
|
||||
static deleteByIds(ids: string) {
|
||||
deleteByIds(ids: string) {
|
||||
return request({
|
||||
url: `${${entityName.toUpperCase()}_BASE_URL}/${ids}`,
|
||||
method: "delete",
|
||||
|
||||
Reference in New Issue
Block a user