12345678910111213141516171819202122232425262728293031323334353637 |
- 'use strict';
- const Schema = require('mongoose').Schema;
- const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin');
- // 期信息表
- const classInfo = new Schema({
- class: { type: String, required: false, maxLength: 200 }, // 班级名
- number: { type: String, required: false, maxLength: 200 }, // 人数
- });
- // 批次信息表
- const batchInfo = new Schema({
- batch: { type: String, required: false, maxLength: 200 }, // 批次
- classnum: { type: [ classInfo ], required: false, select: true }, // 班级
- });
- // 全年计划模板表
- const TrainmodelSchema = {
- total: { type: String, required: false, maxLength: 200 }, // 总人数
- day: { type: String, required: false, maxLength: 200 }, // 课程所需天数
- color: { type: [ String ], required: false }, // 默认颜色
- planyearid: { type: String, required: true, maxLength: 200 }, // 大批次id
- planid: { type: String, required: true, maxLength: 200 }, // 计划id
- batchnum: { type: [ batchInfo ], required: false, select: true }, // 默认期下生成的批次数
- stunum: { type: String, required: false, maxLength: 200 }, // 默认每班学生数
- carpnum: { type: String, required: false, maxLength: 200 }, // 默认每辆车的学生数
- };
- const schema = new Schema(TrainmodelSchema, { toJSON: { virtuals: true } });
- schema.index({ id: 1 });
- schema.plugin(metaPlugin);
- module.exports = app => {
- const { mongoose } = app;
- return mongoose.model('Trainmodel', schema, 'trainmodel');
- };
|