student.js 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. 'use strict';
  2. const Schema = require('mongoose').Schema;
  3. const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin');
  4. // 学生表
  5. const StudentSchema = {
  6. name: { type: String, required: true, maxLength: 200 }, // 姓名
  7. id_number: { type: String, required: true, maxLength: 200 }, // 身份证号
  8. phone: { type: String, required: true, maxLength: 200 }, // 手机号
  9. gender: { type: String, required: false, maxLength: 200 }, // 性别
  10. nation: { type: String, required: false, maxLength: 200 }, // 民族
  11. school_name: { type: String, required: false, maxLength: 200 }, // 学校名称
  12. schid: { type: String, required: false, maxLength: 200 }, // 学校id
  13. faculty: { type: String, required: false, maxLength: 200 }, // 院系
  14. major: { type: String, required: false, maxLength: 200 }, // 专业
  15. entry_year: { type: String, required: false, maxLength: 200 }, // 入学年份
  16. finish_year: { type: String, required: false, maxLength: 200 }, // 毕业年份
  17. school_job: { type: String, required: false, maxLength: 200 }, // 在校担任何种职务
  18. qq: { type: String, required: false, maxLength: 200 }, // QQ号
  19. email: { type: String, required: false, maxLength: 200 }, // 邮箱
  20. openid: { type: String, required: false, maxLength: 200 }, // 微信openid
  21. family_place: { type: String, required: false, maxLength: 200 }, // 家庭所在地
  22. family_is_hard: { type: String, required: false, maxLength: 200 }, // 家庭是否困难,0-否,1-是
  23. have_grant: { type: String, required: false, maxLength: 200 }, // 是否获得过助学金,0-否,1-是
  24. job: { type: String, required: false, maxLength: 200, default: '普通学生' }, // 职务
  25. planid: { type: String, required: false, maxLength: 200 }, // 计划id
  26. termid: { type: String, required: false, maxLength: 200 }, // 期id
  27. batchid: { type: String, required: false, maxLength: 200 }, // 批次id
  28. classid: { type: String, required: false, maxLength: 200 }, // 班级id
  29. bedroomid: { type: String, required: false, maxLength: 200 }, // 寝室id
  30. bedroom: { type: String, required: false, maxLength: 200 }, // 寝室号
  31. is_fine: { type: String, required: false, maxLength: 200, default: '0' }, // 是否优秀,0-否,1-是,2-无资格
  32. selfscore: { type: String, required: false, maxLength: 200 }, // 个人分
  33. score: { type: String, required: false, maxLength: 200 }, // 总分
  34. }
  35. ;
  36. const schema = new Schema(StudentSchema, { toJSON: { virtuals: true } });
  37. schema.index({ id: 1 });
  38. schema.plugin(metaPlugin);
  39. module.exports = app => {
  40. const { mongoose } = app;
  41. return mongoose.model('Student', schema, 'student');
  42. };