import request from '@/utils/request'

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

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

// 新增kvt

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

// 修改kvt

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

// 删除kvt

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

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

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

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


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

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

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

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

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


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

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


//权限删除
export function permissionsUserDel(data) {
  return request({
    url: '/source/kvt/permissionsUserDel',
    method: 'post',
    data
  })
}
//查询数据接入
export function selectKvt() {
  return request({
    url: '/source/kvt/selectKvt',
    method: 'post'
  })
}
//查询库名查询表名
export function selectTable(databaseName) {
  return request({
    url: '/source/kvt/selectTable?databaseName=' + databaseName,
    method: 'post'
  })
}
//根据表名查询全部信息
export function selectTableName(tableName) {
  return request({
    url: '/source/kvt/selectTableName?tableName=' + tableName,
    method: 'post'
  })
}

//添加部门以及部门下的子类部门以及用户
export function addDepartment(data) {
  return request({
    url: '/source/kvt/addDepartment',
    method: 'post',
    data
  })
}

export function selectDataAuthorization(databaseName) {
  return request({
    url: '/source/kvt/selectDataAuthorization?databaseName=' + databaseName,
    method: 'post'
  })
}

//查询资产展示的字段名信息
export function selectDataDisplayVal(tableName) {
  return request({
    url: '/source/kvt/selectDataDisplayVal?tableName=' + tableName,
    method: 'post'
  })
}
//查询资产展示的字段名信息
export function selectDataStructureTableName(tableName) {
  return request({
    url: '/source/kvt/selectDataStructureTableName?tableName=' + tableName,
    method: 'post'
  })
}
