tVehicleReportInfoModel.js 1.1 KB

123456789101112131415161718192021222324252627282930
  1. 'use strict';
  2. module.exports = app => {
  3. const mongoose = app.mongoose;
  4. const Schema = mongoose.Schema;
  5. const conn = app.mongooseDB.get('etlLocalDB');
  6. // 车辆上报分类信息统计 本地清洗 数据结构
  7. const TVehicleReportInfoSchema = new Schema({
  8. create_date: { type: Number }, // 统计的数据是哪一天的
  9. year: { type: Number }, // 年 统计的数据
  10. month: { type: Number }, // 月 统计的数据
  11. day: { type: Number }, // 日 统计的数据
  12. dateString: { type: String }, // 时间字符串 yyyy-MM-dd
  13. start_time: { type: Date }, // 开始统计时间
  14. end_time: { type: Date, default: Date.now }, // 结束统计时间
  15. car: [
  16. {
  17. _id: {
  18. series_code: { type: String }, // 车系
  19. model_code: { type: String }, // 车型
  20. },
  21. vhl_val_cnt: { type: Number }, // 车况总数量
  22. alarm_cnt: { type: Number }, // 告警总数量
  23. failure_cnt: { type: Number }, // 故障总数量
  24. },
  25. ],
  26. });
  27. TVehicleReportInfoSchema.index({ create_date: -1 });
  28. return conn.model('TVehicleReportInfo', TVehicleReportInfoSchema,
  29. 'lc_t_vehicle_report_info');
  30. };