Browse Source

Merge branch 'main' of http://git.cc-lotus.info/Information/cxyy-service

lrf 6 months ago
parent
commit
b70b43dd6b

+ 8 - 1
src/controller/platform/demand.controller.ts

@@ -72,7 +72,14 @@ export class DemandController implements BaseController {
   async list(@Query() query: object) {
   async list(@Query() query: object) {
     const qobj = omit(query, ['skip', 'limit']);
     const qobj = omit(query, ['skip', 'limit']);
     const others = pick(query, ['skip', 'limit']);
     const others = pick(query, ['skip', 'limit']);
-    const { data, total } = await this.service.query(qobj, others, { field: this.service.Opera.In });
+    const { data, total } = await this.service.query(qobj, others, {
+      field: this.service.Opera.In,
+      name: this.service.Opera.Like,
+      company: this.service.Opera.Like,
+      industry: this.service.Opera.In,
+      area: this.service.Opera.Json,
+      tags: this.service.Opera.Json,
+    });
     for (let i of data) {
     for (let i of data) {
       i = await this.serviceUtil.fillOnwer(i);
       i = await this.serviceUtil.fillOnwer(i);
     }
     }

+ 1 - 0
src/controller/platform/journal.controller.ts

@@ -51,6 +51,7 @@ export class JournalController implements BaseController {
   async update(@Param('id') id: number, @Body() data: object) {
   async update(@Param('id') id: number, @Body() data: object) {
     if (!id) throw new ServiceError(ErrorCode.ID_NOT_FOUND);
     if (!id) throw new ServiceError(ErrorCode.ID_NOT_FOUND);
     const result = await this.service.update({ id }, data);
     const result = await this.service.update({ id }, data);
+    await this.service.Notesupdate({ id }, data);
     return result;
     return result;
   }
   }
 
 

+ 16 - 1
src/service/platform/journal.service.ts

@@ -1,10 +1,25 @@
 import { Provide } from '@midwayjs/core';
 import { Provide } from '@midwayjs/core';
 import { InjectEntityModel } from '@midwayjs/typeorm';
 import { InjectEntityModel } from '@midwayjs/typeorm';
-import { Repository } from 'typeorm';
+import { Repository, Equal } from 'typeorm';
 import { Journal } from '../../entity/platform/journal.entity';
 import { Journal } from '../../entity/platform/journal.entity';
 import { BaseServiceV2 } from '../../frame/BaseServiceV2';
 import { BaseServiceV2 } from '../../frame/BaseServiceV2';
+import { get } from 'lodash';
+import { Notes } from '../../entity/platform/notes.entity';
 @Provide()
 @Provide()
 export class JournalService extends BaseServiceV2 {
 export class JournalService extends BaseServiceV2 {
   @InjectEntityModel(Journal)
   @InjectEntityModel(Journal)
   model: Repository<Journal>;
   model: Repository<Journal>;
+
+  @InjectEntityModel(Notes)
+  nModel: Repository<Notes>;
+
+  // 禁用产研行研 同时禁用下属期刊
+  async Notesupdate({ id }, data) {
+    if (get(data, 'is_use')) {
+      const result = await this.nModel.find({ where: { journal: Equal(id) } });
+      for (const val of result) {
+        await this.nModel.update({ id: get(val, 'id') }, { is_use: get(data, 'is_use'), status: '1' });
+      }
+    }
+  }
 }
 }