zs 8 bulan lalu
induk
melakukan
60a7c48e11

+ 9 - 0
src/controller/users/incubator.controller.ts

@@ -49,6 +49,15 @@ export class IncubatorController implements BaseController {
     return result;
   }
 
+  @Get('/cfield')
+  @ApiTags('列表查询')
+  @ApiQuery({ name: 'query' })
+  @ApiResponse({ type: QVO_incubator })
+  async cfield(@Query() query: object) {
+    const result = await this.service.cfield(query);
+    return result;
+  }
+
   @Get('/allList')
   @ApiTags('列表查询')
   @ApiQuery({ name: 'query' })

+ 13 - 0
src/service/users/incubator.service.ts

@@ -135,6 +135,19 @@ export class IncubatorService extends BaseServiceV2 {
     return { nameList, list };
   }
 
+  // 查询相关领域的企业
+  async cfield(query) {
+    const { industry } = query;
+    const builder = await this.cModel
+      .createQueryBuilder('cirelation')
+      .select(['cirelation.company'])
+      .setFindOptions({ where: { incubator: get(query, 'incubator'), status: get(query, 'status') } });
+    const list = await builder.getMany();
+    const companyids = list.map(i => i.company);
+    const { data, total } = await this.companyService.query({ id: companyids, industry }, {});
+    return { data, total };
+  }
+
   // 孵化器专属企业查询
   async list(query) {
     const { skip = 0, limit = 0, is_tech, is_new, ...info } = query;