import request from '@/utils/request'

// 查询数据源信息列表
export function listDatasource(query) {
  return request({
    url: '/generator/datasource/list',
    method: 'get',
    params: query
  })
}

// 查询数据源信息列表
export function listDatasourceSelect(query) {
  return request({
    url: '/generator/datasource/select',
    method: 'get',
    params: query
  })
}

// 查询数据源信息详细
export function getDatasource(datasourceId) {
  return request({
    url: '/generator/datasource/' + datasourceId,
    method: 'get'
  })
}

// 新增数据源信息
export function addDatasource(data) {
  return request({
    url: '/generator/datasource',
    method: 'post',
    data: data
  })
}

// 修改数据源信息
export function updateDatasource(data) {
  return request({
    url: '/generator/datasource',
    method: 'put',
    data: data
  })
}

// 删除数据源信息
export function delDatasource(datasourceId) {
  return request({
    url: '/generator/datasource/' + datasourceId,
    method: 'delete'
  })
}

// 测试数据源连接
export function testDatasource(datasourceId) {
  return request({
    url: '/generator/datasource/test/' + datasourceId,
    method: 'get'
  })
}
