BaseController.ts 839 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. import { Application, Context } from '@midwayjs/koa';
  2. import { App, Inject } from '@midwayjs/decorator';
  3. /**
  4. * controller基类,有一些基础函数需要实现
  5. */
  6. export abstract class BaseController {
  7. @App()
  8. app: Application;
  9. @Inject()
  10. ctx: Context;
  11. /**
  12. * 创建
  13. * @param args
  14. */
  15. abstract create(...args);
  16. /**
  17. * 查询
  18. * @param args
  19. */
  20. abstract query(...args);
  21. /**
  22. * 单查询
  23. * @param args
  24. */
  25. abstract fetch(...args);
  26. /**
  27. * 修改
  28. * @param args
  29. */
  30. abstract update(...args);
  31. /**
  32. * 删除
  33. * @param args
  34. */
  35. abstract delete(...args);
  36. /**
  37. * 多修改
  38. * @param args
  39. */
  40. abstract updateMany(...args);
  41. /**
  42. * 多删除
  43. * @param args
  44. */
  45. abstract deleteMany(...args);
  46. /**
  47. * 多创建
  48. * @param args
  49. */
  50. abstract createMany(...args);
  51. }