CREATE TABLE `run_plan_routing` (
	`id` BIGINT(20) NOT NULL AUTO_INCREMENT,
	`map_id` BIGINT(20) NOT NULL COMMENT '地图ID',
	`user_id` BIGINT(20) NOT NULL,
	`name` VARCHAR(64) NOT NULL COMMENT '名称' COLLATE 'utf8_general_ci',
	`code` VARCHAR(32) NOT NULL COMMENT '编号' COLLATE 'utf8_general_ci',
	`type` VARCHAR(32) NOT NULL COMMENT '交路类型',
	`start_station_code` VARCHAR(32) NOT NULL COMMENT '起始车站' COLLATE 'utf8_general_ci',
	`start_section_code` VARCHAR(32) NOT NULL COMMENT '起始站台' COLLATE 'utf8_general_ci',
	`end_station_code` VARCHAR(32) NOT NULL COMMENT '终点车站' COLLATE 'utf8_general_ci',
	`end_section_code` VARCHAR(32) NOT NULL COMMENT '终点站台' COLLATE 'utf8_general_ci',
	`right` TINYINT(1) NULL DEFAULT '0' COMMENT '左右行方向',
	`destination_code` VARCHAR(45) NULL DEFAULT NULL COMMENT '目的地码' COLLATE 'utf8_general_ci',
	`remarks` VARCHAR(512) NULL DEFAULT NULL COMMENT '描述' COLLATE 'utf8_general_ci',
	`section_data` LONGTEXT NOT NULL COMMENT '区段数据' COLLATE 'utf8_general_ci',
	PRIMARY KEY (`id`),
	INDEX `map_id_user_id` (`map_id`, `user_id`)
)
COMMENT='运行图用户交路'
COLLATE='utf8_general_ci'
ENGINE=InnoDB
;
CREATE TABLE `run_plan_runlevel` (
	`id` BIGINT(20) NOT NULL AUTO_INCREMENT,
	`map_id` BIGINT(20) NOT NULL COMMENT '地图id',
	`user_id` BIGINT(20) NOT NULL COMMENT '用户id',
	`start_station_code` VARCHAR(32) NOT NULL COMMENT '起始车站' COLLATE 'utf8_general_ci',
	`start_section_code` VARCHAR(32) NOT NULL COMMENT '起始站台' COLLATE 'utf8_general_ci',
	`end_station_code` VARCHAR(32) NOT NULL COMMENT '终点车站' COLLATE 'utf8_general_ci',
	`end_section_code` VARCHAR(32) NOT NULL COMMENT '终点站台' COLLATE 'utf8_general_ci',
	`right` TINYINT(1) NOT NULL COMMENT '方向',
	`distance` FLOAT NOT NULL COMMENT '距离（米）',
	`level1` INT(11) NOT NULL COMMENT '等级一（s）',
	`level2` INT(11) NOT NULL COMMENT '等级二（s）',
	`level3` INT(11) NOT NULL COMMENT '等级三（s）',
	`level4` INT(11) NOT NULL COMMENT '等级四（s）',
	`level5` INT(11) NOT NULL COMMENT '等级五（s）',
	PRIMARY KEY (`id`),
	INDEX `map_id_user_id` (`map_id`, `user_id`)
)
COMMENT='运行图用户站间运行等级'
COLLATE='utf8_general_ci'
ENGINE=InnoDB
;
CREATE TABLE `run_plan_parktime` (
	`id` BIGINT(20) NOT NULL AUTO_INCREMENT,
	`map_id` BIGINT(20) NOT NULL COMMENT '所属地图id',
	`user_id` BIGINT(20) NOT NULL COMMENT '用户id',
	`station_code` VARCHAR(32) NOT NULL COMMENT '车站code' COLLATE 'utf8_general_ci',
	`section_code` VARCHAR(32) NOT NULL COMMENT '区段code' COLLATE 'utf8_general_ci',
	`parking_time` INT(11) NOT NULL DEFAULT '30' COMMENT '停站时间s',
	PRIMARY KEY (`id`),
	INDEX `map_id_user_id` (`map_id`, `user_id`)
)
COMMENT='运行图用户车站停站时间'
COLLATE='utf8_general_ci'
ENGINE=InnoDB
;
CREATE TABLE `run_plan_user_config` (
	`id` BIGINT(20) NOT NULL AUTO_INCREMENT,
	`map_id` BIGINT(20) NOT NULL COMMENT '所属地图id',
	`user_id` BIGINT(20) NOT NULL COMMENT '用户id',
	`config` LONGTEXT NOT NULL COMMENT '折返车站code' COLLATE 'utf8_general_ci',
	PRIMARY KEY (`id`),
	INDEX `map_id_user_id` (`map_id`, `user_id`)
)
COMMENT='运行图用户配置数据'
COLLATE='utf8_general_ci'
ENGINE=InnoDB
;


