ny
23 小时以前 282fbc6488f4e8ceb5fda759f963ee88fbf7b999
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import { omit } from 'lodash-es';
 
import { defHttp } from '#/api/request';
 
enum Api {
  Prefix = '/api/system/DataModel',
}
 
// 获取数据库表列表
export function getDataModelList(data) {
  return defHttp.get({ url: `${Api.Prefix}/${data.linkId}/Tables`, data: omit(data, ['linkId']) });
}
// 获取数据库表列表+视图
export function getDataModelListAll(data) {
  return defHttp.get({ url: `${Api.Prefix}/${data.linkId}/TableAll`, data: omit(data, ['linkId']) });
}
// 预览数据库表
export function previewDataModel(data) {
  return defHttp.get({ url: `${Api.Prefix}/${data.linkId}/Table/${data.table}/Preview`, data: omit(data, ['linkId', 'table']) });
}
// 新建数据库表
export function createDataModel(linkId, data) {
  return defHttp.post({ url: `${Api.Prefix}/${linkId}/Table`, data });
}
// 修改数据库表
export function updateDataModel(linkId, data) {
  return defHttp.put({ url: `${Api.Prefix}/${linkId}/Table`, data });
}
// 获取数据库表
export function getDataModelInfo(linkId, table) {
  return defHttp.get({ url: `${Api.Prefix}/${linkId}/Table/${table}` });
}
// 删除数据库表
export function delDataModel(linkId, table) {
  return defHttp.delete({ url: `${Api.Prefix}/${linkId}/Table/${table}` });
}
// 获取数据库表
export function getDataModelFieldList(linkId, table, type = '0') {
  return defHttp.get({ url: `${Api.Prefix}/${linkId}/Tables/${table}/Fields?type=${type}` });
}
//  新增字段
export function addTableFields(linkId, data) {
  return defHttp.put({ url: `${Api.Prefix}/${linkId}/addFields`, data });
}
//  导出数据库表
export function exportTable(linkId, table) {
  return defHttp.get({ url: `${Api.Prefix}/${linkId}/Table/${table}/Actions/Export` });
}