import request from '@/utils/request'

//查询数据源列表
export function selectSourceList(data){
  return request({
    url: "/source/source/list",
    method: "POST",
    data:data
  })
}

// //导出
// export function selectSourceExport(data){
//   return request({
//     url: "/source/source/export",
//     method: "POST",
//     data:data
//   })
// }

//新增
export function insertAdd(data){
  return request({
    url: "/source/source/insert",
    method: "post",
    data:data
  })
}


//获取基本信息
export function getInfo(id){
  return request({
    url: "/source/source/"+id,
    method: "get",
  })
}


//测试连接
export function structure(data){
  return request({
    url: "/source/source/structure",
    method: "post",
    data:data
  })
}

//同步资产结构
export function connectionTest(data){
  return request({
    url: "/source/source/connectionTest",
    method: "post",
    data:data
  })
}


//删除
export function deleteSource(ids){
  return request({
    url: "/source/source/"+ids,
    method: "delete",
  })
}


//修改
export function update(data){
  return request({
    url: "/source/source/update",
    method: "post",
    data:data
  })
}


//查询数据库名称 表名称  字段名称 类型等

export function findTableInfo(){
  return request({
    url: "/source/tableInfo/findTableInfo",
    method: "get",
  })
}

export function findTableInfoList(){
  return request({
    url: "/source/tableInfo/findTableInfoList",
    method: "get",
  })
}


export function findTableInfoListAccredit(){
  return request({
    url: "/source/tableInfo/findTableInfoListAccredit",
    method: "get",
  })
}


export function findStructureByTableId(id){
  return request({
    url: "/source/tableInfo/findStruceure/"+id,
    method: "get",
  })
}



export function findTableValueList(basicId,tableName){
  return request({
    url: "/source/DataValue/findTableValueList?basicId="+basicId+"&tableName="+tableName,
    method: "post",
  })
}


export function findAccredit(id){
  return request({
    url: "/source/accredit/findAccredit?tableId="+id,
    method: "get",
  })
}


export function findDeptListStatus(tableId,basicId){
  return request({
    url: "/source/accredit/findDeptListStatus?tableId="+tableId+"&basicId="+basicId,
    method: "get",
  })
}

export function findUserListStatus(tableId,basicId){
  return request({
    url: "/source/accredit/findUserListStatus?tableId="+tableId+"&basicId="+basicId,
    method: "get",
  })
}
export function addMiddle(data){
  return request({
    url: "/source/accredit/addMiddle",
    method: "post",
    data :data
  })
}

export function remove(data){
  return request({
    url: "/source/accredit/remove",
    method: "post",
    data :data
  })
}



