quartz.ts 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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("/monitor/quartz/job/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("/monitor/quartz/job/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("/monitor/quartz/job/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(`/monitor/quartz/job/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(`/monitor/quartz/job/delete`, {}, id);
  42. }
  43. /**
  44. * 检查cron表达式
  45. * @param cron .
  46. * @returns .
  47. */
  48. export function checkCorn<T>(cron: string): Promise<Result<T>> {
  49. return get(`/monitor/quartz/job/check/cron`, { cron: cron });
  50. }
  51. /**
  52. * 启动
  53. * @param id .
  54. * @returns .
  55. */
  56. export function resume<T>(id: string): Promise<Result<T>> {
  57. return put(`/monitor/quartz/job/resume/${id}`);
  58. }
  59. /**
  60. * 立即执行
  61. * @param id .
  62. * @returns .
  63. */
  64. export function execute<T>(id: string): Promise<Result<T>> {
  65. return put(`/monitor/quartz/job/execute/${id}`);
  66. }
  67. /**
  68. * 根据ID删除
  69. * @param id .
  70. * @returns .
  71. */
  72. export function delById<T>(id: string): Promise<Result<T>> {
  73. return deleteRequest(`/monitor/quartz/job/delete`, { id: id }, {});
  74. }