1234567891011121314151617181920212223242526272829303132333435 |
- 'use strict';
- const Schema = require('mongoose').Schema;
- const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin');
- // 考勤信息表
- const attendInfo = new Schema({
- date: { type: String, required: false, maxLength: 200 }, // 日期
- time: { type: String, required: false, maxLength: 200 }, // 时间
- type: { type: String, required: false, maxLength: 10 }, // 考勤类别0、上课考勤 1、寝室考勤
- status: { type: String, required: false, maxLength: 200 }, // 是否签到,0-未签到,1-签到,2-迟到
- });
- // 考勤表
- const AttendanceSchema = {
- planyearid: { type: String, required: false, maxLength: 200 }, // 大批次id
- 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
- schid: { type: String, required: false, maxLength: 200 }, // 学校id
- schname: { type: String, required: false, maxLength: 200 }, // 学校名称
- studentid: { type: String, required: false, maxLength: 200 }, // 学生id
- stuname: { type: String, required: false, maxLength: 200 }, // 学生姓名
- attend: { type: [ attendInfo ], select: true }, // 考勤信息
- };
- const schema = new Schema(AttendanceSchema, { toJSON: { virtuals: true } });
- schema.index({ id: 1 });
- schema.plugin(metaPlugin);
- module.exports = app => {
- const { mongoose } = app;
- return mongoose.model('Attendance', schema, 'attendance');
- };
|