/*
 Navicat Premium Data Transfer

 Source Server         : localhost
 Source Server Type    : MySQL
 Source Server Version : 50727
 Source Host           : localhost:3306
 Source Schema         : ry-cloud

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

 Date: 21/10/2024 08:38:52
*/

SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;

-- ----------------------------
-- Table structure for cust_info
-- ----------------------------
DROP TABLE IF EXISTS `cust_info`;
CREATE TABLE `cust_info`  (
  `cust_id` bigint(20) NOT NULL COMMENT '客户ID',
  `name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '客户姓名',
  `phone` varchar(15) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '客户电话',
  `birth_date` date NULL DEFAULT NULL COMMENT '客户出生日期',
  `address` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '所在地区',
  `detailed_address` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '详细地址',
  `remarks` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注',
  `source` tinyint(4) NOT NULL COMMENT '客户来源：1-系统导入 2-微信添加 3-其他',
  `type` tinyint(4) NOT NULL COMMENT '客户类型：1-企业微信用户 2-微信用户',
  `state` tinyint(4) NOT NULL COMMENT '客户状态：1-存在 2-删除',
  `become_cust_time` datetime(0) NULL DEFAULT NULL COMMENT '成为客户时间',
  `superintendent_id` bigint(20) NULL DEFAULT NULL COMMENT '客户对应负责人ID',
  `create_id` bigint(20) NULL DEFAULT NULL COMMENT '客户信息创建人',
  `create_time` datetime(0) NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '创建时间',
  `modify_id` bigint(20) NULL DEFAULT NULL COMMENT '客户信息修改人',
  `modify_time` datetime(0) NULL DEFAULT CURRENT_TIMESTAMP(0) ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '修改时间',
  PRIMARY KEY (`cust_id`) USING BTREE,
  UNIQUE INDEX `idx_phone`(`phone`) USING BTREE COMMENT '客户电话唯一索引',
  INDEX `idx_superintendent`(`superintendent_id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '客户信息表' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- Records of cust_info
-- ----------------------------

-- ----------------------------
-- Table structure for vehicle_info
-- ----------------------------
DROP TABLE IF EXISTS `vehicle_info`;
CREATE TABLE `vehicle_info`  (
  `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'ID',
  `cust_id` bigint(20) NULL DEFAULT NULL COMMENT 'cust_info表中的ID',
  `license_no` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '车牌',
  `vin_no` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '车架号',
  `brand_name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '品牌型号',
  `engine_no` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '发动机号',
  `caryear` varchar(8) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '年款',
  `seat_count` tinyint(4) NOT NULL COMMENT '座位数',
  `complete_kerb_mass` decimal(10, 2) NOT NULL COMMENT '整备质量',
  `limit_load` decimal(10, 2) NULL DEFAULT NULL COMMENT '核定载质量',
  `engine_desc` decimal(6, 2) NULL DEFAULT NULL COMMENT '排量',
  `power_scale` decimal(5, 5) NULL DEFAULT NULL COMMENT '发动机功率',
  `purchase_price` decimal(15, 2) NOT NULL COMMENT '新车购置价',
  `property` varchar(15) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '使用性质',
  `vehicle_use` tinyint(4) NULL DEFAULT NULL COMMENT '车辆用途',
  `cartype` varchar(5) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '车辆类型',
  `cimodelclass` varchar(5) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '车辆种类',
  `energy_type` tinyint(4) NOT NULL COMMENT '能源种类 1什么什么类 2什么什么',
  `register_date` date NOT NULL COMMENT '注册日期',
  `issue_date` date NOT NULL COMMENT '发证日期',
  `no_license_flag` tinyint(4) NULL DEFAULT NULL COMMENT '是否新车 1是 2不是',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '用户车辆信息表' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- Records of vehicle_info
-- ----------------------------

-- ----------------------------
-- Table structure for vehicle_photo
-- ----------------------------
DROP TABLE IF EXISTS `vehicle_photo`;
CREATE TABLE `vehicle_photo`  (
  `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'ID',
  `vehicle_id` bigint(20) NULL DEFAULT NULL COMMENT 'vehicle_info表中的ID',
  `type` tinyint(4) NULL DEFAULT NULL COMMENT '照片类型（使用数字表示）1 正面照 2 侧面照 3后面照 4 内饰照',
  `url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '照片路径',
  `creation_date` datetime(0) NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '创建时间',
  `del_flag` tinyint(11) NULL DEFAULT 1 COMMENT '逻辑删除 1存在 2删除',
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `idx_vehicle_id`(`vehicle_id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '车辆影像化资料' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- Records of vehicle_photo
-- ----------------------------

SET FOREIGN_KEY_CHECKS = 1;
