import request from "@/utils/request";

// 创建查询管理
export function createQueryManage(data) {
  return request({
    url: "/infra/query-manage/create",
    method: "post",
    data: data,
  });
}

// 查询管理－通用查询结果－统合扩展操作下拉数据
export function queryManageExecutecomplexdropdownlist(query) {
  return request({
    url: `/system/common/api/mes/po/querymanagequery/list`,
    method: "POST",
    data: {
      source: "dic",
    },
  });
}

// 更新查询管理
export function updateQueryManage(data) {
  return request({
    url: "/infra/query-manage/update",
    method: "put",
    data: data,
  });
}

// 删除查询管理
export function deleteQueryManage(id) {
  return request({
    url: "/infra/query-manage/delete?id=" + id,
    method: "delete",
  });
}

// 获得查询管理
export function getQueryManage(id) {
  return request({
    url: "/infra/query-manage/get?id=" + id,
    method: "get",
  });
}

// 获得查询管理分页
export function getQueryManagePage(params) {
  return request({
    url: "/infra/query-manage/page",
    method: "get",
    params,
  });
}
// 导出查询管理 Excel
export function exportQueryManageExcel(params) {
  return request({
    url: "/infra/query-manage/export-excel",
    method: "get",
    params,
    responseType: "blob",
  });
}

// 获得查询字段列表
export function getQueryManageColumnListByMasterId(masterId) {
  return request({
    url:
      "/infra/query-manage/query-manage-column/list-by-master-id?masterId=" +
      masterId,
    method: "get",
  });
}

// sql解析
export function getSqlColumn(sql) {
  return request({
    url: "/infra/query-manage/getColumn",
    method: "get",
    params: { sql },
  });
}
// 积木查询
export function loadTableData(params) {
  return request({
    url: "/infra/query-manage/commonQuery",
    method: "post",
    data: params,
  });
}

// 导出
export function exportExcel(params) {
  return request({
    url: "/infra/query-manage/export-excel",
    method: "post",
    data: params,
    responseType: "blob",
  });
}

// 更新table宽度
export function updateWidth(params) {
  return request({
    url: "/infra/query-manage/updateWidth",
    method: "put",
    data: params,
  });
}
