teaplan.js 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. 'use strict';
  2. const assert = require('assert');
  3. const _ = require('lodash');
  4. const { ObjectId } = require('mongoose').Types;
  5. const { CrudService } = require('naf-framework-mongoose/lib/service');
  6. const { BusinessError, ErrorCode } = require('naf-core').Error;
  7. class TeaplanService extends CrudService {
  8. constructor(ctx) {
  9. super(ctx, 'teaplan');
  10. this.model = this.ctx.model.Teaplan;
  11. this.hmodel = this.ctx.model.Headteacher;
  12. }
  13. // async findteacher({ batchid }) {
  14. // // 查询所有班主任信息
  15. // const headteachers = await this.hmodel.find();
  16. // const newheadteachers = [];
  17. // // 遍历班主任信息
  18. // for (const headteacher of headteachers) {
  19. // // 查询某班主任对应的班主任全年计划表
  20. // const teaplan = await this.model.findOne({ headteacherid: headteacher.id });
  21. // if (teaplan) {
  22. // const nobatchids = teaplan.nobatchid;
  23. // // 如果有对应的全年计划表并且该计划表中的不能上课的批次包含指定批次,则添加status='0'的标记
  24. // if (nobatchids.includes(batchid)) {
  25. // newheadteachers.push({ ...JSON.parse(JSON.stringify(headteacher)), status: '0' });
  26. // } else {
  27. // newheadteachers.push(headteacher);
  28. // }
  29. // } else {
  30. // newheadteachers.push(headteacher);
  31. // }
  32. // }
  33. // return newheadteachers;
  34. // }
  35. }
  36. module.exports = TeaplanService;