| | |
| | | `task_ratio` decimal(5,4) DEFAULT 0.0000 COMMENT '任务里程占比(0-1)', |
| | | `gps_point_count` int(11) DEFAULT 0 COMMENT 'GPS点数量', |
| | | `task_count` int(11) DEFAULT 0 COMMENT '任务数量', |
| | | `segment_count` int(11) DEFAULT 0 COMMENT '关联的分段数量', |
| | | `data_source` varchar(20) DEFAULT 'gps' COMMENT '数据来源(segment-从分段汇总,gps-直接计算)', |
| | | `create_time` datetime DEFAULT NULL COMMENT '创建时间', |
| | | `update_time` datetime DEFAULT NULL COMMENT '更新时间', |
| | | PRIMARY KEY (`stats_id`), |
| | |
| | | KEY `idx_vehicle_id` (`vehicle_id`), |
| | | KEY `idx_stat_date` (`stat_date`) |
| | | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='车辆里程统计表'; |
| | | |
| | | -- 车辆里程统计明细表(可选,用于调试和追溯) |
| | | CREATE TABLE `tb_vehicle_mileage_detail` ( |
| | | `detail_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '明细ID', |
| | | `stats_id` bigint(20) NOT NULL COMMENT '统计ID', |
| | | `vehicle_id` bigint(20) NOT NULL COMMENT '车辆ID', |
| | | `segment_start_time` datetime NOT NULL COMMENT '段起始时间', |
| | | `segment_end_time` datetime NOT NULL COMMENT '段结束时间', |
| | | `start_longitude` decimal(10,7) DEFAULT NULL COMMENT '起点经度', |
| | | `start_latitude` decimal(10,7) DEFAULT NULL COMMENT '起点纬度', |
| | | `end_longitude` decimal(10,7) DEFAULT NULL COMMENT '终点经度', |
| | | `end_latitude` decimal(10,7) DEFAULT NULL COMMENT '终点纬度', |
| | | `segment_distance` decimal(10,3) DEFAULT 0.000 COMMENT '段距离(公里)', |
| | | `task_distance` decimal(10,3) DEFAULT 0.000 COMMENT '任务内距离(公里)', |
| | | `non_task_distance` decimal(10,3) DEFAULT 0.000 COMMENT '任务外距离(公里)', |
| | | `is_in_task` tinyint(1) DEFAULT 0 COMMENT '是否完全在任务时段内(0-否,1-是,2-部分)', |
| | | `create_time` datetime DEFAULT NULL COMMENT '创建时间', |
| | | PRIMARY KEY (`detail_id`), |
| | | KEY `idx_stats_id` (`stats_id`), |
| | | KEY `idx_vehicle_id` (`vehicle_id`) |
| | | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='车辆里程统计明细表'; |