-- 沟通记录表建表语句
-- 根据沟通记录详情页面字段创建

CREATE TABLE `communication_record` (
  `id` varchar(36) NOT NULL COMMENT '主键ID(UUID)',
  `customer_name` varchar(100) NOT NULL COMMENT '客户姓名',
  `customer_phone` varchar(50) NOT NULL COMMENT '客户电话',
  `customer_id` varchar(36) NOT NULL COMMENT '客户ID',
  `communication_type` varchar(50) NOT NULL COMMENT '沟通类型',
  `communication_time` datetime NOT NULL COMMENT '沟通时间',
  `communication_content` text NOT NULL COMMENT '沟通内容',
  `communication_result` text COMMENT '沟通结果',
  `owner_name` varchar(100) NOT NULL COMMENT '所属人姓名',
  `owner_phone` varchar(50) NOT NULL COMMENT '所属人电话',
  `todo_suggestion` text COMMENT '待办建议',
  `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `update_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  `status` tinyint(1) NOT NULL DEFAULT '1' COMMENT '状态：1-有效，0-删除',
  PRIMARY KEY (`id`),
  KEY `idx_customer_name` (`customer_name`),
  KEY `idx_customer_phone` (`customer_phone`),
  KEY `idx_customer_id` (`customer_id`),
  KEY `idx_communication_time` (`communication_time`),
  KEY `idx_owner_name` (`owner_name`),
  KEY `idx_create_time` (`create_time`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='沟通记录表';




