import request from '@/utils/request'

// 查询数据源列表
export function listSource(query) {
  return request({
    url: '/dataSource/source/list',
    method: 'get',
    params: query
  })
}
export function testConnection(data) {
  return request({
    url: '/dataSource/source/testConnection',
    method: 'post',
    data
  })
}
// 查询接入类型列表
export function listType() {
  return request({
    url: '/dataSource/source/findAccessType',
    method: 'get',
  })
}

// 查询数据源详细
export function getSource(id) {
  return request({
    url: '/dataSource/source/' + id,
    method: 'get'
  })
}

// 新增数据源
export function addSource(data) {
  return request({
    url: '/dataSource/source',
    method: 'post',
    data: data
  })
}

// 修改数据源
export function updateSource(data) {
  return request({
    url: '/dataSource/source/'+data.id,
    method: 'put',
    data: data
  })
}
//同步数据库接入
export function Synchronization(data){
  return request({
    url:'/dataSource/source/synchronization',
    method:'post',
    data:data
  })
}

// 删除数据源
export function delSource(id) {
  return request({
    url: '/dataSource/source/' + id,
    method: 'delete'
  })
}

//资产属性列表
export function findAssetStructure(){
  return request({
    url:'/dataSource/source/findAssetStructure',
    method:'get'
  })
}
export function findInformationById(id){
  return request({
    url:'/dataSource/source/findInformationById?id='+id,
    method:'get',
    params:id,
  })
}

export function findDataBaseTableById(id){
  return request({
    url:'dataSource/source/findDataBaseTableById?id='+id,
    method:'get',
    params:id,
  })
}

export function findDataBaseByAssetId(id){
  return request({
    url:'dataSource/source/findDataBaseByAssetId?id='+id,
    method:'get',
    params:id,
  })
}
export function findDataBaseTable(id){
  return request({
    url:'dataSource/source/findDataBaseTable?id='+id,
    method:'get',
    params:id,
  })
}

export function findDataBaseByInformationId(id){
  return request({
    url:'dataSource/source/findDataBaseByInformationId?id='+id,
    method:'get',
    params:id,
  })
}
export function dataBaseTableInformation(){
  return request({
    url:'dataSource/source/dataBaseTableInformation',
    method:'get',
  })
}
