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