1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586 |
- 'use strict';
- const Schema = require('mongoose').Schema;
- const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin');
- // 班级信息表
- const classInfo = new Schema({
- name: { type: String, required: false, maxLength: 200 }, // 名称
- number: { type: String, required: false, maxLength: 200 }, // 人数
- type: { type: String, required: false, maxLength: 200 }, // 类型-0正常,1特殊,2,3创业班
- headteacherid: { type: String, required: false, maxLength: 200 }, // 班主任id
- lessons: { type: [Object], required: false }, // 班级课表 => status:0-未发布; 1-已发布. 与报课有关
- hasclass: { type: String, required: false, maxLength: 200 }, // 是否生成班级: 0未生成;1已生成
- });
- // 批次信息表
- const batchInfo = new Schema({
- batch: { type: String, required: false, maxLength: 200 }, // 批次
- class: { type: [classInfo], required: false, select: true }, // 班级数
- startdate: { type: String, required: false, maxLength: 200 }, // 开始日期
- enddate: { type: String, required: false, maxLength: 200 }, // 结束日期
- lessons: { type: [Object], required: false }, // 课程表,模板的
- // type: { type: String, required: false, maxLength: 200 }, // 类型:0-正常,1-特殊
- // name: { type: String, required: false, maxLength: 200 }, // 名称
- // number: { type: String, required: false, maxLength: 200 }, // 人数
- color: { type: String, required: false, maxLength: 200 }, // 颜色
- reteacher: { type: String, required: false, maxLength: 200 }, // 督导教师
- place: { type: String, required: false, maxLength: 200 }, // 培训场地
- });
- // 学校班级人数信息表
- const classNumInfo = new Schema({
- name: { type: String, required: false, maxLength: 200 }, // 名称
- number: { type: String, required: false, maxLength: 200 }, // 人数
- code: { type: String, required: false, maxLength: 200 }, // 班级code
- });
- // 学校信息表
- const schInfo = new Schema({
- code: { type: String, required: false, maxLength: 200 }, // 学校code
- classnum: { type: [classNumInfo], select: true }, // 班级人数
- num: { type: String, required: false, maxLength: 200 }, // 总人数
- });
- // 期信息表
- const termInfo = new Schema({
- term: { type: String, required: false, maxLength: 200 }, // 期数
- classnum: { type: String, required: false, maxLength: 200 }, // 班级数
- batchnum: { type: [batchInfo], select: true }, // 批
- placereteacher: { type: Object, required: false }, // 场地对应的督导教师: placeid:teacherName(手写)
- reteacher: { type: String, required: false, maxLength: 2000 }, // 督导教师, 根据地点多人所以这里应该有问题
- });
- // 节假日信息表
- const festivalInfo = new Schema({
- begindate: { type: String, required: false, maxLength: 200 }, // 开始日期
- finishdate: { type: String, required: false, maxLength: 200 }, // 结束日期
- name: { type: String, required: false, maxLength: 200 }, // 名称
- });
- // 备注信息表
- const remarkInfo = new Schema({
- month: { type: String, required: false, maxLength: 20 }, // 月份
- class: { type: String, required: false, maxLength: 200 }, // 班级
- number: { type: String, required: false, maxLength: 200 }, // 数量
- });
- // 培训计划表
- const TrainplanSchema = {
- planyearid: { type: String, required: true, maxLength: 200 }, // 大批次id
- year: { type: String, required: true, maxLength: 200 }, // 年份
- title: { type: String, required: true, maxLength: 500 }, // 标题
- status: { type: String, required: false, maxLength: 200, default: '0' }, // 状态,0-筹备中,1-发布,2-结束
- termnum: { type: [termInfo], select: true }, // 期
- remark: { type: [remarkInfo], select: true }, // 备注
- school: { type: [schInfo], select: true }, // 学校
- festivals: { type: [festivalInfo], select: true }, // 节假日
- };
- const schema = new Schema(TrainplanSchema, { toJSON: { virtuals: true } });
- schema.index({ id: 1 });
- schema.plugin(metaPlugin);
- module.exports = (app) => {
- const { mongoose } = app;
- return mongoose.model('Trainplan', schema, 'trainplan');
- };
|