import {
  splicingParam,
  get,
  post,
  del,
  postform,
  putform,
  postFile
} from '../utils/request'


// 根据tableName获取内容数据
const getContentListByTableName = (params) => {
  return post(systemConfig.dataUrl + '/content/selectByPage?' + splicingParam(params));
}

// 根据modelId获取内容数据
const getContentListByModelId = (params) => {
  return post(systemConfig.dataUrl + '/content/selectByModelId?' + splicingParam(params));
}

// 根据id获取内容数据
const getContentListById = (params) => {
  return post(systemConfig.dataUrl + '/content/selectById?' + splicingParam(params));
}

// 增加内容
const addSingleData = (params) => {
  return postform(systemConfig.dataUrl + '/content/addContent', params);
}

// 内容更新
const updateSingleData = (params) => {
  return postform(systemConfig.dataUrl + '/content/updateContent', params);
}

// 根据id删除
const delSingleData = (params) => {
  return post(systemConfig.dataUrl + '/content/deleteContent?' + splicingParam(params));
}

// 上传geojson文件
const uploadGeojsonFile = (params) => {
  return postFile(systemConfig.dataUrl + '/content/addDataForGeojson', params);
}

// 上传excel文件
const uploadExcelFile = (params) => {
  return postFile(systemConfig.dataUrl + '/content/addDataForExcel', params);
}

//上传shape文件
const uploadShapeFile = (params) => {
  return postFile(systemConfig.dataUrl + '/content/addDataForShapeZip', params);
}


export default {
  getContentListById,
  getContentListByModelId,
  getContentListByTableName,
  addSingleData,
  delSingleData,
  updateSingleData,
  uploadGeojsonFile,
  uploadExcelFile,
  uploadShapeFile
}
