student.js 3.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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, zh: '姓名' }, // 姓名
  7. id_number: { type: String, required: true, maxLength: 200, zh: '身份证号' }, // 身份证号
  8. phone: { type: String, required: true, maxLength: 200, zh: '手机号' }, // 手机号
  9. gender: { type: String, required: false, maxLength: 200, zh: '性别' }, // 性别
  10. nation: { type: String, required: false, maxLength: 200, zh: '民族' }, // 民族
  11. school_name: { type: String, required: false, maxLength: 200, zh: '学校名称' }, // 学校名称
  12. schid: { type: String, required: false, maxLength: 200, zh: '学校id' }, // 学校id
  13. faculty: { type: String, required: false, maxLength: 200, zh: '院系' }, // 院系
  14. major: { type: String, required: false, maxLength: 200, zh: '专业' }, // 专业
  15. edua_level: { type: String, required: false, maxLength: 200, zh: '学历层次' }, // 学历层次
  16. edua_system: { type: String, required: false, maxLength: 200, zh: '学制' }, // 学制
  17. entry_year: { type: String, required: false, maxLength: 200, zh: '入学年份' }, // 入学年份
  18. finish_year: { type: String, required: false, maxLength: 200, zh: '毕业年份' }, // 毕业年份
  19. school_job: { type: String, required: false, maxLength: 200, zh: '在校担任何种职务' }, // 在校担任何种职务
  20. qq: { type: String, required: false, maxLength: 200, zh: 'QQ号' }, // QQ号
  21. email: { type: String, required: false, maxLength: 200, zh: '邮箱' }, // 邮箱
  22. openid: { type: String, required: false, maxLength: 200, zh: '微信openid' }, // 微信openid
  23. family_place: { type: String, required: false, maxLength: 200, zh: '家庭所在地' }, // 家庭所在地
  24. family_is_hard: { type: String, required: false, maxLength: 200, zh: '家庭是否困难' }, // 家庭是否困难,0-否,1-是
  25. have_grant: { type: String, required: false, maxLength: 200, zh: '是否获得过助学金' }, // 是否获得过助学金,0-否,1-是
  26. job: { type: String, required: false, maxLength: 200, default: '普通学生', zh: '职务' }, // 职务
  27. planyearid: { type: String, required: false, maxLength: 200, zh: '大批次id' }, // 大批次id
  28. planid: { type: String, required: false, maxLength: 200, zh: '计划id' }, // 计划id
  29. termid: { type: String, required: false, maxLength: 200, zh: '期id' }, // 期id
  30. batchid: { type: String, required: false, maxLength: 200, zh: '批次id' }, // 批次id
  31. classid: { type: String, required: false, maxLength: 200, zh: '班级id' }, // 班级id
  32. bedroomid: { type: String, required: false, maxLength: 200, zh: '寝室id' }, // 寝室id
  33. bedroom: { type: String, required: false, maxLength: 200, zh: '寝室号' }, // 寝室号
  34. is_fine: { type: String, required: false, maxLength: 200, default: '0', zh: '是否优秀' }, // 是否优秀,0-否,1-是,2-无资格
  35. selfscore: { type: String, required: false, maxLength: 200, zh: '个人分' }, // 个人分
  36. score: { type: String, required: false, maxLength: 200, zh: '总分' }, // 总分
  37. diy: { type: { Object }, required: false, zh: '自定义' }, // 自定义
  38. isComming: { type: String, default: '0', zh: '签到' }, // 是否签到0否,1是
  39. type: { type: String, required: false, maxLength: 200, default: '0' }, // 类型:0-正常,1-特殊
  40. status: { type: String, required: false, maxLength: 200, default: '1' }, // 0:待确定。1:确定,2:失败
  41. };
  42. const schema = new Schema(StudentSchema, { toJSON: { virtuals: true } });
  43. schema.index({ id: 1 });
  44. schema.plugin(metaPlugin);
  45. module.exports = app => {
  46. const { mongoose } = app;
  47. return mongoose.model('Student', schema, 'student');
  48. };