import request from '@/utils/request';

// 查询字典数据列表
export function listData(query) {
  return request({
    url: '/system/dictdata/list',
    method: 'get',
    params: query
  });
}

// 查询字典数据详细
export function getData(dictId) {
  return request({
    url: '/system/dictdata/info',
    method: 'get',
    params: { dictId: dictId }
  });
}

// 根据字典类型查询字典数据信息
export function getDataByDatatypeCode(dicttypeCode, dictAvlstatus) {
  return request({
    url: '/system/dictdata/list',
    method: 'get',
    params: {
      dicttypeCode: dicttypeCode,
      dictAvlstatus: dictAvlstatus,
      pageSize: 99999
    }
  });
}

// 新增字典数据
export function addData(data) {
  return request({
    url: '/system/dictdata/add',
    method: 'post',
    data: data
  });
}

// 修改字典数据
export function updateData(data) {
  return request({
    url: '/system/dictdata/edit',
    method: 'post',
    data: data
  });
}

// 删除字典数据
export function delData(dictId) {
  return request({
    url: '/system/dictdata/delete/' + dictId,
    method: 'delete'
  });
}
