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

import { defHttp } from '/@/utils/http/axios';
import { ApiResponse } from '../model/baseModel';
import {
  RoleAuthority,
  RoleAuthorityParams,
  RoleAuthorityPageResult,
  RoleAuthorityPageResponse,
  RoleAuthorityResponse,
} from '../model/roleAuthority';

const baseApi = '/v1/system/role-authority';

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

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

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

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

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

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

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

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

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

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

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


