diff --git a/.vscode/service.code-snippets b/.vscode/service.code-snippets index 600a96e..4870279 100644 --- a/.vscode/service.code-snippets +++ b/.vscode/service.code-snippets @@ -2,7 +2,7 @@ "service": { "prefix": "service", "body": [ - "import { Provide } from '@midwayjs/decorator';", + "import { Init, Provide } from '@midwayjs/decorator';", "import { BaseService } from '@cool-midway/core';", "import { InjectEntityModel } from '@midwayjs/typeorm';", "import { Repository } from 'typeorm';", @@ -14,6 +14,12 @@ "export class XxxService extends BaseService {", " @InjectEntityModel(实体)", " xxxEntity: Repository<实体>;", + "" + " @Init()" + " async init() {", + " await super.init();", + " this.setEntity(this.xxxEntity);", + " }", "", " /**", " * 描述", @@ -24,4 +30,4 @@ ], "description": "cool-admin service代码片段" } -} +} \ No newline at end of file