-- MySQL dump 10.13  Distrib 8.0.44, for Linux (x86_64)
--
-- Host: localhost    Database: martial_db
-- ------------------------------------------------------
-- Server version	8.0.44

/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!50503 SET NAMES utf8mb4 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;

--
-- Table structure for table `flyway_schema_history`
--

DROP TABLE IF EXISTS `flyway_schema_history`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `flyway_schema_history` (
  `installed_rank` int NOT NULL,
  `version` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `description` varchar(200) COLLATE utf8mb4_unicode_ci NOT NULL,
  `type` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL,
  `script` varchar(1000) COLLATE utf8mb4_unicode_ci NOT NULL,
  `checksum` int DEFAULT NULL,
  `installed_by` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
  `installed_on` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `execution_time` int NOT NULL,
  `success` tinyint(1) NOT NULL,
  PRIMARY KEY (`installed_rank`),
  KEY `flyway_schema_history_s_idx` (`success`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `flyway_schema_history`
--

LOCK TABLES `flyway_schema_history` WRITE;
/*!40000 ALTER TABLE `flyway_schema_history` DISABLE KEYS */;
INSERT INTO `flyway_schema_history` VALUES (1,'0','<< Flyway Baseline >>','BASELINE','<< Flyway Baseline >>',NULL,'root','2026-01-13 04:28:14',0,1),(2,'1','baseline','SQL','V1__baseline.sql',393949116,'root','2026-01-13 04:28:15',8,1),(3,'2','add project fields','SQL','V2__add_project_fields.sql',-938292432,'root','2026-01-13 04:28:15',15,1),(4,'3','add missing fields and tables','SQL','V3__add_missing_fields_and_tables.sql',455547722,'root','2026-01-15 03:30:45',35,1),(5,'4','create missing tables','SQL','V4__create_missing_tables.sql',-277029490,'root','2026-01-15 03:30:45',33,1),(6,'5','create schedule tables','SQL','V5__create_schedule_tables.sql',-1114086524,'root','2026-01-15 03:30:45',15,1),(7,'6','add deduction item project id','SQL','V6__add_deduction_item_project_id.sql',0,'root','2026-01-16 08:14:40',5,1);
/*!40000 ALTER TABLE `flyway_schema_history` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `mt_athlete`
--

DROP TABLE IF EXISTS `mt_athlete`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `mt_athlete` (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  `user_id` bigint DEFAULT NULL COMMENT '用户ID',
  `name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '姓名',
  `gender` int DEFAULT '1' COMMENT '性别：1-男，2-女',
  `age` int DEFAULT NULL COMMENT '年龄',
  `id_card` varchar(18) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '身份证号',
  `unit_name` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '单位名称',
  `team_name` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '队伍名称',
  `id_type` int DEFAULT '1' COMMENT '证件类型：1-身份证',
  `player_number` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '选手编号（报名成功后生成）',
  `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  `is_deleted` tinyint DEFAULT '0' COMMENT '是否删除：0-否，1-是',
  `tenant_id` varchar(12) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '000000' COMMENT '租户ID',
  `create_user` bigint DEFAULT NULL COMMENT '创建人',
  `create_dept` bigint DEFAULT NULL COMMENT '创建部门',
  `update_user` bigint DEFAULT NULL COMMENT '更新人',
  `status` int DEFAULT '1' COMMENT '状态',
  PRIMARY KEY (`id`) USING BTREE,
  KEY `idx_user_id` (`user_id`) USING BTREE,
  KEY `idx_id_card` (`id_card`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC COMMENT='运动员选手表';
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `mt_athlete`
--

LOCK TABLES `mt_athlete` WRITE;
/*!40000 ALTER TABLE `mt_athlete` DISABLE KEYS */;
/*!40000 ALTER TABLE `mt_athlete` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `mt_certificate`
--

DROP TABLE IF EXISTS `mt_certificate`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `mt_certificate` (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  `competition_id` bigint NOT NULL COMMENT '赛事ID',
  `result_id` bigint NOT NULL COMMENT '成绩ID',
  `athlete_id` bigint NOT NULL COMMENT '运动员ID',
  `project_id` bigint NOT NULL COMMENT '项目ID',
  `certificate_type` int DEFAULT '1' COMMENT '证书类型：1-冠军，2-亚军，3-季军，4-优秀奖',
  `certificate_url` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '证书URL',
  `generate_time` datetime DEFAULT NULL COMMENT '生成时间',
  `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  `is_deleted` tinyint DEFAULT '0' COMMENT '是否删除：0-否，1-是',
  `tenant_id` varchar(12) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '000000' COMMENT '租户ID',
  `create_user` bigint DEFAULT NULL COMMENT '创建人',
  `create_dept` bigint DEFAULT NULL COMMENT '创建部门',
  `update_user` bigint DEFAULT NULL COMMENT '更新人',
  `status` int DEFAULT '1' COMMENT '状态',
  PRIMARY KEY (`id`) USING BTREE,
  KEY `idx_competition_id` (`competition_id`) USING BTREE,
  KEY `idx_result_id` (`result_id`) USING BTREE,
  KEY `idx_athlete_id` (`athlete_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC COMMENT='证书奖牌表';
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `mt_certificate`
--

LOCK TABLES `mt_certificate` WRITE;
/*!40000 ALTER TABLE `mt_certificate` DISABLE KEYS */;
/*!40000 ALTER TABLE `mt_certificate` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `mt_competition`
--

DROP TABLE IF EXISTS `mt_competition`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `mt_competition` (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  `title` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '赛事名称',
  `organizer` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '主办单位',
  `location` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '地区',
  `venue` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '详细地点',
  `register_start_time` datetime DEFAULT NULL COMMENT '报名开始时间',
  `register_end_time` datetime DEFAULT NULL COMMENT '报名结束时间',
  `match_start_time` datetime DEFAULT NULL COMMENT '比赛开始时间',
  `match_end_time` datetime DEFAULT NULL COMMENT '比赛结束时间',
  `venue_count` int DEFAULT '3' COMMENT '场地数量',
  `match_code` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '比赛编码',
  `share_url` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '报名分享链接',
  `info_content` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci COMMENT '信息发布内容',
  `rules_content` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci COMMENT '赛事规程内容',
  `schedule_content` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci COMMENT '活动日程内容',
  `status` int DEFAULT '0' COMMENT '状态：0-待开始，1-报名中，2-编排中，3-进行中，4-已结束',
  `total_register_count` int DEFAULT '0' COMMENT '总报名人数',
  `total_amount` decimal(10,2) DEFAULT '0.00' COMMENT '总金额',
  `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  `is_deleted` tinyint DEFAULT '0' COMMENT '是否删除：0-否，1-是',
  `tenant_id` varchar(12) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '000000' COMMENT '租户ID',
  `create_user` bigint DEFAULT NULL COMMENT '创建人',
  `create_dept` bigint DEFAULT NULL COMMENT '创建部门',
  `update_user` bigint DEFAULT NULL COMMENT '更新人',
  PRIMARY KEY (`id`) USING BTREE,
  KEY `idx_status` (`status`) USING BTREE,
  KEY `idx_match_code` (`match_code`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC COMMENT='赛事表';
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `mt_competition`
--

LOCK TABLES `mt_competition` WRITE;
/*!40000 ALTER TABLE `mt_competition` DISABLE KEYS */;
/*!40000 ALTER TABLE `mt_competition` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `mt_deduction_item`
--

DROP TABLE IF EXISTS `mt_deduction_item`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `mt_deduction_item` (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  `project_id` bigint NOT NULL COMMENT '项目ID',
  `description` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '扣分项描述',
  `deduction_value` decimal(5,3) DEFAULT '0.000' COMMENT '扣分值',
  `sort_order` int DEFAULT '0' COMMENT '排序',
  `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  `is_deleted` tinyint DEFAULT '0' COMMENT '是否删除：0-否，1-是',
  `tenant_id` varchar(12) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '000000' COMMENT '租户ID',
  `create_user` bigint DEFAULT NULL COMMENT '创建人',
  `create_dept` bigint DEFAULT NULL COMMENT '创建部门',
  `update_user` bigint DEFAULT NULL COMMENT '更新人',
  `status` int DEFAULT '1' COMMENT '状态',
  PRIMARY KEY (`id`) USING BTREE,
  KEY `idx_project_id` (`project_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC COMMENT='扣分项表';
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `mt_deduction_item`
--

LOCK TABLES `mt_deduction_item` WRITE;
/*!40000 ALTER TABLE `mt_deduction_item` DISABLE KEYS */;
/*!40000 ALTER TABLE `mt_deduction_item` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `mt_judge`
--

DROP TABLE IF EXISTS `mt_judge`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `mt_judge` (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  `competition_id` bigint NOT NULL COMMENT '赛事ID',
  `judge_name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '裁判姓名',
  `invite_code` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '邀请码',
  `role` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT 'pub' COMMENT '角色：pub-普通裁判，admin-裁判长',
  `phone` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '手机号',
  `venue_id` bigint DEFAULT NULL COMMENT '负责场地ID',
  `status` int DEFAULT '1' COMMENT '状态：1-正常，2-禁用',
  `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  `is_deleted` tinyint DEFAULT '0' COMMENT '是否删除：0-否，1-是',
  `tenant_id` varchar(12) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '000000' COMMENT '租户ID',
  `create_user` bigint DEFAULT NULL COMMENT '创建人',
  `create_dept` bigint DEFAULT NULL COMMENT '创建部门',
  `update_user` bigint DEFAULT NULL COMMENT '更新人',
  PRIMARY KEY (`id`) USING BTREE,
  KEY `idx_competition_id` (`competition_id`) USING BTREE,
  KEY `idx_invite_code` (`invite_code`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC COMMENT='裁判表';
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `mt_judge`
--

LOCK TABLES `mt_judge` WRITE;
/*!40000 ALTER TABLE `mt_judge` DISABLE KEYS */;
/*!40000 ALTER TABLE `mt_judge` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `mt_match_log`
--

DROP TABLE IF EXISTS `mt_match_log`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `mt_match_log` (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  `competition_id` bigint NOT NULL COMMENT '赛事ID',
  `schedule_id` bigint NOT NULL COMMENT '编排ID',
  `registration_project_id` bigint NOT NULL COMMENT '报名项目ID',
  `athlete_id` bigint DEFAULT NULL COMMENT '运动员ID',
  `project_id` bigint NOT NULL COMMENT '项目ID',
  `venue_id` bigint NOT NULL COMMENT '场地ID',
  `status` int DEFAULT '1' COMMENT '状态：1-待检录，2-已检录，3-比赛中，4-已完赛',
  `checkin_time` datetime DEFAULT NULL COMMENT '签到时间',
  `start_time` datetime DEFAULT NULL COMMENT '开始时间',
  `end_time` datetime DEFAULT NULL COMMENT '结束时间',
  `operator_name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '操作人',
  `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  `is_deleted` tinyint DEFAULT '0' COMMENT '是否删除：0-否，1-是',
  `tenant_id` varchar(12) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '000000' COMMENT '租户ID',
  `create_user` bigint DEFAULT NULL COMMENT '创建人',
  `create_dept` bigint DEFAULT NULL COMMENT '创建部门',
  `update_user` bigint DEFAULT NULL COMMENT '更新人',
  PRIMARY KEY (`id`) USING BTREE,
  KEY `idx_competition_id` (`competition_id`) USING BTREE,
  KEY `idx_schedule_id` (`schedule_id`) USING BTREE,
  KEY `idx_venue_id` (`venue_id`) USING BTREE,
  KEY `idx_status` (`status`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC COMMENT='比赛日志表';
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `mt_match_log`
--

LOCK TABLES `mt_match_log` WRITE;
/*!40000 ALTER TABLE `mt_match_log` DISABLE KEYS */;
/*!40000 ALTER TABLE `mt_match_log` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `mt_project`
--

DROP TABLE IF EXISTS `mt_project`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `mt_project` (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  `competition_id` bigint NOT NULL COMMENT '赛事ID',
  `project_name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '项目名称',
  `project_type` int DEFAULT '1' COMMENT '项目类型：1-单人项目，2-集体项目',
  `price` decimal(10,2) DEFAULT '0.00' COMMENT '项目价格',
  `duration` int DEFAULT '5' COMMENT '单个比赛时长（分钟）',
  `gender` int DEFAULT '0' COMMENT '性别限制：0-不限，1-男，2-女',
  `age_group` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '年龄组别',
  `team_size` int DEFAULT '1' COMMENT '队伍人数（集体项目）',
  `register_count` int DEFAULT '0' COMMENT '报名人数/队伍数',
  `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  `is_deleted` tinyint DEFAULT '0' COMMENT '是否删除：0-否，1-是',
  `tenant_id` varchar(12) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '000000' COMMENT '租户ID',
  `create_user` bigint DEFAULT NULL COMMENT '创建人',
  `create_dept` bigint DEFAULT NULL COMMENT '创建部门',
  `update_user` bigint DEFAULT NULL COMMENT '更新人',
  `status` int DEFAULT '1' COMMENT '状态',
  PRIMARY KEY (`id`) USING BTREE,
  KEY `idx_competition_id` (`competition_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC COMMENT='项目表';
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `mt_project`
--

LOCK TABLES `mt_project` WRITE;
/*!40000 ALTER TABLE `mt_project` DISABLE KEYS */;
/*!40000 ALTER TABLE `mt_project` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `mt_registration_order`
--

DROP TABLE IF EXISTS `mt_registration_order`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `mt_registration_order` (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  `order_no` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '订单号',
  `competition_id` bigint NOT NULL COMMENT '赛事ID',
  `user_id` bigint NOT NULL COMMENT '用户ID',
  `contact_name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '联系人姓名',
  `contact_phone` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '联系人电话',
  `total_amount` decimal(10,2) DEFAULT '0.00' COMMENT '总金额',
  `pay_amount` decimal(10,2) DEFAULT '0.00' COMMENT '实付金额',
  `status` int DEFAULT '0' COMMENT '订单状态：0-待支付，1-已支付，2-已取消，3-已退款',
  `pay_time` datetime DEFAULT NULL COMMENT '支付时间',
  `pay_type` int DEFAULT NULL COMMENT '支付方式：1-微信，2-支付宝',
  `participant_count` int DEFAULT '0' COMMENT '参赛人数',
  `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  `is_deleted` tinyint DEFAULT '0' COMMENT '是否删除：0-否，1-是',
  `tenant_id` varchar(12) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '000000' COMMENT '租户ID',
  `create_user` bigint DEFAULT NULL COMMENT '创建人',
  `create_dept` bigint DEFAULT NULL COMMENT '创建部门',
  `update_user` bigint DEFAULT NULL COMMENT '更新人',
  PRIMARY KEY (`id`) USING BTREE,
  UNIQUE KEY `uk_order_no` (`order_no`) USING BTREE,
  KEY `idx_competition_id` (`competition_id`) USING BTREE,
  KEY `idx_user_id` (`user_id`) USING BTREE,
  KEY `idx_status` (`status`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC COMMENT='报名订单表';
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `mt_registration_order`
--

LOCK TABLES `mt_registration_order` WRITE;
/*!40000 ALTER TABLE `mt_registration_order` DISABLE KEYS */;
/*!40000 ALTER TABLE `mt_registration_order` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `mt_registration_project`
--

DROP TABLE IF EXISTS `mt_registration_project`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `mt_registration_project` (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  `registration_order_id` bigint NOT NULL COMMENT '报名订单ID',
  `project_id` bigint NOT NULL COMMENT '项目ID',
  `athlete_id` bigint DEFAULT NULL COMMENT '运动员ID（单人项目）',
  `team_name` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '队伍名称（集体项目）',
  `project_price` decimal(10,2) DEFAULT '0.00' COMMENT '项目价格',
  `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  `is_deleted` tinyint DEFAULT '0' COMMENT '是否删除：0-否，1-是',
  `tenant_id` varchar(12) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '000000' COMMENT '租户ID',
  `create_user` bigint DEFAULT NULL COMMENT '创建人',
  `create_dept` bigint DEFAULT NULL COMMENT '创建部门',
  `update_user` bigint DEFAULT NULL COMMENT '更新人',
  `status` int DEFAULT '1' COMMENT '状态',
  PRIMARY KEY (`id`) USING BTREE,
  KEY `idx_registration_order_id` (`registration_order_id`) USING BTREE,
  KEY `idx_project_id` (`project_id`) USING BTREE,
  KEY `idx_athlete_id` (`athlete_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC COMMENT='报名项目关联表';
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `mt_registration_project`
--

LOCK TABLES `mt_registration_project` WRITE;
/*!40000 ALTER TABLE `mt_registration_project` DISABLE KEYS */;
/*!40000 ALTER TABLE `mt_registration_project` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `mt_result`
--

DROP TABLE IF EXISTS `mt_result`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `mt_result` (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  `competition_id` bigint NOT NULL COMMENT '赛事ID',
  `schedule_id` bigint NOT NULL COMMENT '编排ID',
  `registration_project_id` bigint NOT NULL COMMENT '报名项目ID',
  `athlete_id` bigint DEFAULT NULL COMMENT '运动员ID',
  `project_id` bigint NOT NULL COMMENT '项目ID',
  `total_score` decimal(5,3) DEFAULT '0.000' COMMENT '总分',
  `final_score` decimal(5,3) DEFAULT '0.000' COMMENT '最终分数（裁判长可调整）',
  `rank` int DEFAULT NULL COMMENT '排名',
  `chief_adjust_score` decimal(5,3) DEFAULT NULL COMMENT '裁判长调整分数',
  `chief_remark` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '裁判长备注',
  `status` int DEFAULT '0' COMMENT '状态：0-待评分，1-评分中，2-已完成',
  `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  `is_deleted` tinyint DEFAULT '0' COMMENT '是否删除：0-否，1-是',
  `tenant_id` varchar(12) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '000000' COMMENT '租户ID',
  `create_user` bigint DEFAULT NULL COMMENT '创建人',
  `create_dept` bigint DEFAULT NULL COMMENT '创建部门',
  `update_user` bigint DEFAULT NULL COMMENT '更新人',
  PRIMARY KEY (`id`) USING BTREE,
  KEY `idx_competition_id` (`competition_id`) USING BTREE,
  KEY `idx_schedule_id` (`schedule_id`) USING BTREE,
  KEY `idx_registration_project_id` (`registration_project_id`) USING BTREE,
  KEY `idx_project_id` (`project_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC COMMENT='成绩表';
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `mt_result`
--

LOCK TABLES `mt_result` WRITE;
/*!40000 ALTER TABLE `mt_result` DISABLE KEYS */;
/*!40000 ALTER TABLE `mt_result` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `mt_schedule`
--

DROP TABLE IF EXISTS `mt_schedule`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `mt_schedule` (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  `competition_id` bigint NOT NULL COMMENT '赛事ID',
  `venue_id` bigint NOT NULL COMMENT '场地ID',
  `project_id` bigint NOT NULL COMMENT '项目ID',
  `registration_project_id` bigint NOT NULL COMMENT '报名项目ID',
  `time_slot` datetime DEFAULT NULL COMMENT '比赛时间段',
  `estimated_start_time` datetime DEFAULT NULL COMMENT '预计开始时间',
  `estimated_end_time` datetime DEFAULT NULL COMMENT '预计结束时间',
  `actual_start_time` datetime DEFAULT NULL COMMENT '实际开始时间',
  `actual_end_time` datetime DEFAULT NULL COMMENT '实际结束时间',
  `order_no` int DEFAULT '0' COMMENT '出场顺序',
  `status` int DEFAULT '0' COMMENT '状态：0-预编排，1-已确定，2-比赛中，3-已完赛',
  `schedule_type` int DEFAULT '1' COMMENT '编排类型：1-自动编排，2-手动调整',
  `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  `is_deleted` tinyint DEFAULT '0' COMMENT '是否删除：0-否，1-是',
  `tenant_id` varchar(12) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '000000' COMMENT '租户ID',
  `create_user` bigint DEFAULT NULL COMMENT '创建人',
  `create_dept` bigint DEFAULT NULL COMMENT '创建部门',
  `update_user` bigint DEFAULT NULL COMMENT '更新人',
  PRIMARY KEY (`id`) USING BTREE,
  KEY `idx_competition_id` (`competition_id`) USING BTREE,
  KEY `idx_venue_id` (`venue_id`) USING BTREE,
  KEY `idx_project_id` (`project_id`) USING BTREE,
  KEY `idx_time_slot` (`time_slot`) USING BTREE,
  KEY `idx_status` (`status`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC COMMENT='编排表';
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `mt_schedule`
--

LOCK TABLES `mt_schedule` WRITE;
/*!40000 ALTER TABLE `mt_schedule` DISABLE KEYS */;
/*!40000 ALTER TABLE `mt_schedule` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `mt_score`
--

DROP TABLE IF EXISTS `mt_score`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `mt_score` (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  `competition_id` bigint NOT NULL COMMENT '赛事ID',
  `schedule_id` bigint NOT NULL COMMENT '编排ID',
  `registration_project_id` bigint NOT NULL COMMENT '报名项目ID',
  `athlete_id` bigint DEFAULT NULL COMMENT '运动员ID',
  `project_id` bigint NOT NULL COMMENT '项目ID',
  `venue_id` bigint NOT NULL COMMENT '场地ID',
  `judge_id` bigint NOT NULL COMMENT '裁判ID',
  `score` decimal(5,3) DEFAULT '0.000' COMMENT '评分（保留3位小数）',
  `deduction_items` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci COMMENT '扣分项（JSON格式）',
  `remark` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '备注',
  `score_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '评分时间',
  `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  `is_deleted` tinyint DEFAULT '0' COMMENT '是否删除：0-否，1-是',
  `tenant_id` varchar(12) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '000000' COMMENT '租户ID',
  `create_user` bigint DEFAULT NULL COMMENT '创建人',
  `create_dept` bigint DEFAULT NULL COMMENT '创建部门',
  `update_user` bigint DEFAULT NULL COMMENT '更新人',
  PRIMARY KEY (`id`) USING BTREE,
  KEY `idx_competition_id` (`competition_id`) USING BTREE,
  KEY `idx_schedule_id` (`schedule_id`) USING BTREE,
  KEY `idx_registration_project_id` (`registration_project_id`) USING BTREE,
  KEY `idx_judge_id` (`judge_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC COMMENT='评分表';
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `mt_score`
--

LOCK TABLES `mt_score` WRITE;
/*!40000 ALTER TABLE `mt_score` DISABLE KEYS */;
/*!40000 ALTER TABLE `mt_score` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `mt_team_member`
--

DROP TABLE IF EXISTS `mt_team_member`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `mt_team_member` (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  `registration_project_id` bigint NOT NULL COMMENT '报名项目ID',
  `athlete_id` bigint NOT NULL COMMENT '运动员ID',
  `role` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '角色',
  `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  `is_deleted` tinyint DEFAULT '0' COMMENT '是否删除：0-否，1-是',
  `tenant_id` varchar(12) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '000000' COMMENT '租户ID',
  `create_user` bigint DEFAULT NULL COMMENT '创建人',
  `create_dept` bigint DEFAULT NULL COMMENT '创建部门',
  `update_user` bigint DEFAULT NULL COMMENT '更新人',
  `status` int DEFAULT '1' COMMENT '状态',
  PRIMARY KEY (`id`) USING BTREE,
  KEY `idx_registration_project_id` (`registration_project_id`) USING BTREE,
  KEY `idx_athlete_id` (`athlete_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC COMMENT='队员关联表';
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `mt_team_member`
--

LOCK TABLES `mt_team_member` WRITE;
/*!40000 ALTER TABLE `mt_team_member` DISABLE KEYS */;
/*!40000 ALTER TABLE `mt_team_member` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `mt_user`
--

DROP TABLE IF EXISTS `mt_user`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `mt_user` (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  `openid` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '微信openid',
  `nickname` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '昵称',
  `phone` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '手机号',
  `avatar` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '头像',
  `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  `is_deleted` tinyint DEFAULT '0' COMMENT '是否删除：0-否，1-是',
  `tenant_id` varchar(12) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '000000' COMMENT '租户ID',
  `create_user` bigint DEFAULT NULL COMMENT '创建人',
  `create_dept` bigint DEFAULT NULL COMMENT '创建部门',
  `update_user` bigint DEFAULT NULL COMMENT '更新人',
  `status` int DEFAULT '1' COMMENT '状态',
  PRIMARY KEY (`id`) USING BTREE,
  UNIQUE KEY `uk_openid` (`openid`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC COMMENT='用户表';
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `mt_user`
--

LOCK TABLES `mt_user` WRITE;
/*!40000 ALTER TABLE `mt_user` DISABLE KEYS */;
/*!40000 ALTER TABLE `mt_user` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `mt_venue`
--

DROP TABLE IF EXISTS `mt_venue`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `mt_venue` (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  `competition_id` bigint NOT NULL COMMENT '赛事ID',
  `venue_name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '场地名称',
  `venue_no` int NOT NULL COMMENT '场地编号',
  `status` int DEFAULT '1' COMMENT '场地状态：1-正常，2-维护中',
  `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  `is_deleted` tinyint DEFAULT '0' COMMENT '是否删除：0-否，1-是',
  `tenant_id` varchar(12) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '000000' COMMENT '租户ID',
  `create_user` bigint DEFAULT NULL COMMENT '创建人',
  `create_dept` bigint DEFAULT NULL COMMENT '创建部门',
  `update_user` bigint DEFAULT NULL COMMENT '更新人',
  PRIMARY KEY (`id`) USING BTREE,
  KEY `idx_competition_id` (`competition_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC COMMENT='场地表';
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `mt_venue`
--

LOCK TABLES `mt_venue` WRITE;
/*!40000 ALTER TABLE `mt_venue` DISABLE KEYS */;
/*!40000 ALTER TABLE `mt_venue` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;

/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;

-- Dump completed on 2026-01-16  8:15:00
