1 changed files with 42 additions and 0 deletions
@ -0,0 +1,42 @@ |
|||
/** |
|||
* 自动生成 API |
|||
* 负责调用后端接口 |
|||
*/ |
|||
|
|||
import { requestClient } from '#/api/request'; |
|||
import { useAppConfig } from '@vben/hooks'; |
|||
|
|||
export namespace {{entity}}Api { |
|||
|
|||
const applicationConfig = useAppConfig(import.meta.env, import.meta.env.PROD); |
|||
console.log('=== 接口域名 ===', applicationConfig.javaURL) |
|||
|
|||
/** |
|||
* 分页查询 |
|||
*/ |
|||
export function page(params: any) { |
|||
return requestClient.post(applicationConfig.javaURL+'/{{table}}/page', { params }); |
|||
} |
|||
|
|||
/** |
|||
* 获取详情 |
|||
*/ |
|||
export function get(id: number) { |
|||
return requestClient.get(applicationConfig.javaURL+'/{{table}}/' + id); |
|||
} |
|||
|
|||
/** |
|||
* 新增 / 修改 |
|||
*/ |
|||
export function save(data: any) { |
|||
return requestClient.post(applicationConfig.javaURL+'/{{table}}', data); |
|||
} |
|||
|
|||
/** |
|||
* 删除 |
|||
*/ |
|||
export function remove(id: number) { |
|||
return requestClient.delete(applicationConfig.javaURL+'/{{table}}/' + id); |
|||
} |
|||
|
|||
} |
|||
Loading…
Reference in new issue