From acbfed81cb94437f38f82c0bc17e6a9f4ac454f4 Mon Sep 17 00:00:00 2001 From: COOL Date: Mon, 1 Jul 2024 15:44:08 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=9B=E5=BB=BAservice?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/base/service/sys/menu.ts | 23 +++++++---------------- 1 file changed, 7 insertions(+), 16 deletions(-) diff --git a/src/modules/base/service/sys/menu.ts b/src/modules/base/service/sys/menu.ts index 3a71eeb..b07d132 100644 --- a/src/modules/base/service/sys/menu.ts +++ b/src/modules/base/service/sys/menu.ts @@ -296,33 +296,24 @@ export class BaseSysMenuService extends BaseService { * @param body body */ async create(body) { - const { module, entity, controller, fileName } = body; + const { module, entity, controller, service, fileName } = body; const basePath = this.app.getBaseDir(); - // const fileName = await this.fileName(controller); + const modulePath = pathUtil.join(basePath, '..', 'src', 'modules', module); // 生成Entity - const entityPath = pathUtil.join( - basePath, - '..', - 'src', - 'modules', - module, - 'entity', - `${fileName}.ts` - ); + const entityPath = pathUtil.join(modulePath, 'entity', `${fileName}.ts`); // 生成Controller const controllerPath = pathUtil.join( - basePath, - '..', - 'src', - 'modules', - module, + modulePath, 'controller', 'admin', `${fileName}.ts` ); + // 生成Service + const servicePath = pathUtil.join(modulePath, 'service', `${fileName}.ts`); this.createConfigFile(module); this.createFile(entityPath, entity); this.createFile(controllerPath, controller); + this.createFile(servicePath, service); } /**