|
@@ -1,10 +1,25 @@
|
|
|
import { Provide } from '@midwayjs/core';
|
|
|
import { InjectEntityModel } from '@midwayjs/typeorm';
|
|
|
-import { Repository } from 'typeorm';
|
|
|
+import { Repository, Equal } from 'typeorm';
|
|
|
import { Journal } from '../../entity/platform/journal.entity';
|
|
|
import { BaseServiceV2 } from '../../frame/BaseServiceV2';
|
|
|
+import { get } from 'lodash';
|
|
|
+import { Notes } from '../../entity/platform/notes.entity';
|
|
|
@Provide()
|
|
|
export class JournalService extends BaseServiceV2 {
|
|
|
@InjectEntityModel(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' });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|