1234567891011121314151617181920212223242526 |
- 'use strict';
- const Schema = require('mongoose').Schema;
- const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin');
- // 人员表
- const StaffSchema = {
- name: { type: String, required: true, maxLength: 200 }, // 姓名
- gender: { type: String, required: true, maxLength: 200 }, // 性别,0-女,1-男
- phone: { type: String, required: false, maxLength: 200 }, // 个人电话
- address: { type: String, required: false, maxLength: 200 }, // 家庭住址
- birthday: { type: String, required: false, maxLength: 200 }, // 出生日期
- id_number: { type: String, required: false, maxLength: 200 }, // 身份证号
- dept_id: { type: String, required: false, maxLength: 200 }, // 部门id
- level_id: { type: String, required: false, maxLength: 200 }, // 职务id
- sort: { type: String, required: false, maxLength: 200 }, // 排序号
- };
- const schema = new Schema(StaffSchema, { toJSON: { virtuals: true } });
- schema.index({ id: 1 });
- schema.plugin(metaPlugin);
- module.exports = app => {
- const { mongoose } = app;
- return mongoose.model('Staff', schema, 'staff');
- };
|