'use strict'; const Schema = require('mongoose').Schema; const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin'); // 请假表 const LeaveSchema = { batchid: { type: String, required: false, maxLength: 200 }, // 批次 termid: { type: String, required: false, maxLength: 200 }, // 期 schid: { type: String, required: false, maxLength: 200 }, // 学校id classid: { type: String, required: false, maxLength: 200 }, // 班级id planid: { type: String, required: false, maxLength: 200 }, // 计划 planyearid: { type: String, required: false, maxLength: 200 }, // 大批次id studentid: { type: String, required: true, maxLength: 200 }, // 学生id stuname: { type: String, required: true, maxLength: 200 }, // 学生名称 starttime: { type: String, required: false, maxLength: 200 }, // 开始时间 endtime: { type: String, required: false, maxLength: 500 }, // 结束时间 reason: { type: String, required: false, maxLength: 2000 }, // 请假理由 status: { type: String, required: false, maxLength: 200, default: '0' }, // 状态,0-审核中,1-通过,2-未通过 refcause: { type: String, required: false, maxLength: 2000 }, // 拒绝原因 type: { type: String, required: false, maxLength: 200 }, // 类型,0-请假,1-退出 }; const schema = new Schema(LeaveSchema, { toJSON: { virtuals: true } }); schema.index({ id: 1 }); schema.plugin(metaPlugin); module.exports = app => { const { mongoose } = app; return mongoose.model('Leave', schema, 'leave'); };