zs 9 mēneši atpakaļ
vecāks
revīzija
33e0eca409

+ 2 - 0
src/controller/platform/demand.controller.ts

@@ -67,6 +67,7 @@ export class DemandController implements BaseController {
     const result = await this.service.delete({ id });
     return result;
   }
+
   @Get('/list')
   async list(@Query() query: object) {
     const qobj = omit(query, ['skip', 'limit']);
@@ -77,6 +78,7 @@ export class DemandController implements BaseController {
     }
     return { data, total };
   }
+
   @Get('/detail/:id')
   @ApiResponse({ type: FVO_demand })
   async detail(@Param('id') id: string) {

+ 2 - 1
src/frame/BaseServiceV2.ts

@@ -160,7 +160,8 @@ export abstract class BaseServiceV2 {
           params = { [`${valueStr}`]: value };
           break;
         case this.Opera.In:
-          str = `"${key}" IN (:...${valueStr})`;
+          if (!isArray(value)) str = `"${key}" IN (:${valueStr})`;
+          else str = `"${key}" IN (:...${valueStr})`;
           params = { [`${valueStr}`]: value };
           break;
         case this.Opera.IsNull:

+ 45 - 18
src/service/platform/achievement.service.ts

@@ -1,7 +1,7 @@
 import { Achievement } from '../../entity/platform/achievement.entity';
 import { Collection } from '../../entity/platform/collection.entity';
 import { User } from '../../entity/system/user.entity';
-import { get, pick } from 'lodash';
+import { get, isArray } from 'lodash';
 import { Provide } from '@midwayjs/core';
 import { InjectEntityModel } from '@midwayjs/typeorm';
 import { Between, Equal, In, Like, MoreThanOrEqual, Repository } from 'typeorm';
@@ -23,26 +23,53 @@ export class AchievementService extends BaseServiceV2 {
 
   // 多条件查询列表
   async list(query) {
-    const { skip = 0, limit = 0, is_use, status, name, cityList, fieldList, industryList, matureList, moneyList, sellList, ...condition } = query;
+    const { skip = 0, limit = 0, is_use, status, name, area, field, industry, mature, money, sell, ...condition } = query;
     const whereObject: any = condition;
     if (name) whereObject.name = { name: Like(`%${name}%`) };
-    if (industryList) whereObject.industry = In(industryList);
-    if (fieldList) whereObject.field = In(fieldList);
-    if (sellList) whereObject.sell = In(sellList);
-    if (matureList) whereObject.mature = In(matureList);
-    if (cityList) whereObject.area = In(cityList);
-    if (moneyList) {
-      const money = [];
-      for (const val of moneyList) {
-        if (val === '1') money.push(Equal('面议'));
-        if (val === '2') money.push(Between('1', '10'));
-        if (val === '3') money.push(Between('10', '20'));
-        if (val === '4') money.push(Between('20', '100'));
-        if (val === '5') money.push(Between('100', '500'));
-        if (val === '6') money.push(Between('500', '1000'));
-        if (val === '7') money.push(MoreThanOrEqual('1000'));
+    if (industry) {
+      if (!isArray(industry)) whereObject.industry = Equal(industry);
+      else whereObject.industry = In(industry);
+    }
+    if (field) {
+      if (!isArray(field)) whereObject.field = Equal(field);
+      else whereObject.field = In(field);
+    }
+    if (sell) {
+      if (!isArray(sell)) whereObject.sell = Equal(sell);
+      else whereObject.sell = In(sell);
+    }
+    if (mature) {
+      if (!isArray(mature)) whereObject.mature = Equal(mature);
+      else whereObject.mature = In(mature);
+    }
+    if (area) {
+      if (!isArray(area)) whereObject.area = Equal(area);
+      else whereObject.area = In(area);
+    }
+    if (money) {
+      if (!isArray(money)) {
+        let money_title;
+        if (money === '1') money_title = Equal('面议');
+        if (money === '2') money_title = Between('1', '10');
+        if (money === '3') money_title = Between('10', '20');
+        if (money === '4') money_title = Between('20', '100');
+        if (money === '5') money_title = Between('100', '500');
+        if (money === '6') money_title = Between('500', '1000');
+        if (money === '7') money_title = MoreThanOrEqual('1000');
+        whereObject.money = money_title;
+      } else {
+        const moneylist = [];
+        for (const val of money) {
+          if (val === '1') moneylist.push(Equal('面议'));
+          if (val === '2') moneylist.push(Between('1', '10'));
+          if (val === '3') moneylist.push(Between('10', '20'));
+          if (val === '4') moneylist.push(Between('20', '100'));
+          if (val === '5') moneylist.push(Between('100', '500'));
+          if (val === '6') moneylist.push(Between('500', '1000'));
+          if (val === '7') moneylist.push(MoreThanOrEqual('1000'));
+        }
+        whereObject.money = In(moneylist);
       }
-      whereObject.money = In(money);
     }
     const builder = this.model.createQueryBuilder().setFindOptions({ where: whereObject, skip, take: limit });
     const data = await builder.getMany();

+ 14 - 5
src/service/platform/demand.service.ts

@@ -1,7 +1,7 @@
 import { Demand } from '../../entity/platform/demand.entity';
 import { Collection } from '../../entity/platform/collection.entity';
 import { User } from '../../entity/system/user.entity';
-import { get } from 'lodash';
+import { get, isArray } from 'lodash';
 import { Provide } from '@midwayjs/core';
 import { InjectEntityModel } from '@midwayjs/typeorm';
 import { Equal, In, Like, Repository } from 'typeorm';
@@ -22,12 +22,21 @@ export class DemandService extends BaseServiceV2 {
   }
   // 需求列表
   async list(query) {
-    const { skip = 0, limit = 0, name, is_use, status, cityList, fieldList, industryList, ...condition } = query;
+    const { skip = 0, limit = 0, name, is_use, status, area, field, industry, ...condition } = query;
     const whereObject: any = condition;
     if (name) whereObject.name = { name: Like(`%${name}%`) };
-    if (industryList) whereObject.industry = In(industryList);
-    if (fieldList) whereObject.field = In(fieldList);
-    if (cityList) whereObject.area = In(cityList);
+    if (industry) {
+      if (!isArray(industry)) whereObject.industry = Equal(industry);
+      else whereObject.industry = In(industry);
+    }
+    if (field) {
+      if (!isArray(field)) whereObject.field = Equal(field);
+      else whereObject.field = In(field);
+    }
+    if (area) {
+      if (!isArray(area)) whereObject.area = Equal(area);
+      else whereObject.area = In(area);
+    }
     const builder = this.model.createQueryBuilder().setFindOptions({ where: whereObject, skip, take: limit });
     const data = await builder.getMany();
     const total = await builder.getCount();

+ 11 - 4
src/service/platform/footplate.service.ts

@@ -1,8 +1,9 @@
 import { Provide } from '@midwayjs/core';
 import { InjectEntityModel } from '@midwayjs/typeorm';
-import { In, Like, Repository } from 'typeorm';
+import { In, Equal, Like, Repository } from 'typeorm';
 import { Footplate } from '../../entity/platform/footplate.entity';
 import { BaseServiceV2 } from '../../frame/BaseServiceV2';
+import { isArray } from 'lodash';
 @Provide()
 export class FootplateService extends BaseServiceV2 {
   @InjectEntityModel(Footplate)
@@ -10,11 +11,17 @@ export class FootplateService extends BaseServiceV2 {
 
   // 多条件查询列表
   async list(query) {
-    const { skip = 0, limit = 0, name, cityList, industryList, ...condition } = query;
+    const { skip = 0, limit = 0, name, area, industry, ...condition } = query;
     const whereObject: any = condition;
     if (name) whereObject.name = { name: Like(`%${name}%`) };
-    if (industryList) whereObject.industry = In(industryList);
-    if (cityList) whereObject.area = In(cityList);
+    if (industry) {
+      if (!isArray(industry)) whereObject.industry = Equal(industry);
+      else whereObject.industry = In(industry);
+    }
+    if (area) {
+      if (!isArray(area)) whereObject.area = Equal(area);
+      else whereObject.area = In(area);
+    }
     const builder = this.model.createQueryBuilder().setFindOptions({ where: whereObject, skip, take: limit });
     const data = await builder.getMany();
     const total = await builder.getCount();

+ 18 - 6
src/service/platform/project.service.ts

@@ -1,7 +1,7 @@
 import { Project } from '../../entity/platform/project.entity';
 import { Collection } from '../../entity/platform/collection.entity';
 import { User } from '../../entity/system/user.entity';
-import { get } from 'lodash';
+import { get, isArray } from 'lodash';
 import { Provide } from '@midwayjs/core';
 import { InjectEntityModel } from '@midwayjs/typeorm';
 import { Equal, In, Like, Repository } from 'typeorm';
@@ -17,13 +17,25 @@ export class ProjectService extends BaseServiceV2 {
 
   // 多条件查询列表
   async list(query) {
-    const { skip = 0, limit = 0, name, is_use, status, cityList, fieldList, maturityList, industryList, ...condition } = query;
+    const { skip = 0, limit = 0, name, is_use, status, area, field, maturity, industry, ...condition } = query;
     const whereObject: any = condition;
     if (name) whereObject.name = { name: Like(`%${name}%`) };
-    if (industryList) whereObject.industry = In(industryList);
-    if (fieldList) whereObject.field = In(fieldList);
-    if (cityList) whereObject.area = In(cityList);
-    if (maturityList) whereObject.maturity = In(maturityList);
+    if (industry) {
+      if (!isArray(industry)) whereObject.industry = Equal(industry);
+      else whereObject.industry = In(industry);
+    }
+    if (field) {
+      if (!isArray(field)) whereObject.field = Equal(field);
+      else whereObject.field = In(field);
+    }
+    if (area) {
+      if (!isArray(area)) whereObject.area = Equal(area);
+      else whereObject.area = In(area);
+    }
+    if (maturity) {
+      if (!isArray(maturity)) whereObject.maturity = Equal(maturity);
+      else whereObject.maturity = In(maturity);
+    }
     const builder = this.model.createQueryBuilder().setFindOptions({ where: whereObject, skip, take: limit });
     const data = await builder.getMany();
     const total = await builder.getCount();

+ 14 - 5
src/service/platform/supply.service.ts

@@ -1,7 +1,7 @@
 import { Supply } from '../../entity/platform/supply.entity';
 import { Collection } from '../../entity/platform/collection.entity';
 import { User } from '../../entity/system/user.entity';
-import { get, pick } from 'lodash';
+import { get, isArray } from 'lodash';
 import { Provide } from '@midwayjs/core';
 import { InjectEntityModel } from '@midwayjs/typeorm';
 import { Equal, In, Like, Repository } from 'typeorm';
@@ -17,12 +17,21 @@ export class SupplyService extends BaseServiceV2 {
 
   // 多条件查询列表
   async list(query) {
-    const { skip = 0, limit = 0, name, is_use, status, cityList, fieldList, industryList, ...condition } = query;
+    const { skip = 0, limit = 0, name, is_use, status, area, field, industry, ...condition } = query;
     const whereObject: any = condition;
     if (name) whereObject.name = { name: Like(`%${name}%`) };
-    if (industryList) whereObject.industry = In(industryList);
-    if (fieldList) whereObject.field = In(fieldList);
-    if (cityList) whereObject.area = In(cityList);
+    if (industry) {
+      if (!isArray(industry)) whereObject.industry = Equal(industry);
+      else whereObject.industry = In(industry);
+    }
+    if (field) {
+      if (!isArray(field)) whereObject.field = Equal(field);
+      else whereObject.field = In(field);
+    }
+    if (area) {
+      if (!isArray(area)) whereObject.area = Equal(area);
+      else whereObject.area = In(area);
+    }
     const builder = this.model.createQueryBuilder().setFindOptions({ where: whereObject, skip, take: limit });
     const data = await builder.getMany();
     const total = await builder.getCount();

+ 15 - 5
src/service/platform/support.service.ts

@@ -1,8 +1,9 @@
 import { Provide } from '@midwayjs/core';
 import { InjectEntityModel } from '@midwayjs/typeorm';
-import { In, Like, Repository } from 'typeorm';
+import { Equal, In, Like, Repository } from 'typeorm';
 import { Support } from '../../entity/platform/support.entity';
 import { BaseServiceV2 } from '../../frame/BaseServiceV2';
+import { isArray } from 'lodash';
 @Provide()
 export class SupportService extends BaseServiceV2 {
   @InjectEntityModel(Support)
@@ -10,12 +11,21 @@ export class SupportService extends BaseServiceV2 {
 
   // 多条件查询列表
   async list(query) {
-    const { skip = 0, limit = 0, name, cityList, fieldList, industryList, ...condition } = query;
+    const { skip = 0, limit = 0, name, area, field, industry, ...condition } = query;
     const whereObject: any = condition;
     if (name) whereObject.name = { name: Like(`%${name}%`) };
-    if (industryList) whereObject.industry = In(industryList);
-    if (fieldList) whereObject.field = In(fieldList);
-    if (cityList) whereObject.area = In(cityList);
+    if (industry) {
+      if (!isArray(industry)) whereObject.industry = Equal(industry);
+      else whereObject.industry = In(industry);
+    }
+    if (field) {
+      if (!isArray(field)) whereObject.field = Equal(field);
+      else whereObject.field = In(field);
+    }
+    if (area) {
+      if (!isArray(area)) whereObject.area = Equal(area);
+      else whereObject.area = In(area);
+    }
     const builder = this.model.createQueryBuilder().setFindOptions({ where: whereObject, skip, take: limit });
     const data = await builder.getMany();
     const total = await builder.getCount();

+ 14 - 6
src/service/users/company.service.ts

@@ -1,10 +1,9 @@
 import { Provide } from '@midwayjs/core';
 import { InjectEntityModel } from '@midwayjs/typeorm';
 import { Equal, Like, In, Repository } from 'typeorm';
-import { BaseService } from '../../frame/BaseService';
 import { Company } from '../../entity/users/company.entity';
 import { Collection } from '../../entity/platform/collection.entity';
-import { get, pick } from 'lodash';
+import { isArray } from 'lodash';
 import { BaseServiceV2 } from '../../frame/BaseServiceV2';
 @Provide()
 export class CompanyService extends BaseServiceV2 {
@@ -18,12 +17,21 @@ export class CompanyService extends BaseServiceV2 {
 
   // 多条件查询列表
   async list(query) {
-    const { skip = 0, limit = 0, name, is_use, status, cityList, patternList, industryList, ...condition } = query;
+    const { skip = 0, limit = 0, name, is_use, status, area, pattern, industry, ...condition } = query;
     const whereObject: any = condition;
     if (name) whereObject.name = { name: Like(`%${name}%`) };
-    if (industryList) whereObject.industry = In(industryList);
-    if (patternList) whereObject.pattern = In(patternList);
-    if (cityList) whereObject.area = In(cityList);
+    if (industry) {
+      if (!isArray(industry)) whereObject.industry = Equal(industry);
+      else whereObject.industry = In(industry);
+    }
+    if (pattern) {
+      if (!isArray(pattern)) whereObject.pattern = Equal(pattern);
+      else whereObject.pattern = In(pattern);
+    }
+    if (area) {
+      if (!isArray(area)) whereObject.area = Equal(area);
+      else whereObject.area = In(area);
+    }
     const builder = this.model.createQueryBuilder().setFindOptions({ where: whereObject, skip, take: limit });
     const data = await builder.getMany();
     const total = await builder.getCount();

+ 15 - 6
src/service/users/expert.service.ts

@@ -3,12 +3,12 @@ import { InjectEntityModel } from '@midwayjs/typeorm';
 import { Equal, In, Like, Repository } from 'typeorm';
 import { Collection } from '../../entity/platform/collection.entity';
 import { Expert } from '../../entity/users/expert.entity';
-import { get, pick } from 'lodash';
+import { isArray } from 'lodash';
 import { BaseServiceV2 } from '../../frame/BaseServiceV2';
 @Provide()
 export class ExpertService extends BaseServiceV2 {
   getQueryColumnsOpera(): object {
-    return {}
+    return {};
   }
   @InjectEntityModel(Expert)
   model: Repository<Expert>;
@@ -18,12 +18,21 @@ export class ExpertService extends BaseServiceV2 {
 
   // 多条件查询列表
   async list(query) {
-    const { skip = 0, limit = 0, name, is_use, status, cityList, fieldList, industryList, ...condition } = query;
+    const { skip = 0, limit = 0, name, is_use, status, area, field, industry, ...condition } = query;
     const whereObject: any = condition;
     if (name) whereObject.name = { name: Like(`%${name}%`) };
-    if (industryList) whereObject.industry = In(industryList);
-    if (fieldList) whereObject.field = In(fieldList);
-    if (cityList) whereObject.area = In(cityList);
+    if (industry) {
+      if (!isArray(industry)) whereObject.industry = Equal(industry);
+      else whereObject.industry = In(industry);
+    }
+    if (field) {
+      if (!isArray(field)) whereObject.field = Equal(field);
+      else whereObject.field = In(field);
+    }
+    if (area) {
+      if (!isArray(area)) whereObject.area = Equal(area);
+      else whereObject.area = In(area);
+    }
     const builder = this.model.createQueryBuilder().setFindOptions({ where: whereObject, skip, take: limit });
     const data = await builder.getMany();
     const total = await builder.getCount();