lrf 2 роки тому
батько
коміт
9e59cea5a6
1 змінених файлів з 3 додано та 10 видалено
  1. 3 10
      app/public/ts-template.js

+ 3 - 10
app/public/ts-template.js

@@ -44,7 +44,7 @@ const ServiceContext = (data) => {
   fc.push(`import { InjectEntityModel } from '@midwayjs/typegoose';`);
   fc.push(`import { ReturnModelType } from '@typegoose/typegoose';`);
   fc.push(`import { BaseService } from 'free-midway-component';`);
-  fc.push(`import { ${prefix} } from '../entity/${table_name}.entity';`);
+  fc.push(`import { ${prefix} } from '../entity/${_.lowerFirst(table_name)}.entity';`);
   fc.push(`type modelType = ReturnModelType<typeof ${prefix}>;`);
   fc.push(`@Provide()`);
   fc.push(`export class ${prefix}Service extends BaseService<modelType> {`);
@@ -59,10 +59,8 @@ const ControllerContext = (data) => {
   const prefix = _.upperFirst(name);
   fc.push(`import { Body, Controller, Del, Get, Inject, Param, Post, Query } from '@midwayjs/decorator';`);
   fc.push(`import { BaseController } from 'free-midway-component';`);
-  fc.push(`import { ${prefix}Service } from '../service/${name}.service';`);
-  fc.push(
-    `import { CDTO, CVO, FVO,QDTO, QVO, UDTO, UVAO } from '../interface/${name}.interface';`
-  );
+  fc.push(`import { ${prefix}Service } from '../service/${_.lowerFirst(name)}.service';`);
+  fc.push(`import { CDTO, CVO, FVO,QDTO, QVO, UDTO, UVAO } from '../interface/${_.lowerFirst(name)}.interface';`);
   fc.push(`import { ApiResponse, ApiTags, ApiQuery } from '@midwayjs/swagger';`);
   fc.push(`import { Validate } from '@midwayjs/validate';`);
   fc.push(`@ApiTags(['${name_zh}'])`);
@@ -156,11 +154,6 @@ const interfaceContext = (data) => {
   if (have_required) fc.push(`import { FrameworkErrorEnum, SearchBase, ServiceError } from 'free-midway-component';`);
   else fc.push(`import { SearchBase } from 'free-midway-component';`);
   fc.push(`export class FVO {`);
-  fc.push(`  constructor(data: object) {`);
-  fc.push(`    for (const key of Object.keys(this)) {`);
-  fc.push(`      this[key] = _.get(data, key);`);
-  fc.push(`    }`);
-  fc.push(`  }`);
   fc.push(`  @ApiProperty({ description: '数据id' })`);
   fc.push(`  _id: string = undefined;`);
   for (const col of columns) {