/*
 Navicat Premium Data Transfer

 Source Server         : 组
 Source Server Type    : MySQL
 Source Server Version : 80401
 Source Host           : 47.101.53.251:3306
 Source Schema         : saas

 Target Server Type    : MySQL
 Target Server Version : 80401
 File Encoding         : 65001

 Date: 04/10/2024 16:01:07
*/

SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;

-- ----------------------------
-- Table structure for car_type
-- ----------------------------
DROP TABLE IF EXISTS `car_type`;
CREATE TABLE `car_type`  (
  `id` int NOT NULL AUTO_INCREMENT COMMENT '车辆类型Id',
  `type_name` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '车辆类型',
  `template_id` int NULL DEFAULT NULL COMMENT '报文模版Id',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 4 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '车辆类型' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for data_type
-- ----------------------------
DROP TABLE IF EXISTS `data_type`;
CREATE TABLE `data_type`  (
  `data_type_id` int NOT NULL AUTO_INCREMENT COMMENT '报文数据类型Id',
  `data_type_name` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '报文数据类型',
  PRIMARY KEY (`data_type_id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 3 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '报文数据类型' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for electronic_fence
-- ----------------------------
DROP TABLE IF EXISTS `electronic_fence`;
CREATE TABLE `electronic_fence`  (
  `id` int NOT NULL AUTO_INCREMENT COMMENT '围栏主键',
  `name` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '围栏名称',
  `fence_type` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '围栏类型（驶入，驶出）',
  `longitude_latitude` text CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL COMMENT '经纬度信息',
  `status` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '电子围栏状态（正常，停用）',
  `fence_desc` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '描述信息',
  `create_by` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '创建人',
  `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
  `update_by` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '更新人',
  `update_time` datetime NULL DEFAULT NULL COMMENT '更新时间',
  `remark` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '备注',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 11 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin COMMENT = '电子围栏' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- Table structure for electronic_fence_group
-- ----------------------------
DROP TABLE IF EXISTS `electronic_fence_group`;
CREATE TABLE `electronic_fence_group`  (
  `id` int NOT NULL AUTO_INCREMENT COMMENT '自增主键',
  `group_name` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '围栏组名称',
  `group_type` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '围栏组类型',
  `priority` int NULL DEFAULT NULL COMMENT '围栏组优先级(0-99)',
  `status` varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '启用状态',
  `create_by` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '创建人',
  `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
  `update_by` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '更新人',
  `update_time` datetime NULL DEFAULT NULL COMMENT '更新时间',
  `remark` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '备注',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 11 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin COMMENT = '围栏组' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- Table structure for fence_group_mid
-- ----------------------------
DROP TABLE IF EXISTS `fence_group_mid`;
CREATE TABLE `fence_group_mid`  (
  `id` int NOT NULL AUTO_INCREMENT,
  `group_id` int NULL DEFAULT NULL COMMENT '围栏组外键',
  `fence_id` int NULL DEFAULT NULL COMMENT '电子围栏外键',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 23 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '电子围栏-围栏组（中间表）' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- Table structure for message_template
-- ----------------------------
DROP TABLE IF EXISTS `message_template`;
CREATE TABLE `message_template`  (
  `message_id` int(10) UNSIGNED ZEROFILL NOT NULL AUTO_INCREMENT,
  `vin_code` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT 'VIN 码',
  `time_stamp` datetime NULL DEFAULT NULL COMMENT '时间戳',
  `long_itude` double NULL DEFAULT NULL COMMENT '经度',
  `latitude` double NULL DEFAULT NULL COMMENT '纬度',
  `speed_vehicle` double NULL DEFAULT NULL COMMENT '车速',
  `total_mileage` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '总里程',
  `total_voltage` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '总电压',
  `combined_current` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '总电流',
  `insulation_resistance` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '绝缘电阻',
  `gear_position` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '档位',
  `accelerator_pedal_travel_value` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '加速踏板行程值',
  `brake_pedal_travel_value` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '制动踏板行程值',
  `specific_fuel_consumption` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '燃料消耗率',
  `motor_controller_temperature` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '电机控制器温度',
  `motor_speed` double NULL DEFAULT NULL COMMENT '电机转速',
  `motor_torque` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '电机转矩',
  `motor_temperature` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '电机温度',
  `motor_voltage` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '电机电压',
  `motor_current` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '电机电流',
  `power_battery_remaining_soc` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '剩余电池电量',
  `maximum_feedback_power` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '最大反馈功率',
  `maximum_discharge_power` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '最大放电功率',
  `bms_self_check_counter` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT 'BMS自检计数器',
  `power_battery` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '动力电池',
  `total_voltage_load_side` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '总电压负载侧',
  `maximum_voltage` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '最大电压',
  `minimum_voltage` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '最小电压',
  `maximum_temperature` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '最高温度',
  `minimum_temperature` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '最低温度',
  `available_capacity` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '可用功率',
  `vehicle_status` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '车辆状态',
  `charging_state` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '充电状态',
  `operational_status` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '行驶状态',
  `soc` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '单芯片系统',
  `energy_storage_devices` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '能源存储设备',
  `drive_motor_condition` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '驱动电机转态',
  `whether_works` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '是否有效',
  `eas` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '电子防窃系统',
  `ptc` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '正常温度系数',
  `eps` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '蓄电池',
  `abs` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '防抱死制动系统',
  `mcu` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '单片机',
  `heating_state` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '加热状态',
  `power_battery_status` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT '' COMMENT '电源电池状态',
  `state_battery_insulation` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '状态电池绝缘',
  `dcdc` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '直流直流变换器',
  `chg` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '变化',
  `check_digit` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '校验数位',
  `cutoff_bit` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '截止点',
  PRIMARY KEY (`message_id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '报文模版' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for message_template_type
-- ----------------------------
DROP TABLE IF EXISTS `message_template_type`;
CREATE TABLE `message_template_type`  (
  `message_template_type_id` int NOT NULL AUTO_INCREMENT,
  `message_code` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '编码',
  `message_field` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '标签',
  `start_index` int NULL DEFAULT NULL COMMENT '起始位',
  `end_index` int NULL DEFAULT NULL COMMENT '终值位',
  `data_type_id` int NULL DEFAULT NULL COMMENT '报文数据类型Id',
  `data_type_name` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '报文数据类型名称',
  `fixed_value` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '最小值',
  `range_value` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '最大值',
  `template_id` int NULL DEFAULT NULL COMMENT '模版Id',
  `message_class` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '报文类别',
  PRIMARY KEY (`message_template_type_id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 76 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '报文模版类型' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for message_value
-- ----------------------------
DROP TABLE IF EXISTS `message_value`;
CREATE TABLE `message_value`  (
  `message_id` bigint NOT NULL AUTO_INCREMENT COMMENT '报文主键',
  `template_id` bigint NULL DEFAULT NULL COMMENT '模版外键',
  `message_code` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '报文编码',
  `message_label` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '报文标签',
  `message_start_index` int NULL DEFAULT NULL COMMENT '起始位',
  `message_end_index` int NULL DEFAULT NULL COMMENT '终止位',
  `create_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '创建人',
  `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
  `update_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '更新人',
  `update_time` datetime NULL DEFAULT NULL COMMENT '更新时间',
  `remark` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注',
  `message_class` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
  PRIMARY KEY (`message_id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 61 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '报文' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- Table structure for sys_car
-- ----------------------------
DROP TABLE IF EXISTS `sys_car`;
CREATE TABLE `sys_car`  (
  `id` int NOT NULL AUTO_INCREMENT,
  `car_vin` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT 'VIN码',
  `car_type_id` int NULL DEFAULT NULL COMMENT '车辆类型Id',
  `state` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '状态',
  `fence_id` int NULL DEFAULT NULL COMMENT '电子围栏',
  `car_motor_manufacturer` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '车辆电机厂商',
  `car_motor_model` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '电机型号',
  `car_battery_manufacturer` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '车辆电池厂商',
  `car_battery_model` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '电池型号',
  `strategy_id` int NULL DEFAULT NULL COMMENT '策略ID',
  `group_id` int NULL DEFAULT NULL COMMENT '围栏组ID',
  `create_by` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '创建人',
  `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
  `update_by` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '修改人',
  `update_time` datetime NULL DEFAULT NULL COMMENT '修改时间',
  `remark` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '备注',
  `template_id` int NULL DEFAULT NULL COMMENT '报文模版ID',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 5 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '车辆基础信息表' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- Table structure for sys_car_enterprise
-- ----------------------------
DROP TABLE IF EXISTS `sys_car_enterprise`;
CREATE TABLE `sys_car_enterprise`  (
  `id` int NOT NULL AUTO_INCREMENT,
  `enterprise_name` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '企业名称',
  `name` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '用户姓名',
  `position` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '用户职位',
  `province` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '公司所在省',
  `city` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '公司所在市',
  `county` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '公司所在县/区',
  `address` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '公司详细地址',
  `credit_code` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '统一社会信用代码',
  `business_license` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '营业执照',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '企业' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for sys_car_fault
-- ----------------------------
DROP TABLE IF EXISTS `sys_car_fault`;
CREATE TABLE `sys_car_fault`  (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT '参数主键',
  `fault_code` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '故障码编码',
  `fault_name` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '故障名',
  `type_id` int NULL DEFAULT NULL COMMENT '故障类型',
  `fault_label` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '故障标签',
  `fault_bit` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '故障位',
  `fault_value` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '故障值',
  `fault_rank` int NULL DEFAULT NULL COMMENT '故障级别 (0.低 ，1.中 ，2.高)',
  `fault_desc` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '故障描述信息',
  `fault_min_threshold` int NULL DEFAULT NULL COMMENT '故障最小阈值',
  `fault_max_threshold` int NULL DEFAULT NULL COMMENT '故障最大阈值',
  `status` int NULL DEFAULT 1 COMMENT '启用状态(1.待处理 2.处理中 3.已处理 4.忽略)',
  `warn_status` int NULL DEFAULT 0 COMMENT '是否警告(0.开启 1.禁止)',
  `remark` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '备注',
  `create_by` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '创建者',
  `create_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `update_by` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '更新者',
  `update_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  `car_type_id` int NULL DEFAULT NULL COMMENT '车辆类型',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 17 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '故障码' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for sys_car_fault_log
-- ----------------------------
DROP TABLE IF EXISTS `sys_car_fault_log`;
CREATE TABLE `sys_car_fault_log`  (
  `id` int NOT NULL AUTO_INCREMENT,
  `sys_car_fault_id` int NOT NULL COMMENT '故障码编号',
  `create_by` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '创建人',
  `create_time` datetime NULL DEFAULT NULL COMMENT '开始时间',
  `update_by` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '修改人',
  `update_time` datetime NULL DEFAULT NULL COMMENT '结束时间',
  `vin` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT 'VIN码',
  `remark` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '内容',
  `status` int NULL DEFAULT 2 COMMENT '1- 解决 2- 处理中 3-忽略',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 5 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '故障日志表' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for sys_car_fault_message
-- ----------------------------
DROP TABLE IF EXISTS `sys_car_fault_message`;
CREATE TABLE `sys_car_fault_message`  (
  `id` int NOT NULL AUTO_INCREMENT,
  `content` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '内容',
  `status` int NULL DEFAULT NULL COMMENT '1-已读 2-未读',
  `create_by` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '创建人',
  `create_time` datetime NULL DEFAULT NULL COMMENT '开始时间',
  `update_by` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '修改人',
  `update_time` datetime NULL DEFAULT NULL COMMENT '结束时间',
  `remark` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '备注',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 3 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '站内信' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for sys_car_log
-- ----------------------------
DROP TABLE IF EXISTS `sys_car_log`;
CREATE TABLE `sys_car_log`  (
  `id` int NOT NULL AUTO_INCREMENT,
  `car_vin` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT 'VIN码',
  `start_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
  `end_time` datetime NULL DEFAULT NULL COMMENT '结束时间',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '车辆日志表' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for t_template
-- ----------------------------
DROP TABLE IF EXISTS `t_template`;
CREATE TABLE `t_template`  (
  `template_id` int NOT NULL AUTO_INCREMENT,
  `house_id` int NULL DEFAULT NULL,
  `template_name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '报文模版名称',
  `template_describe` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '报文模版描述',
  `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
  PRIMARY KEY (`template_id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 4 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '报文模版表' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for tb_enterprise
-- ----------------------------
DROP TABLE IF EXISTS `tb_enterprise`;
CREATE TABLE `tb_enterprise`  (
  `enterprise_id` int NOT NULL AUTO_INCREMENT COMMENT '企业编号',
  `enterprise_name` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '企业名称',
  `enterprise_car_count` int NULL DEFAULT 0 COMMENT '企业车辆数量',
  `enterprise_fence_count` int NULL DEFAULT 0 COMMENT '企业电子围栏数量',
  `enterprise_database_name` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '企业数据库',
  PRIMARY KEY (`enterprise_id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 18 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '企业运营' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for warn_logs
-- ----------------------------
DROP TABLE IF EXISTS `warn_logs`;
CREATE TABLE `warn_logs`  (
  `id` int NOT NULL AUTO_INCREMENT COMMENT '预警日志id',
  `vin` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '车辆vin码',
  `warn_rule_id` int NULL DEFAULT NULL COMMENT '规则id',
  `start_time` datetime NULL DEFAULT NULL COMMENT '开始时间',
  `end_time` datetime NULL DEFAULT NULL COMMENT '结束时间',
  `max_value` int NULL DEFAULT NULL COMMENT '最大值',
  `min_value` int NULL DEFAULT NULL COMMENT '最小值',
  `avg_value` int NULL DEFAULT NULL COMMENT '平均值',
  `median_value` int NULL DEFAULT NULL COMMENT '中位数',
  `status` int NULL DEFAULT NULL COMMENT '是否发送预警',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '车辆预警记录表' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- Table structure for warn_rule
-- ----------------------------
DROP TABLE IF EXISTS `warn_rule`;
CREATE TABLE `warn_rule`  (
  `id` int NOT NULL AUTO_INCREMENT COMMENT '规则id',
  `rule_name` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '规则名称',
  `strategy_id` int NULL DEFAULT NULL COMMENT '策略id',
  `msg_type_id` int NULL DEFAULT NULL COMMENT '报文数据类型id',
  `slide_time` int NULL DEFAULT NULL COMMENT '滑窗时间',
  `slide_frequency` int NULL DEFAULT NULL COMMENT '滑窗频率',
  `growth_rate` int NULL DEFAULT NULL COMMENT '增长率',
  `volatility_rate` int NULL DEFAULT NULL COMMENT '波动率',
  `decrease_rate` int NULL DEFAULT NULL COMMENT '下降率',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 4 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '车辆预警规则表' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- Table structure for warn_strategy
-- ----------------------------
DROP TABLE IF EXISTS `warn_strategy`;
CREATE TABLE `warn_strategy`  (
  `id` int NOT NULL AUTO_INCREMENT COMMENT '策略id',
  `car_type_id` int NULL DEFAULT NULL COMMENT '车辆类型id',
  `strategy_name` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '策略名称',
  `template_id` int NULL DEFAULT NULL COMMENT '报文模版id',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 8 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '车辆预警策略表' ROW_FORMAT = DYNAMIC;

SET FOREIGN_KEY_CHECKS = 1;
