1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- /**
- * 追溯码批次表
- */
- var mongoose = require("./mongodb");
- var Schema = mongoose.Schema;
- var moment=require('moment');
- var productCodeBatchSchema = new Schema(
- {
- ENTERPRISE_CODE:{type:String,default:''},//统一社会信用代码 若是法人责任主体则填写统一社会信用代码,若无统一社会信用代码填写组织机构代码;若是自然人责任主体则填写自然人责任主体身份证号
- ENTERPRISE_NAME:{type:String,default:''},//企业名称
- APPLYTIME:{type: Date,default:Date.now},//申请时间
- BATCH:{type:String, unique: true},//追溯码批次
- NUM:{type:Number},//数量
- Deleted:{type: Number,default:0}//是否已删除 默认0未删除 1已删除
- },{
- strict: true,
- toObject: {
- virtuals: true
- },
- toJSON: {
- virtuals: true
- }
- });
- productCodeBatchSchema.virtual('APPLYTIME2').get(function () {
- if(this.APPLYTIME =="")//判断传入的参数
- {
- return "";
- };
- return moment(this.APPLYTIME).format('YYYY-MM-DD HH:mm:ss');
- });
- productCodeBatchSchema.virtual('useTime2').get(function () {
- if(this.useTime == null)//判断传入的参数
- {
- return "";
- };
- return moment(this.useTime).format('YYYY-MM-DD HH:mm:ss');
- });
- productCodeBatchSchema.virtual('recallTime2').get(function () {
- if(this.recallTime ==null)//判断传入的参数
- {
- return "";
- };
- return moment(this.recallTime).format('YYYY-MM-DD HH:mm:ss');
- });
- var productCodeBatch = mongoose.model('productCodeBatch',
- productCodeBatchSchema,'t_productCodeBatch');
- module.exports = productCodeBatch;
|