student.js 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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. termid: { type: String, required: false, maxLength: 200 }, // 期id
  26. batchid: { type: String, required: false, maxLength: 200 }, // 批次id
  27. classid: { type: String, required: false, maxLength: 200 }, // 班级id
  28. bedroomid: { type: String, required: false, maxLength: 200 }, // 寝室id
  29. bedroom: { type: String, required: false, maxLength: 200 }, // 寝室号
  30. is_fine: { type: String, required: false, maxLength: 200, default: '0' }, // 是否优秀,0-否,1-是,2-无资格
  31. selfscore: { type: String, required: false, maxLength: 200 }, // 个人分
  32. score: { type: String, required: false, maxLength: 200 }, // 总分
  33. }
  34. ;
  35. const schema = new Schema(StudentSchema, { toJSON: { virtuals: true } });
  36. schema.index({ id: 1 });
  37. schema.plugin(metaPlugin);
  38. module.exports = app => {
  39. const { mongoose } = app;
  40. return mongoose.model('Student', schema, 'student');
  41. };