lrf %!s(int64=2) %!d(string=hai) anos
pai
achega
fa0f2c2892
Modificáronse 1 ficheiros con 8 adicións e 2 borrados
  1. 8 2
      app/public/ts-template.js

+ 8 - 2
app/public/ts-template.js

@@ -72,13 +72,19 @@ const ControllerContext = (data) => {
   // create
   fc.push(`@Post('/') @Validate() @ApiResponse({ type: CVO_${name} })`);
   fc.push(`  async create(@Body() data: CDTO_${name}) {`);
-  fc.push(`    const result = await this.service.create(data);`);
+  fc.push(`    const dbData = await this.service.create(data);`);
+  fc.push(`    const result = new CVO_activitys(dbData);`);
   fc.push(`    return result;`);
   fc.push(`  }`);
   // query
   fc.push(`@Get('/')@ApiQuery({name:'query'})@ApiResponse({ type: QVO_${name} })`);
   fc.push(`  async query(@Query() filter:QDTO_${name}, @Query('skip') skip: number,@Query('limit') limit: number){`);
-  fc.push(`    const data = await this.service.query(filter, { skip, limit });`);
+  fc.push(`    const list = await this.service.query(filter, { skip, limit });`);
+  fc.push(`    const data = [];`);
+  fc.push(`    for (const i of list) {`);
+  fc.push(`      const newData = new QVO_activitys(i);`);
+  fc.push(`      data.push(newData);`);
+  fc.push(`    }`);
   fc.push(`    const total = await this.service.count(filter);`);
   fc.push(`    return { data, total };`);
   fc.push(`  }`);