import request from '@/utils/request'

// 创建
export function createCrop(data) {
  return request({
    url: '/farm/crop/create',
    method: 'post',
    data: data
  })
}

// 更新
export function updateCrop(data) {
  return request({
    url: '/farm/crop/update',
    method: 'put',
    data: data
  })
}

// 删除
export function deleteCrop(id) {
  return request({
    url: '/farm/crop/delete?id=' + id,
    method: 'delete'
  })
}

// 获得
export function getCrop(id) {
  return request({
    url: '/farm/crop/get?id=' + id,
    method: 'get'
  })
}

// 获得分页
export function getCropPage(query) {
  return request({
    url: '/farm/crop/page',
    method: 'get',
    params: query
  })
}

// 导出 Excel
export function exportCropExcel(query) {
  return request({
    url: '/farm/crop/export-excel',
    method: 'get',
    params: query,
    responseType: 'blob'
  })
}
