'use strict'; const assert = require('assert'); const _ = require('lodash'); const { ObjectId } = require('mongoose').Types; const { CrudService } = require('naf-framework-mongoose/lib/service'); const { BusinessError, ErrorCode } = require('naf-core').Error; class TrainplanService extends CrudService { constructor(ctx) { super(ctx, 'trainplan'); this.tpmodel = this.ctx.model.Trainplan; this.clamodel = this.ctx.model.Class; } // async create(data) { // const terminfo = await data.termnum; // console.log(terminfo); // const { batchnum: { type, name, number }, term } = terminfo; // console.log(type); // if (type === 1) { // const classdata = { name, number, term, type }; // await this.clamodel.create(classdata); // } // if (type === 0) { // for (let i = 0; i < class; i++) { // const name = '第' + term + '期' + batch + '批次' + i + '班'; // const classdate = { name, number, term, type, newbatch }; // await this.clamodel.create(classdate); // } // } // return this.tpmodel.create(data); // } // } } module.exports = TrainplanService;