trainplan.js 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  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 TrainplanService extends CrudService {
  8. constructor(ctx) {
  9. super(ctx, 'trainplan');
  10. this.model = this.ctx.model.Trainplan;
  11. this.clamodel = this.ctx.model.Class;
  12. }
  13. // async create(data) {
  14. // const terminfo = await data.termnum;
  15. // console.log(terminfo);
  16. // const { batchnum: { type, name, number }, term } = terminfo;
  17. // console.log(type);
  18. // if (type === 1) {
  19. // const classdata = { name, number, term, type };
  20. // await this.clamodel.create(classdata);
  21. // }
  22. // if (type === 0) {
  23. // for (let i = 0; i < class; i++) {
  24. // const name = '第' + term + '期' + batch + '批次' + i + '班';
  25. // const classdate = { name, number, term, type, newbatch };
  26. // await this.clamodel.create(classdate);
  27. // }
  28. // }
  29. // return this.tpmodel.create(data);
  30. // }
  31. // }
  32. }
  33. module.exports = TrainplanService;