/**
 * 项目：-
 * @Author: xiongwei
 * @Date: 2022-06-28 11:50:00
 */

import { defHttp } from '/@/utils/http/axios';
import { BatchOrder, BatchOrderParams, BatchOrderPageResult } from '../model/batchOrder';
const baseApi = '/v1/order/batch-order';

/**
 * 新增
 */
export const add = (entity: BatchOrder) => defHttp.post<BatchOrder>({ url: `${baseApi}/`, data: entity });

/**
 * 更新
 */
export const update = (entity: BatchOrder) => defHttp.put<BatchOrder>({ url: `${baseApi}/`, data: entity });

/**
 * 删除
 */
export const remove = (id: any) => defHttp.delete<Number>({ url: `${baseApi}/${id}` });

/**
 * 分页查询
 */
export const search = (params?: BatchOrderParams) =>
  defHttp.get<BatchOrderPageResult>({ url: `${baseApi}/search`, params });

/**
 * 列表查询
 */
export const all = (params?: BatchOrderParams) => defHttp.get<BatchOrderPageResult>({ url: `${baseApi}/all`, params });

/**
 * 通过主键查询
 */
export const getById = (id: any) => defHttp.get<BatchOrder>({ url: `${baseApi}/${id}` });

/**
 * 单个查询
 */
export const getOne = (params?: BatchOrderParams) => defHttp.get<BatchOrder>({ url: `${baseApi}/one`, params });

/**
 * 批量删除
 */
export const batchRemove = (idList: Array<any>) =>
  defHttp.post<boolean>({ url: `${baseApi}/batch-delete`, data: idList });

/**
 * 批量新增
 */
export const batchAdd = (entityList: Array<BatchOrder>) =>
  defHttp.post<boolean>({ url: `${baseApi}/batch-save`, data: entityList });

/**
 * 批量更新
 */
export const batchUpdate = (entityList: Array<BatchOrder>) =>
  defHttp.post<boolean>({ url: `${baseApi}/batch-update`, data: entityList });

/**
 * 查询数量
 */
export const count = (params?: BatchOrderParams) => defHttp.get<Number>({ url: `${baseApi}/count`, params });

/**
 * 提交
 */
export const submit = (params?: BatchOrder) => defHttp.post<BatchOrder>({ url: `${baseApi}/submit/order`, params });

/**
 * 取消
 */
export const cancel = (params?: BatchOrder) => defHttp.post<BatchOrder>({ url: `${baseApi}/cancel/order`, params });

/**
 * 取消
 */
export const save = (params?: BatchOrder) => defHttp.post<BatchOrder>({ url: `${baseApi}/save/order`, params });
