import http from '@/api'
import { ${BusinessName}VO, ${BusinessName}Form, ${BusinessName}Query  } from '@/api/interface/${moduleName}/${businessName}'
/**
 * @name 查询${functionName}列表
 * @param query 参数
 * @returns 返回列表
 */
export const list${BusinessName}Api = (query: ${BusinessName}Query) => {
    return http.get<${BusinessName}VO[]>('/${moduleName}/${businessName}/list', query, { loading: true })
}

/**
 * @name 查询${functionName}详细
 * @param ${pkColumn.javaField} ${pkColumn.javaField}
 * @returns returns
 */
export const get${BusinessName}Api = (${pkColumn.javaField}: string | number) => {
    return http.get<${BusinessName}VO>(`/${moduleName}/${businessName}/${${pkColumn.javaField}}`)
}

/**
 * @name 新增${functionName}
 * @param data data
 * @returns returns
 */
export const add${BusinessName}Api = (data: ${BusinessName}Form) => {
    return http.post<any>('/${moduleName}/${businessName}', data, { loading: false })
}

/**
 * @name 修改${functionName}
 * @param data data
 * @returns returns
 */
export const update${BusinessName}Api = (data: ${BusinessName}Form) => {
    return http.put<any>('/${moduleName}/${businessName}', data, { loading: false })
}

/**
 * @name 删除${functionName}
 * @param ${pkColumn.javaField} ${pkColumn.javaField}
 * @returns returns
 */
export const del${BusinessName}Api = (${pkColumn.javaField}: string | number | Array<string | number>) => {
    return http.delete<any>(`/${moduleName}/${businessName}/${${pkColumn.javaField}}`)
}

/**
 * @name 下载模板
 * @returns returns
 */
export const importTemplateApi = () => {
    return http.downloadPost('/${moduleName}/${businessName}/importTemplate', {})
}

/**
 * @name 导入数据
 * @returns returns
 */
export const import${BusinessName}DataApi = (data: any) => {
    return http.post('/${moduleName}/${businessName}/importData', data)
}

/**
 * @name 导出数据
 * @returns returns
 */
export const export${BusinessName}Api = (data: any) => {
    return http.post('/${moduleName}/${businessName}/export', data)
}
