import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { EmsBaseLocationJsonVO, EmsBaseLocationJsonForm, EmsBaseLocationJsonId, EmsBaseLocationJsonIds, EmsBaseLocationJsonQuery } from '@/api/ems\base/emsBaseLocationJson/types';

/**
 * 查询前端电路图使用列表
 * @param query
 * @returns {*}
 */

export const listEmsBaseLocationJson = (query?: EmsBaseLocationJsonQuery): AxiosPromise<EmsBaseLocationJsonVO[]> => {
  return request({
    url: '/ems\base/emsBaseLocationJson/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询前端电路图使用详细
 * @param id
 */
export const getEmsBaseLocationJson = (id: EmsBaseLocationJsonId): AxiosPromise<EmsBaseLocationJsonVO> => {
  return request({
    url: '/ems\base/emsBaseLocationJson/' + id,
    method: 'get'
  });
};

/**
 * 批量查询前端电路图使用详细
 * @param ids
 */
export const getEmsBaseLocationJsonByIds = (ids: EmsBaseLocationJsonIds): AxiosPromise<EmsBaseLocationJsonVO[]> => {
  return request({
    url: '/ems\base/emsBaseLocationJson/listByIds',
    method: 'post',
    data: ids
  });
};

/**
 * 统计前端电路图使用数量
 * @param query
 */
export const countEmsBaseLocationJson = (query?: EmsBaseLocationJsonQuery): AxiosPromise<number> => {
  return request({
    url: '/ems\base/emsBaseLocationJson/count',
    method: 'get',
    params: query
  });
};

/**
 * 判断是否存在符合条件的前端电路图使用
 * @param query
 */
export const existsEmsBaseLocationJson = (query?: EmsBaseLocationJsonQuery): AxiosPromise<boolean> => {
  return request({
    url: '/ems\base/emsBaseLocationJson/exists',
    method: 'get',
    params: query
  });
};

/**
 * 新增前端电路图使用
 * @param data
 */
export const addEmsBaseLocationJson = (data: EmsBaseLocationJsonForm) => {
  return request({
    url: '/ems\base/emsBaseLocationJson',
    method: 'post',
    data: data
  });
};

/**
 * 修改前端电路图使用
 * @param data
 */
export const updateEmsBaseLocationJson = (data: EmsBaseLocationJsonForm) => {
  return request({
    url: '/ems\base/emsBaseLocationJson',
    method: 'put',
    data: data
  });
};

/**
 * 删除前端电路图使用
 * @param id
 */
export const delEmsBaseLocationJson = (id: EmsBaseLocationJsonId | EmsBaseLocationJsonIds) => {
  return request({
    url: '/ems\base/emsBaseLocationJson/' + id,
    method: 'delete'
  });
};
