config.ts 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. import { get, Result, post, put, deleteRequest } from "../base";
  2. /**
  3. * 分页查询
  4. * @param query .
  5. * @returns .
  6. */
  7. export function queryPage<T>(query?: any): Promise<Result<T>> {
  8. return get("/sys/config/query/page", query);
  9. }
  10. /**
  11. * 列表查询
  12. * @param query .
  13. * @returns .
  14. */
  15. export function queryList<T>(query?: any): Promise<Result<T>> {
  16. return get("/sys/config/query/list", query);
  17. }
  18. /**
  19. * 保存
  20. * @param data .
  21. * @returns .
  22. */
  23. export function save<T>(data?: T): Promise<Result<T>> {
  24. return post("/sys/config/save", data);
  25. }
  26. /**
  27. * 更新
  28. * @param id .
  29. * @param data .
  30. * @returns .
  31. */
  32. export function update<T>(id: string, data?: T): Promise<Result<T>> {
  33. return put(`/sys/config/update/${id}`, {}, data);
  34. }
  35. /**
  36. * 删除
  37. * @param id .
  38. * @returns .
  39. */
  40. export function delByIds<T>(id: string[]): Promise<Result<T>> {
  41. return deleteRequest(`/sys/config/delete`, {}, id);
  42. }
  43. /**
  44. * 刷新缓存
  45. * @param id .
  46. * @returns .
  47. */
  48. export function refreshCache<T>(id: string): Promise<Result<T>> {
  49. return put(`/sys/config/refresh/${id}`, {});
  50. }