import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { InstitutionMappingVO, InstitutionMappingForm, InstitutionMappingQuery } from '@/api/bfs/institutionMapping/types';

/**
 * 查询机构映射列表
 * @param query
 * @returns {*}
 */

export const listInstitutionMapping = (query?: InstitutionMappingQuery): AxiosPromise<InstitutionMappingVO[]> => {
  return request({
    url: '/bfs/institutionMapping/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询机构映射详细
 * @param id
 */
export const getInstitutionMapping = (id: string | number): AxiosPromise<InstitutionMappingVO> => {
  const data={
    id
  };
  return request({
    url: '/bfs/institutionMapping/getInfo',
    method: 'post',
    data: data
  });
};

/**
 * 新增机构映射
 * @param data
 */
export const addInstitutionMapping = (data: InstitutionMappingForm) => {
  return request({
    url: '/bfs/institutionMapping/add',
    method: 'post',
    data: data
  });
};

/**
 * 修改机构映射
 * @param data
 */
export const updateInstitutionMapping = (data: InstitutionMappingForm) => {
  return request({
    url: '/bfs/institutionMapping/edit',
    method: 'post',
    data: data
  });
};

/**
 * 删除机构映射
 * @param id
 */
export const delInstitutionMapping = (id: string | number | Array<string | number>) => {
  return request({
    url: '/bfs/institutionMapping/remove/' + id,
    method: 'post'
  });
};
