import request from '@/utils/request'

// 查询招聘信息列表
export function listStaffRecruitment(query) {
  return request({
    url: '/ccdi/staffRecruitment/list',
    method: 'get',
    params: query
  })
}

// 查询招聘信息详细
export function getStaffRecruitment(id) {
  return request({
    url: '/ccdi/staffRecruitment/' + id,
    method: 'get'
  })
}

// 新增招聘信息
export function addStaffRecruitment(data) {
  return request({
    url: '/ccdi/staffRecruitment',
    method: 'post',
    data: data
  })
}

// 修改招聘信息
export function updateStaffRecruitment(data) {
  return request({
    url: '/ccdi/staffRecruitment',
    method: 'put',
    data: data
  })
}

// 删除招聘信息
export function delStaffRecruitment(ids) {
  return request({
    url: '/ccdi/staffRecruitment/' + ids,
    method: 'delete'
  })
}

// 下载导入模板
export function importTemplate() {
  return request({
    url: '/ccdi/staffRecruitment/importTemplate',
    method: 'post'
  })
}

// 导入招聘信息
export function importData(file) {
  const formData = new FormData()
  formData.append('file', file)
  return request({
    url: '/ccdi/staffRecruitment/importData',
    method: 'post',
    data: formData
  })
}

// 查询导入状态
export function getImportStatus(taskId) {
  return request({
    url: '/ccdi/staffRecruitment/importStatus/' + taskId,
    method: 'get'
  })
}

// 查询导入失败记录
export function getImportFailures(taskId, pageNum, pageSize) {
  return request({
    url: '/ccdi/staffRecruitment/importFailures/' + taskId,
    method: 'get',
    params: { pageNum, pageSize }
  })
}
