123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- 'use strict';
- const Schema = require('mongoose').Schema;
- const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin');
- // 学生表
- const StudentSchema = {
- name: { type: String, required: true, maxLength: 200 }, // 姓名
- id_number: { type: String, required: true, maxLength: 200 }, // 身份证号
- phone: { type: String, required: true, maxLength: 200 }, // 手机号
- gender: { type: String, required: false, maxLength: 200 }, // 性别
- nation: { type: String, required: false, maxLength: 200 }, // 民族
- school_name: { type: String, required: false, maxLength: 200 }, // 学校名称
- schid: { type: String, required: false, maxLength: 200 }, // 学校id
- faculty: { type: String, required: false, maxLength: 200 }, // 院系
- major: { type: String, required: false, maxLength: 200 }, // 专业
- entry_year: { type: String, required: false, maxLength: 200 }, // 入学年份
- finish_year: { type: String, required: false, maxLength: 200 }, // 毕业年份
- school_job: { type: String, required: false, maxLength: 200 }, // 在校担任何种职务
- qq: { type: String, required: false, maxLength: 200 }, // QQ号
- email: { type: String, required: false, maxLength: 200 }, // 邮箱
- openid: { type: String, required: false, maxLength: 200 }, // 微信openid
- family_place: { type: String, required: false, maxLength: 200 }, // 家庭所在地
- family_is_hard: { type: String, required: false, maxLength: 200 }, // 家庭是否困难,0-否,1-是
- have_grant: { type: String, required: false, maxLength: 200 }, // 是否获得过助学金,0-否,1-是
- job: { type: String, required: false, maxLength: 200, default: '普通学生' }, // 职务
- planid: { type: String, required: false, maxLength: 200 }, // 计划id
- termid: { type: String, required: false, maxLength: 200 }, // 期id
- batchid: { type: String, required: false, maxLength: 200 }, // 批次id
- classid: { type: String, required: false, maxLength: 200 }, // 班级id
- bedroomid: { type: String, required: false, maxLength: 200 }, // 寝室id
- bedroom: { type: String, required: false, maxLength: 200 }, // 寝室号
- is_fine: { type: String, required: false, maxLength: 200, default: '0' }, // 是否优秀,0-否,1-是,2-无资格
- selfscore: { type: String, required: false, maxLength: 200 }, // 个人分
- score: { type: String, required: false, maxLength: 200 }, // 总分
- }
- ;
- const schema = new Schema(StudentSchema, { toJSON: { virtuals: true } });
- schema.index({ id: 1 });
- schema.plugin(metaPlugin);
- module.exports = app => {
- const { mongoose } = app;
- return mongoose.model('Student', schema, 'student');
- };
|