import request from '@/utils/request'

// 创建农场资源
export function createResource(data) {
  return request({
    url: '/farm/resource/create',
    method: 'post',
    data: data
  })
}

// 更新农场资源
export function updateResource(data) {
  return request({
    url: '/farm/resource/update',
    method: 'put',
    data: data
  })
}

// 删除农场资源
export function deleteResource(id) {
  return request({
    url: '/farm/resource/delete?id=' + id,
    method: 'delete'
  })
}

// 获得农场资源
export function getResource(id) {
  return request({
    url: '/farm/resource/get?id=' + id,
    method: 'get'
  })
}

// 获得农场资源分页
export function getResourcePage(query) {
  return request({
    url: '/farm/resource/page',
    method: 'get',
    params: query
  })
}

// 导出农场资源 Excel
export function exportResourceExcel(query) {
  return request({
    url: '/farm/resource/export-excel',
    method: 'get',
    params: query,
    responseType: 'blob'
  })
}
