'use strict'; const Schema = require('mongoose').Schema; const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin'); const arrange = new Schema({ termid: { type: String, required: false, maxLength: 200 }, // 期id term: { type: String, required: false, maxLength: 200 }, // 期 batchid: { type: String, required: false, maxLength: 200 }, // 批次id batch: { type: String, required: false, maxLength: 200 }, // 批次 number: { type: String, required: false, maxLength: 200 }, // 人数 type: { type: String, required: false, maxLength: 200 }, // 类别 carnum: { type: String, required: false, maxLength: 200 }, // 派车数量 remark: { type: String, required: false }, // 备注 }); // 培训计划学校上报时间表 const SchtimeSchema = { schid: { type: String, required: true, maxLength: 500 }, // 学校id year: { type: String, required: false, maxLength: 200 }, // 年份 planid: { type: String, required: false, maxLength: 200 }, // 培训计划表id remark: { type: String, required: false, maxLength: 500 }, // 备注 daterange: { type: [ String ], required: false, maxLength: 500 }, // 学校可以上课时间 // 此字段不需要暂时先保留 arrange: { type: [ arrange ], select: true }, // 期 }; const schema = new Schema(SchtimeSchema, { toJSON: { virtuals: true } }); schema.index({ id: 1 }); schema.plugin(metaPlugin); module.exports = app => { const { mongoose } = app; return mongoose.model('Schtime', schema, 'schtime'); };