zs há 8 meses atrás
pai
commit
88812d904a
1 ficheiros alterados com 7 adições e 5 exclusões
  1. 7 5
      src/service/users/incubator.service.ts

+ 7 - 5
src/service/users/incubator.service.ts

@@ -3,7 +3,7 @@ import { InjectEntityModel } from '@midwayjs/typeorm';
 import { Repository, Equal } from 'typeorm';
 import { Incubator } from '../../entity/users/incubator.entity';
 import { BaseServiceV2 } from '../../frame/BaseServiceV2';
-import { get, uniq } from 'lodash';
+import { get, uniq, compact } from 'lodash';
 import { Cirelation } from '../../entity/users/cirelation.entity';
 import { CompanyService } from './company.service';
 import { CompanyYear } from '../../entity/users/companyYear.entity';
@@ -113,11 +113,13 @@ export class IncubatorService extends BaseServiceV2 {
     const companyids = res.map(i => i.company);
     const list = [];
     const { data } = await this.companyService.query({ id: companyids }, {});
-    const nameList = uniq(data.map(i => i.industry));
+    const nameList = compact(uniq(data.map(i => i.industry)));
     for (const val of nameList) {
-      const { total } = await this.companyService.query({ id: companyids, industry: val }, { skip: 0, limit: 1 });
-      const info = { value: total, name: val };
-      list.push(info);
+      if (val) {
+        const { total } = await this.companyService.query({ id: companyids, industry: val }, { skip: 0, limit: 1 });
+        const info = { value: total, name: val };
+        list.push(info);
+      }
     }
     return { nameList, list };
   }