123456789101112131415161718192021 |
- 'use strict';
- const Schema = require('mongoose').Schema;
- const moment = require('moment');
- const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin');
- // 行政区划表
- const xzqh = {
- name: { type: String, maxLength: 200 },
- code: { type: String, maxLength: 200 },
- pcode: { type: String, maxLength: 200 },
- disabled: { type: Boolean, default: false }, // false:使用;true:禁用
- remark: { type: String, maxLength: 200 },
- create_time: { type: String, default: moment().format('YYYY-MM-DD HH:mm:ss') },
- };
- const schema = new Schema(xzqh, { toJSON: { virtuals: true } });
- schema.index({ id: 1 });
- schema.index({ 'meta.createdAt': 1 });
- schema.plugin(metaPlugin);
- module.exports = app => {
- const { mongoose } = app;
- return mongoose.model('Xzqh', schema, 'xzqh');
- };
|