import request from '@/utils/request'

// 查询kvt列表
export function listKvt(query) {
  return request({
    url: '/kvt/kvt/list',
    method: 'get',
    params: query
  })
}

// 查询kvt详细
export function getKvt(id) {
  return request({
    url: '/kvt/kvt/' + id,
    method: 'get'
  })
}

// 新增kvt

export function addKvt(data) {
  return request({
    url: '/kvt/kvt',
    method: 'post',
    data: data
  })
}

// 修改kvt

export function updateKvt(data) {
  return request({
    url: '/kvt/kvt/'+data.id,
    method: 'put',
    data: data
  })
}

// 删除kvt

export function delKvt(id) {
  return request({
    url: '/kvt/kvt/' + id,
    method: 'delete'
  })
}
// 测试连接

export function connectionTest(data) {
  return request({
    url: '/kvt/kvt/connectionTest/',
    method: 'post',
    data
  })
}
// 选择数据库
export function dataTypeList() {
  return request({
    url: '/kvt/kvt/dataTypeList/',
    method: 'post'
  })
}

export function selectName(name) {
  return request({
    url: '/kvt/kvt/selectName?name='+ name,
    method: 'post'
  })
}

export function AssetStructureList() {
  return request({
    url: '/kvt/kvt/AssetStructureList',
    method: 'post'
  })
}
export function synchronizationAdd(data) {
  return request({
    url: '/kvt/kvt/synchronizationAdd',
    method: 'post',
    data
  })
}


export function selectDataSource() {
  return request({
    url: '/kvt/kvt/selectDataSource',
    method: 'post'
  })
}
export function selectDepartmen(databaseName) {
  return request({
    url: '/kvt/kvt/selectDepartment?databaseName=' + databaseName,
    method: 'post'
  })
}
export function selectDataStructure(databaseName) {
  return request({
    url: '/kvt/kvt/selectDataStructure?databaseName=' + databaseName+'&name=' + name,
    method: 'post'
  })
}

export function selectDataStur(tableName) {
  return request({
    url: '/kvt/kvt/selectDataStur?tableName=' + tableName,
    method: 'post'
  })
}
export function selectChild(tableName) {
  return request({
    url: '/kvt/kvt/selectChild?tableName='+ tableName,
    method: 'post'
  })
}
export function selectChildAll() {
  return request({
    url: '/kvt/kvt/selectChildAll',
    method: 'post'
  })
}

//查询字典
export function selectDictionaryy(id) {
  return request({
    url: '/kvt/kvt/selectDictionaryy?id='+id,
    method: 'post'
  })
}
//字典添加
export function dictionaryTypeAdd(data) {
  return request({
    url: '/kvt/kvt/dictionaryTypeAdd',
    method: 'post',
    data
  })
}
//字典添加类型
export function dictionTypeAdd(data) {
  return request({
    url: '/kvt/kvt/dictionTypeAdd',
    method: 'post',
    data
  })
}
//查询字典类型
// export function selectDictionaryType() {
//   return request({
//     url: '/kvt/kvt/selectDictionaryType',
//     method: 'post'
//   })
// }
//查询字典类型
export function selectDictionaryTypeId(data) {
  return request({
    url: '/kvt/kvt/selectDictionaryTypeId',
    method: 'post',
    data
  })
}
//修改
export function utilAssetModel(data) {
  return request({
    url: '/kvt/kvt/utilAssetModel',
    method: 'post',
    data
  })
}

//查询数据的总个数
export function overallDataStructure() {
  return request({
    url: '/kvt/kvt/OverallDataStructure',
    method: 'post'
  })
}

//查询资产展示
export function selectDataDisplay() {
  return request({
    url: '/kvt/kvt/selectDataDisplay',
    method: 'post'
  })
}


//查询资产展示
export function selectDataDisplayName(name) {
  return request({
    url: '/kvt/kvt/selectDataDisplayName?name='+name,
    method: 'post'
  })
}

//权限添加
export function permissionsUserAdd(data) {
  return request({
    url: '/kvt/kvt/permissionsUserAdd',
    method: 'post',
    data
  })
}


//权限删除
export function permissionsUserDel(data) {
  return request({
    url: '/kvt/kvt/permissionsUserDel',
    method: 'post',
    data
  })
}

