import request from '@/utils/request';

// 获取数据源列表
export const getDataSourceList = (data) => {
  return request({
    url: '/system/designDataSource/list', method: 'get', params: data
  });
};

// 删除数据源
export const delDataSourceApi = (id) => {
  return request({
    url: '/system/designDataSource/' + id, method: 'DELETE'
  });
};

// 新增数据源
export const addDataSourceApi = (data) => {
  return request({
    url: '/system/designDataSource', method: 'POST', data
  });
};

// 编辑数据源
export const editDataSourceApi = (data) => {
  return request({
    url: '/system/designDataSource', method: 'PUT', data
  });
};


// 测试sql连接
export const querySql = (data, db) => {
  return request({
    url: '/system/databaseLink/querySql/' + db, method: 'post', data, headers: { bodyType: 'raw' }
  });
};

// 测试sql连接
export const querySql1 = (data, db) => {
  return request({
    url: '/system/databaseLink/queryPageSql', method: 'post', data
  });
};
