service.code-snippets 812 B

123456789101112131415161718192021222324252627282930313233
  1. {
  2. "service": {
  3. "prefix": "service",
  4. "body": [
  5. "import { Init, Provide } from '@midwayjs/decorator';",
  6. "import { BaseService } from '@cool-midway/core';",
  7. "import { InjectEntityModel } from '@midwayjs/typeorm';",
  8. "import { Repository } from 'typeorm';",
  9. "",
  10. "/**",
  11. " * 描述",
  12. " */",
  13. "@Provide()",
  14. "export class XxxService extends BaseService {",
  15. " @InjectEntityModel(实体)",
  16. " xxxEntity: Repository<实体>;",
  17. ""
  18. " @Init()"
  19. " async init() {",
  20. " await super.init();",
  21. " this.setEntity(this.xxxEntity);",
  22. " }",
  23. "",
  24. " /**",
  25. " * 描述",
  26. " */",
  27. " async xxx() {}",
  28. "}",
  29. ""
  30. ],
  31. "description": "cool-admin service代码片段"
  32. }
  33. }