CREATE TABLE IF NOT EXISTS `asset_vehicle_replacement` (
  `id` bigint NOT NULL AUTO_INCREMENT,
  `replacement_code` varchar(50) NOT NULL COMMENT '替换单编码',
  `replacement_type` tinyint NOT NULL COMMENT '1=临时 2=永久',
  `contract_id` bigint NOT NULL,
  `contract_code` varchar(50) DEFAULT NULL,
  `customer_id` bigint DEFAULT NULL,
  `customer_name` varchar(100) DEFAULT NULL,
  `delivery_order_id` bigint DEFAULT NULL COMMENT '来源交车单ID',
  `original_vehicle_id` bigint NOT NULL,
  `original_plate_no` varchar(20) DEFAULT NULL,
  `original_vin` varchar(50) DEFAULT NULL,
  `new_vehicle_id` bigint DEFAULT NULL,
  `new_plate_no` varchar(20) DEFAULT NULL,
  `new_vin` varchar(50) DEFAULT NULL,
  `replacement_reason` varchar(500) DEFAULT NULL,
  `expected_date` date DEFAULT NULL,
  `actual_date` date DEFAULT NULL,
  `return_date` date DEFAULT NULL COMMENT '临时替换预计归还日期',
  `actual_return_date` date DEFAULT NULL,
  `status` tinyint NOT NULL DEFAULT 0 COMMENT '0=草稿 1=审批中 2=审批通过 3=执行中 4=已完成 5=审批驳回 6=已撤回',
  `approval_status` tinyint NOT NULL DEFAULT 0,
  `bpm_instance_id` varchar(64) DEFAULT NULL,
  `remark` varchar(500) DEFAULT NULL,
  `creator` varchar(64) DEFAULT '',
  `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updater` varchar(64) DEFAULT '',
  `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `deleted` bit(1) NOT NULL DEFAULT b'0',
  `tenant_id` bigint NOT NULL DEFAULT 0,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB COMMENT='替换车申请';
