1234567891011121314151617181920212223242526272829303132 |
- 'use strict';
- const Schema = require('mongoose').Schema;
- const metaPlugin = require('naf-framework-mongoose-free/lib/model/meta-plugin');
- const { ObjectId } = require('mongoose').Types;
- // 审批表
- const examine = {
- order_num: { type: String }, // 审批单号
- personal: { type: String }, // 审批人
- examine_time: { type: String }, // 审批时间
- opinion: { type: String }, // 审批意见
- status: { type: String }, // 审批结果 【0:待审中,1:审核通过,2:审核未通过】
- totalMoney: { type: Number }, // 购买总价
- order: { type: Array }, // 订单数组
- buy_id: { type: ObjectId }, // 购买人id
- buy_name: { type: String }, // 购买人姓名
- remark: { type: String }, //
- };
- const schema = new Schema(examine, { toJSON: { virtuals: true } });
- schema.index({ id: 1 });
- schema.index({ order_num: 1 });
- schema.index({ personal: 1 });
- schema.index({ examine_time: 1 });
- schema.index({ status: 1 });
- schema.index({ totalMoney: 1 });
- schema.index({ buy_id: 1 });
- schema.index({ buy_name: 1 });
- schema.index({ 'meta.createdAt': 1 });
- schema.plugin(metaPlugin);
- module.exports = app => {
- const { mongoose } = app;
- return mongoose.model('Examine', schema, 'examine');
- };
|