import request from '@/utils/request'

// 创建标识码
export function createCode(data) {
  return request({
    url: '/identity/identity-code/create',
    method: 'post',
    data: data
  })
}

// 更新标识码
export function updateCode(data) {
  return request({
    url: '/identity/identity-code/update',
    method: 'put',
    data: data
  })
}

// 删除标识码
export function deleteCode(id) {
  return request({
    url: '/identity/identity-code/delete?id=' + id,
    method: 'delete'
  })
}

// 获得标识码
export function getCode(id) {
  return request({
    url: '/identity/identity-code/get?id=' + id,
    method: 'get'
  })
}

// 获得标识码分页
export function getCodePage(query) {
  return request({
    url: '/identity/identity-code/page',
    method: 'get',
    params: query
  })
}

// 导出标识码 Excel
export function exportCodeExcel(query) {
  return request({
    url: '/identity/identity-code/export-excel',
    method: 'get',
    params: query,
    responseType: 'blob'
  })
}

export function exportThirdExcel(query) {
  return request({
    url: '/identity/identity-code/export-third-excel',
    method: 'get',
    params: query,
    responseType: 'blob'
  })
}

// 获得标识码列表
export function getCodeList(query) {
  return request({
    url: '/identity/identity-code/list',
    method: 'get',
    params: query,
  })
}

// 根据指定的商户id获取所有标识码信息列表
export function getCodesByBelongBusinessId(params) {
  return request({
    url: '/identity/identity-code/getCodesByBelongBusinessId',
    method: 'get',
    params,
  })
}

// 根据商户ID和identityCode查询对应的标识码信息
export function getCodesByIdentityCode(params) {
  return request({
    url: '/identity/identity-code/getCodesByIdentityCode',
    method: 'get',
    params,
  })
}

// 根据指定的生码记录id获取所有标识码信息列表
export function getCodesByGenerateRecordId(params) {
  return request({
    url: '/identity/identity-code/getCodesByGenerateRecordId',
    method: 'get',
    params,
  })
}

// 导出文字码包
export function exportExcel(params) {
  return request({
    url: '/identity/identity-code/export-excel',
    method: 'get',
    params,
    responseType: 'blob'
  })
}
