|
@@ -0,0 +1,39 @@
|
|
|
+'use strict';
|
|
|
+const Schema = require('mongoose').Schema;
|
|
|
+const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin');
|
|
|
+
|
|
|
+// 批次信息表
|
|
|
+const batchInfo = new Schema({
|
|
|
+ batch: { type: String, required: false, maxLength: 200 }, // 批次
|
|
|
+ class: { type: String, required: false, maxLength: 200 }, // 班级数
|
|
|
+ begindate: { type: String, required: false, maxLength: 200 }, // 开始日期
|
|
|
+ finishdate: { type: String, required: false, maxLength: 200 }, // 结束日期
|
|
|
+ type: { type: String, required: false, maxLength: 200 }, // 类型:0-正常,1-特殊
|
|
|
+ name: { type: String, required: false, maxLength: 200 }, // 名称
|
|
|
+ number: { 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 }, // 批
|
|
|
+});
|
|
|
+
|
|
|
+// 培训计划表
|
|
|
+const TrainplanSchema = {
|
|
|
+ year: { type: String, required: true, maxLength: 200 }, // 年份
|
|
|
+ title: { type: String, required: true, maxLength: 500 }, // 标题
|
|
|
+ status: { type: String, required: false, maxLength: 200 }, // 状态,0-筹备中,1-发布,2-结束
|
|
|
+ termnum: { type: [ termInfo ], 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');
|
|
|
+};
|