01用户列表-不良行为记录表.sql 1.6 KB

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