'use strict'; module.exports = app => { const mongoose = app.mongoose; const Schema = mongoose.Schema; const conn = app.mongooseDB.get('etlLocalDB'); // 车辆上报分类信息统计 本地清洗 数据结构 const TVehicleReportInfoSchema = new Schema({ create_date: { type: Number }, // 统计的数据是哪一天的 year: { type: Number }, // 年 统计的数据 month: { type: Number }, // 月 统计的数据 day: { type: Number }, // 日 统计的数据 dateString: { type: String }, // 时间字符串 yyyy-MM-dd start_time: { type: Date }, // 开始统计时间 end_time: { type: Date, default: Date.now }, // 结束统计时间 car: [ { _id: { series_code: { type: String }, // 车系 model_code: { type: String }, // 车型 }, vhl_val_cnt: { type: Number }, // 车况总数量 alarm_cnt: { type: Number }, // 告警总数量 failure_cnt: { type: Number }, // 故障总数量 }, ], }); TVehicleReportInfoSchema.index({ create_date: -1 }); return conn.model('TVehicleReportInfo', TVehicleReportInfoSchema, 'lc_t_vehicle_report_info'); };