import request from '@/utils/request'

// 更新当前数据库表
export function saveTable(tableName,query) {
  return request({
    url: '/system/form/altTable/'+tableName,
    method: 'post',
    data:query
  })
}

export function findList(tableName) {
  return request({
    url: '/system/form/findfield/'+tableName,
    method: 'post',
  })
}

export function getFromList(formdata) {
  return request({
    url: '/system/module/selectTableData/',
    method: 'post',
    data:formdata
  })
}

export function addFromData(tableName,tableMap) {
  return request({
    url: '/system/module/insertTableData/'+tableName,
    method: 'post',
    data:tableMap
  })
}

export function addFrom11(tableName,tableMap) {
  return request({
    url: '/system/module/insertTable/'+tableName,
    method: 'post',
    data:tableMap
  })
}

export function getForm(tableName,id) {
  return request({
    url: '/system/form/selAutoTableById/'+tableName+'/'+id,
    method: 'get',
  })
}

export function delForm(tableName,id) {
  return request({
    url: '/system/module/deleteTableData/'+tableName+'/'+id,
    method: 'post',
  })
}

export function updateForm(tableName,id,data) {
  return request({
    url: '/system/module/updateTableData/'+tableName+'/'+id,
    method: 'post',
    data:data
  })
}

export function getFormRoute() {
  return request({
    url: '/system/module/getFormRoute/',
    method: 'get'
  })
}
