-- Active: xiaoding_test@@192.168.110.85@3306@xiaoding_test -- 不良行为记录表 DROP TABLE IF EXISTS `violation_records`; CREATE TABLE `violation_records` ( `id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT '主键ID', `user_id` bigint unsigned NOT NULL COMMENT '用户ID', `violation_type_id` int unsigned NOT NULL COMMENT '违规类型ID', `order_id` bigint unsigned DEFAULT NULL COMMENT '关联订单ID', `coach_id` bigint unsigned DEFAULT NULL COMMENT '关联技师ID', `evidence` text DEFAULT NULL COMMENT '证据信息(图片链接/文字描述等)', `status` varchar(20) NOT NULL DEFAULT 'PENDING' COMMENT '状态:PENDING-待处理,PROCESSING-处理中,COMPLETED-已完成,CANCELLED-已取消', `processor` varchar(50) DEFAULT NULL COMMENT '处理人', `process_time` timestamp NULL DEFAULT NULL COMMENT '处理时间', `process_note` varchar(500) DEFAULT NULL COMMENT '处理备注', `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', `updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', `deleted_at` timestamp NULL DEFAULT NULL COMMENT '删除时间', PRIMARY KEY (`id`), KEY `idx_user_id` (`user_id`, `deleted_at`), KEY `idx_violation_type` (`violation_type_id`), KEY `idx_order_id` (`order_id`), KEY `idx_coach_id` (`coach_id`), KEY `idx_status` (`status`), KEY `idx_created_at` (`created_at`) ) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '不良行为记录表'; -- 插入一些示例违规类型数