leave.js 1.5 KB

12345678910111213141516171819202122232425262728293031
  1. 'use strict';
  2. const Schema = require('mongoose').Schema;
  3. const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin');
  4. // 请假表
  5. const LeaveSchema = {
  6. batchid: { type: String, required: false, maxLength: 200 }, // 批次
  7. termid: { type: String, required: false, maxLength: 200 }, // 期
  8. schid: { type: String, required: false, maxLength: 200 }, // 学校id
  9. classid: { type: String, required: false, maxLength: 200 }, // 班级id
  10. planid: { type: String, required: false, maxLength: 200 }, // 计划
  11. planyearid: { type: String, required: false, maxLength: 200 }, // 大批次id
  12. studentid: { type: String, required: true, maxLength: 200 }, // 学生id
  13. stuname: { type: String, required: true, maxLength: 200 }, // 学生名称
  14. starttime: { type: String, required: false, maxLength: 200 }, // 开始时间
  15. endtime: { type: String, required: false, maxLength: 500 }, // 结束时间
  16. reason: { type: String, required: false, maxLength: 2000 }, // 请假理由
  17. status: { type: String, required: false, maxLength: 200, default: '0' }, // 状态,0-审核中,1-通过,2-未通过
  18. refcause: { type: String, required: false, maxLength: 2000 }, // 拒绝原因/备注
  19. type: { type: String, required: false, maxLength: 200 }, // 类型,0-请假,1-退出
  20. };
  21. const schema = new Schema(LeaveSchema, { toJSON: { virtuals: true } });
  22. schema.index({ id: 1 });
  23. schema.plugin(metaPlugin);
  24. module.exports = app => {
  25. const { mongoose } = app;
  26. return mongoose.model('Leave', schema, 'leave');
  27. };