import request from '@/utils/request'

// 查询实体库列表
export function listEnterpriseBaseInfo(query) {
  return request({
    url: '/ccdi/enterpriseBaseInfo/list',
    method: 'get',
    params: query
  })
}

// 查询实体库详细
export function getEnterpriseBaseInfo(socialCreditCode) {
  return request({
    url: '/ccdi/enterpriseBaseInfo/' + socialCreditCode,
    method: 'get'
  })
}

// 新增实体库
export function addEnterpriseBaseInfo(data) {
  return request({
    url: '/ccdi/enterpriseBaseInfo',
    method: 'post',
    data: data
  })
}

// 修改实体库
export function updateEnterpriseBaseInfo(data) {
  return request({
    url: '/ccdi/enterpriseBaseInfo',
    method: 'put',
    data: data
  })
}

// 删除实体库
export function delEnterpriseBaseInfo(socialCreditCodes) {
  return request({
    url: '/ccdi/enterpriseBaseInfo/' + socialCreditCodes,
    method: 'delete'
  })
}

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

// 导入实体库
export function importData(data) {
  return request({
    url: '/ccdi/enterpriseBaseInfo/importData',
    method: 'post',
    data: data
  })
}

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

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