mirror of
https://github.com/cool-team-official/cool-admin-midway.git
synced 2024-11-01 22:20:30 +08:00
创建service
This commit is contained in:
parent
4ce452cb76
commit
acbfed81cb
@ -296,33 +296,24 @@ export class BaseSysMenuService extends BaseService {
|
|||||||
* @param body body
|
* @param body body
|
||||||
*/
|
*/
|
||||||
async create(body) {
|
async create(body) {
|
||||||
const { module, entity, controller, fileName } = body;
|
const { module, entity, controller, service, fileName } = body;
|
||||||
const basePath = this.app.getBaseDir();
|
const basePath = this.app.getBaseDir();
|
||||||
// const fileName = await this.fileName(controller);
|
const modulePath = pathUtil.join(basePath, '..', 'src', 'modules', module);
|
||||||
// 生成Entity
|
// 生成Entity
|
||||||
const entityPath = pathUtil.join(
|
const entityPath = pathUtil.join(modulePath, 'entity', `${fileName}.ts`);
|
||||||
basePath,
|
|
||||||
'..',
|
|
||||||
'src',
|
|
||||||
'modules',
|
|
||||||
module,
|
|
||||||
'entity',
|
|
||||||
`${fileName}.ts`
|
|
||||||
);
|
|
||||||
// 生成Controller
|
// 生成Controller
|
||||||
const controllerPath = pathUtil.join(
|
const controllerPath = pathUtil.join(
|
||||||
basePath,
|
modulePath,
|
||||||
'..',
|
|
||||||
'src',
|
|
||||||
'modules',
|
|
||||||
module,
|
|
||||||
'controller',
|
'controller',
|
||||||
'admin',
|
'admin',
|
||||||
`${fileName}.ts`
|
`${fileName}.ts`
|
||||||
);
|
);
|
||||||
|
// 生成Service
|
||||||
|
const servicePath = pathUtil.join(modulePath, 'service', `${fileName}.ts`);
|
||||||
this.createConfigFile(module);
|
this.createConfigFile(module);
|
||||||
this.createFile(entityPath, entity);
|
this.createFile(entityPath, entity);
|
||||||
this.createFile(controllerPath, controller);
|
this.createFile(controllerPath, controller);
|
||||||
|
this.createFile(servicePath, service);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user