BaseController.ts 611 B

123456789101112131415161718192021222324252627282930313233343536
  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. }