import request from '@/utils/request';

export function getList(data) {
  let pram = '?page=' + data.page + '&size=' + data.size;
  if (data.deviceId != '') {
    pram += '&deviceId=' + data.deviceId;
  }
  if (data.sensorName != '') {
    pram += '&sensorName=' + data.sensorName;
  }
  return request({
    url: '/iot/sensor/select' + pram,
    method: 'get',
    data,
  });
}

export function doEdit(data) {
  return request({
    url: '/iot/sensor/update',
    method: 'post',
    data,
  });
}

export function doDelete(data) {
  return request({
    url: '/iot/sensor/remove',
    method: 'post',
    data,
  });
}

export function doAdd(data) {
  return request({
    url: '/iot/sensor/insert',
    method: 'post',
    data,
  });
}
//字典数据获取
export function getDictData(data) {
  return request({
    url: '/iot/sensor/dict',
    method: 'get',
    data,
  });
}
//查询传感器属性列表
export function selectAttribute(data) {
  return request({
    url: '/iot/sensor/selectAttribute',
    method: 'get',
    data,
  });
}

//查询传感器属性为数值时传感点类型列表
export function selectSensorType(data) {
  return request({
    url: '/iot/sensor/selectSensorType',
    method: 'get',
    data,
  });
}

//查询传感器属性为数值时传感点单位列表
export function selectSensorUnit(data) {
  return request({
    url: '/iot/sensor/selectSensorUnit',
    method: 'get',
    data,
  });
}

//查询传感器存储策略列表
export function selectStoreStrategy(data) {
  return request({
    url: '/iot/sensor/selectStoreStrategy',
    method: 'get',
    data,
  });
}

//查询传感器功能码列表
export function selectFunctionCode(data) {
  return request({
    url: '/iot/sensor/selectFunctionCode',
    method: 'get',
    data,
  });
}

//查询传感器数据格式列表
export function selectDataFormat(data) {
  return request({
    url: '/iot/sensor/selectDataFormat',
    method: 'get',
    data,
  });
}

//查询传感器读写权限列表
export function selectReadWrite(data) {
  return request({
    url: '/iot/sensor/selectReadWrite',
    method: 'get',
    data,
  });
}
