import request from '@/utils/request'

// 查询修改电子耳号记录列表
export function listChangeEar(query) {
  return request({
    url: '/changeEar/changeEar/list',
    method: 'get',
    params: query
  })
}

// 查询修改电子耳号记录详细
export function getChangeEar(id) {
  return request({
    url: '/changeEar/changeEar/' + id,
    method: 'get'
  })
}

// 新增修改电子耳号记录
export function addChangeEar(data) {
  return request({
    url: '/changeEar/changeEar',
    method: 'post',
    data: data
  })
}

// 修改修改电子耳号记录
export function updateChangeEar(data) {
  return request({
    url: '/changeEar/changeEar',
    method: 'put',
    data: data
  })
}

// 删除修改电子耳号记录
export function delChangeEar(id) {
  return request({
    url: '/changeEar/changeEar/' + id,
    method: 'delete'
  })
}


// 根据羊只ID查询基本信息
export function getSheepById(id) {
  return request({
    url: '/sheep/sheep/' + id,
    method: 'get'
  });
}

//根据耳号（管理耳号或电子耳号）查询羊只信息
export function getSheepByEarNumber(earNumber, earType) {
  return request({
    url: '/sheep/sheep/byEarNumber',
    method: 'get',
    params: { earNumber, earType }
  });
}

//校验新管理/电子耳号
export function checkTagExists(tag, earType) {
  return request({
    url: '/sheep/sheep/existsByTag',
    method: 'get',
    params: { tag, earType }
  });
}