增加初始化快捷方式

This commit is contained in:
cool 2024-03-15 14:13:03 +08:00
parent 5bf31344f7
commit 099f133ee7

View File

@ -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代码片段"
}
}
}