From 099f133ee7aebe1472b594739c130edc8c9c8f82 Mon Sep 17 00:00:00 2001 From: cool Date: Fri, 15 Mar 2024 14:13:03 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=88=9D=E5=A7=8B=E5=8C=96?= =?UTF-8?q?=E5=BF=AB=E6=8D=B7=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .vscode/service.code-snippets | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) 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