import request, { queryDict } from "@/utils/request";

/*
 * 分页查询
 */
export const getSysUser = (params) => request("/sysUser", { params });

export const getSysUserDict = queryDict(getSysUser, { labelKey: 'name', valueKey: 'userId' });
/*
 * 新增数据
 */
export const postSysUser = (data) =>
  request("/sysUser", { data, method: "post" });

/*
 * 通过ID查询单条数据
 */
export const getSysUserById = (id) => request(`/sysUser/${id}`);

/*
 * 通过ID查询单条数据
 */
export const currentUser = (params) =>
  request(`/sysUser/current`, { params });

/*
 * 更新数据
 */
export const putSysUser = (id, data) =>
  request(`/sysUser/${id}`, { data, method: "put" });

/*
 * 通过主键删除数据
 */
export const deleteSysUser = (id) =>
  request(`/sysUser/${id}`, { method: "delete" });

/*
 * 更新状态
 */
export const updateUserStatus = (id, status) =>
  request(`/sysUser/${id}/status?status=${status}`, { method: "put" });
