-- Martial tables schema only
-- Generated on Sun Nov 30 01:27:13 PM CST 2025

CREATE TABLE `martial_activity_schedule`  (
  `id` bigint(0) NOT NULL COMMENT '主键ID',
  `competition_id` bigint(0) NOT NULL COMMENT '赛事ID',
  `schedule_date` date NOT NULL COMMENT '日程日期',
  `schedule_time` time(0) NULL DEFAULT NULL COMMENT '日程时间',
  `event_name` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '活动项目',
  `venue` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '地点',
  `description` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '描述',
  `remark` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '备注',
  `sort_order` int(0) NULL DEFAULT 0 COMMENT '排序',
  `status` int(0) NULL DEFAULT 1 COMMENT '状态(0-未开始,1-进行中,2-已完成)',
  `create_user` bigint(0) NULL DEFAULT NULL,
  `create_dept` bigint(0) NULL DEFAULT NULL,
  `create_time` datetime(0) NULL DEFAULT CURRENT_TIMESTAMP(0),
  `update_user` bigint(0) NULL DEFAULT NULL,
  `update_time` datetime(0) NULL DEFAULT CURRENT_TIMESTAMP(0) ON UPDATE CURRENT_TIMESTAMP(0),
  `is_deleted` int(0) NULL DEFAULT 0,
  `tenant_id` varchar(12) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT '000000',
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `idx_competition`(`competition_id`) USING BTREE,
  INDEX `idx_date`(`schedule_date`) USING BTREE,
  INDEX `idx_tenant`(`tenant_id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '活动日程表' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of martial_activity_schedule

CREATE TABLE `martial_athlete`  (
  `id` bigint(0) NOT NULL COMMENT '主键ID',
  `order_id` bigint(0) NOT NULL COMMENT '订单ID',
  `competition_id` bigint(0) NOT NULL COMMENT '赛事ID',
  `project_id` bigint(0) NULL DEFAULT NULL COMMENT '项目ID',
  `player_name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '选手姓名',
  `player_no` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '参赛编号',
  `gender` int(0) NULL DEFAULT 1 COMMENT '性别(1-男,2-女)',
  `age` int(0) NULL DEFAULT NULL COMMENT '年龄',
  `birth_date` date NULL DEFAULT NULL COMMENT '出生日期',
  `nation` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '民族',
  `id_card` varchar(18) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '身份证号',
  `id_card_type` int(0) NULL DEFAULT 1 COMMENT '证件类型(1-身份证,2-护照,3-其他)',
  `contact_phone` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '联系电话',
  `organization` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '所属单位',
  `organization_type` int(0) NULL DEFAULT 1 COMMENT '单位类别(1-学校,2-协会,3-俱乐部,4-其他)',
  `team_name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '队伍名称',
  `category` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '组别',
  `order_num` int(0) NULL DEFAULT 0 COMMENT '出场顺序',
  `introduction` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '选手简介',
  `attachments` varchar(1000) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '附件(JSON数组)',
  `photo_url` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '照片URL',
  `registration_status` int(0) NULL DEFAULT 0 COMMENT '报名状态(0-待确认,1-已确认,2-已取消)',
  `competition_status` int(0) NULL DEFAULT 0 COMMENT '比赛状态(0-待出场,1-进行中,2-已完成)',
  `total_score` decimal(10, 3) NULL DEFAULT NULL COMMENT '总分',
  `ranking` int(0) NULL DEFAULT NULL COMMENT '排名',
  `remark` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '备注',
  `create_user` bigint(0) NULL DEFAULT NULL,
  `create_dept` bigint(0) NULL DEFAULT NULL,
  `create_time` datetime(0) NULL DEFAULT CURRENT_TIMESTAMP(0),
  `update_user` bigint(0) NULL DEFAULT NULL,
  `update_time` datetime(0) NULL DEFAULT CURRENT_TIMESTAMP(0) ON UPDATE CURRENT_TIMESTAMP(0),
  `status` int(0) NULL DEFAULT 1 COMMENT '状态(1-启用,2-禁用)',
  `is_deleted` int(0) NULL DEFAULT 0,
  `tenant_id` varchar(12) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT '000000',
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `idx_order`(`order_id`) USING BTREE,
  INDEX `idx_competition`(`competition_id`) USING BTREE,
  INDEX `idx_project`(`project_id`) USING BTREE,
  INDEX `idx_player_no`(`player_no`) USING BTREE,
  INDEX `idx_tenant`(`tenant_id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '参赛选手表' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of martial_athlete

CREATE TABLE `martial_banner`  (
  `id` bigint(0) NOT NULL COMMENT '主键ID',
  `title` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '轮播图标题',
  `position` int(0) NULL DEFAULT 1 COMMENT '显示位置(1-首页,2-赛事详情,3-其他)',
  `image_url` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '轮播图图片URL',
  `link_url` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '跳转链接',
  `sort_order` int(0) NULL DEFAULT 0 COMMENT '排序顺序',
  `start_time` datetime(0) NULL DEFAULT NULL COMMENT '开始显示时间',
  `end_time` datetime(0) NULL DEFAULT NULL COMMENT '结束显示时间',
  `click_count` int(0) NULL DEFAULT 0 COMMENT '点击次数',
  `status` int(0) NULL DEFAULT 1 COMMENT '状态(0-禁用,1-启用)',
  `create_user` bigint(0) NULL DEFAULT NULL,
  `create_dept` bigint(0) NULL DEFAULT NULL,
  `create_time` datetime(0) NULL DEFAULT CURRENT_TIMESTAMP(0),
  `update_user` bigint(0) NULL DEFAULT NULL,
  `update_time` datetime(0) NULL DEFAULT CURRENT_TIMESTAMP(0) ON UPDATE CURRENT_TIMESTAMP(0),
  `is_deleted` int(0) NULL DEFAULT 0,
  `tenant_id` varchar(12) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT '000000',
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `idx_sort`(`sort_order`) USING BTREE,
  INDEX `idx_tenant_status`(`tenant_id`, `status`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '轮播图表' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of martial_banner

CREATE TABLE `martial_competition`  (
  `id` bigint(0) NOT NULL COMMENT '主键ID',
  `competition_name` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '赛事名称',
  `competition_code` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '赛事编码(用于裁判登录)',
  `organizer` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '主办单位',
  `location` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '地区',
  `venue` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '详细地点',
  `registration_start_time` datetime(0) NULL DEFAULT NULL COMMENT '报名开始时间',
  `registration_end_time` datetime(0) NULL DEFAULT NULL COMMENT '报名结束时间',
  `competition_start_time` datetime(0) NULL DEFAULT NULL COMMENT '比赛开始时间',
  `competition_end_time` datetime(0) NULL DEFAULT NULL COMMENT '比赛结束时间',
  `introduction` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL COMMENT '赛事简介',
  `poster_images` varchar(1000) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '宣传图片(JSON数组)',
  `contact_person` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '联系人',
  `contact_phone` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '联系电话',
  `contact_email` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '联系邮箱',
  `rules` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL COMMENT '竞赛规则',
  `requirements` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL COMMENT '参赛要求',
  `awards` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL COMMENT '奖项设置',
  `regulation_files` varchar(1000) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '规程文件(JSON数组)',
  `total_participants` int(0) NULL DEFAULT 0 COMMENT '报名总人数',
  `total_amount` decimal(10, 2) NULL DEFAULT 0.00 COMMENT '报名总金额',
  `status` int(0) NULL DEFAULT 0 COMMENT '状态(0-未开始,1-报名中,2-比赛中,3-已结束,4-已取消)',
  `create_user` bigint(0) NULL DEFAULT NULL COMMENT '创建人',
  `create_dept` bigint(0) NULL DEFAULT NULL COMMENT '创建部门',
  `create_time` datetime(0) NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '创建时间',
  `update_user` bigint(0) NULL DEFAULT NULL COMMENT '更新人',
  `update_time` datetime(0) NULL DEFAULT CURRENT_TIMESTAMP(0) ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '更新时间',
  `is_deleted` int(0) NULL DEFAULT 0 COMMENT '是否已删除',
  `tenant_id` varchar(12) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT '000000' COMMENT '租户ID',
  PRIMARY KEY (`id`) USING BTREE,
  UNIQUE INDEX `uk_code`(`competition_code`) USING BTREE,
  INDEX `idx_tenant_status`(`tenant_id`, `status`) USING BTREE,
  INDEX `idx_time`(`competition_start_time`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '赛事信息表' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of martial_competition

CREATE TABLE `martial_deduction_item`  (
  `id` bigint(0) NOT NULL COMMENT '主键ID',
  `item_name` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '扣分项名称',
  `item_code` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '扣分项编码',
  `deduction_point` decimal(10, 3) NULL DEFAULT 0.000 COMMENT '扣分值',
  `category` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '分类',
  `applicable_projects` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '适用项目(JSON数组)',
  `description` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '描述',
  `sort_order` int(0) NULL DEFAULT 0 COMMENT '排序',
  `status` int(0) NULL DEFAULT 1 COMMENT '状态(0-禁用,1-启用)',
  `create_user` bigint(0) NULL DEFAULT NULL,
  `create_dept` bigint(0) NULL DEFAULT NULL,
  `create_time` datetime(0) NULL DEFAULT CURRENT_TIMESTAMP(0),
  `update_user` bigint(0) NULL DEFAULT NULL,
  `update_time` datetime(0) NULL DEFAULT CURRENT_TIMESTAMP(0) ON UPDATE CURRENT_TIMESTAMP(0),
  `is_deleted` int(0) NULL DEFAULT 0,
  `tenant_id` varchar(12) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT '000000',
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `idx_tenant_status`(`tenant_id`, `status`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '扣分项配置表' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of martial_deduction_item

CREATE TABLE `martial_info_publish`  (
  `id` bigint(0) NOT NULL COMMENT '主键ID',
  `competition_id` bigint(0) NULL DEFAULT NULL COMMENT '赛事ID(NULL表示全局)',
  `title` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '标题',
  `info_type` int(0) NULL DEFAULT 1 COMMENT '信息类型(1-通知,2-公告,3-重要)',
  `content` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL COMMENT '内容',
  `images` varchar(1000) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '图片(JSON数组)',
  `attachments` varchar(1000) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '附件(JSON)',
  `publish_time` datetime(0) NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '发布时间',
  `publisher_name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '发布人姓名',
  `is_published` int(0) NULL DEFAULT 0 COMMENT '是否已发布(0-未发布,1-已发布)',
  `sort_order` int(0) NULL DEFAULT 0 COMMENT '排序',
  `view_count` int(0) NULL DEFAULT 0 COMMENT '阅读次数',
  `status` int(0) NULL DEFAULT 1 COMMENT '状态(0-禁用,1-启用)',
  `create_user` bigint(0) NULL DEFAULT NULL,
  `create_dept` bigint(0) NULL DEFAULT NULL,
  `create_time` datetime(0) NULL DEFAULT CURRENT_TIMESTAMP(0),
  `update_user` bigint(0) NULL DEFAULT NULL,
  `update_time` datetime(0) NULL DEFAULT CURRENT_TIMESTAMP(0) ON UPDATE CURRENT_TIMESTAMP(0),
  `is_deleted` int(0) NULL DEFAULT 0,
  `tenant_id` varchar(12) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT '000000',
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `idx_competition`(`competition_id`) USING BTREE,
  INDEX `idx_type`(`info_type`) USING BTREE,
  INDEX `idx_tenant_status`(`tenant_id`, `status`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '信息发布表' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of martial_info_publish

CREATE TABLE `martial_judge`  (
  `id` bigint(0) NOT NULL COMMENT '主键ID',
  `name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '裁判姓名',
  `gender` int(0) NULL DEFAULT 1 COMMENT '性别(1-男,2-女)',
  `phone` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '手机号',
  `id_card` varchar(18) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '身份证号',
  `referee_type` int(0) NULL DEFAULT 2 COMMENT '裁判类型(1-裁判长,2-普通裁判)',
  `level` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '等级/职称',
  `specialty` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '擅长项目',
  `photo_url` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '照片URL',
  `remark` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '备注',
  `status` int(0) NULL DEFAULT 1 COMMENT '状态(0-禁用,1-启用)',
  `create_user` bigint(0) NULL DEFAULT NULL,
  `create_dept` bigint(0) NULL DEFAULT NULL,
  `create_time` datetime(0) NULL DEFAULT CURRENT_TIMESTAMP(0),
  `update_user` bigint(0) NULL DEFAULT NULL,
  `update_time` datetime(0) NULL DEFAULT CURRENT_TIMESTAMP(0) ON UPDATE CURRENT_TIMESTAMP(0),
  `is_deleted` int(0) NULL DEFAULT 0,
  `tenant_id` varchar(12) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT '000000',
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `idx_phone`(`phone`) USING BTREE,
  INDEX `idx_type`(`referee_type`) USING BTREE,
  INDEX `idx_tenant_status`(`tenant_id`, `status`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '裁判信息表' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of martial_judge

CREATE TABLE `martial_judge_invite`  (
  `id` bigint(0) NOT NULL COMMENT '主键ID',
  `competition_id` bigint(0) NOT NULL COMMENT '赛事ID',
  `judge_id` bigint(0) NULL DEFAULT NULL COMMENT '裁判ID',
  `invite_code` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '邀请码',
  `role` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '角色(judge-普通裁判,chief_judge-裁判长)',
  `venue_id` bigint(0) NULL DEFAULT NULL COMMENT '分配场地ID',
  `projects` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '分配项目(JSON数组)',
  `expire_time` datetime(0) NULL DEFAULT NULL COMMENT '过期时间',
  `is_used` int(0) NULL DEFAULT 0 COMMENT '是否已使用(0-未使用,1-已使用)',
  `use_time` datetime(0) NULL DEFAULT NULL COMMENT '使用时间',
  `device_info` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '设备信息',
  `login_ip` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '登录IP',
  `access_token` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '访问令牌',
  `token_expire_time` datetime(0) NULL DEFAULT NULL COMMENT 'token过期时间',
  `status` int(0) NULL DEFAULT 1 COMMENT '状态(0-禁用,1-启用)',
  `create_user` bigint(0) NULL DEFAULT NULL,
  `create_time` datetime(0) NULL DEFAULT CURRENT_TIMESTAMP(0),
  `update_user` bigint(0) NULL DEFAULT NULL,
  `update_time` datetime(0) NULL DEFAULT CURRENT_TIMESTAMP(0) ON UPDATE CURRENT_TIMESTAMP(0),
  `is_deleted` int(0) NULL DEFAULT 0,
  `tenant_id` varchar(12) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT '000000',
  PRIMARY KEY (`id`) USING BTREE,
  UNIQUE INDEX `uk_competition_code`(`competition_id`, `invite_code`) USING BTREE,
  INDEX `idx_judge`(`judge_id`) USING BTREE,
  INDEX `idx_tenant`(`tenant_id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '裁判邀请码表' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of martial_judge_invite

CREATE TABLE `martial_live_update`  (
  `id` bigint(0) NOT NULL COMMENT '主键ID',
  `competition_id` bigint(0) NOT NULL COMMENT '赛事ID',
  `schedule_id` bigint(0) NULL DEFAULT NULL COMMENT '赛程ID',
  `athlete_id` bigint(0) NULL DEFAULT NULL COMMENT '选手ID',
  `update_type` int(0) NULL DEFAULT 1 COMMENT '实况类型(1-赛况,2-比分,3-精彩瞬间)',
  `title` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '标题',
  `content` varchar(1000) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '内容',
  `images` varchar(1000) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '图片(JSON数组)',
  `score_info` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '比分信息',
  `update_time` datetime(0) NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '更新时间',
  `status` int(0) NULL DEFAULT 1 COMMENT '状态(1-启用,2-禁用)',
  `sort_order` int(0) NULL DEFAULT 0 COMMENT '排序',
  `create_user` bigint(0) NULL DEFAULT NULL,
  `create_dept` bigint(0) NULL DEFAULT NULL,
  `create_time` datetime(0) NULL DEFAULT CURRENT_TIMESTAMP(0),
  `update_user` bigint(0) NULL DEFAULT NULL,
  `is_deleted` int(0) NULL DEFAULT 0,
  `tenant_id` varchar(12) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT '000000',
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `idx_competition`(`competition_id`) USING BTREE,
  INDEX `idx_schedule`(`schedule_id`) USING BTREE,
  INDEX `idx_update_time`(`update_time`) USING BTREE,
  INDEX `idx_tenant`(`tenant_id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '比赛实况表' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of martial_live_update

CREATE TABLE `martial_project`  (
  `id` bigint(0) NOT NULL COMMENT '主键ID',
  `competition_id` bigint(0) NOT NULL COMMENT '赛事ID',
  `project_name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '项目名称',
  `project_code` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '项目编码',
  `category` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '组别(男子组/女子组)',
  `type` int(0) NULL DEFAULT 1 COMMENT '类型(1-个人,2-双人,3-集体)',
  `min_participants` int(0) NULL DEFAULT 1 COMMENT '最少参赛人数',
  `max_participants` int(0) NULL DEFAULT 1 COMMENT '最多参赛人数',
  `min_age` int(0) NULL DEFAULT NULL COMMENT '最小年龄',
  `max_age` int(0) NULL DEFAULT NULL COMMENT '最大年龄',
  `gender_limit` int(0) NULL DEFAULT 0 COMMENT '性别限制(0-不限,1-仅男,2-仅女)',
  `estimated_duration` int(0) NULL DEFAULT 5 COMMENT '预估时长(分钟)',
  `price` decimal(10, 2) NULL DEFAULT 0.00 COMMENT '报名费用',
  `registration_deadline` datetime(0) NULL DEFAULT NULL COMMENT '报名截止时间',
  `description` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '项目描述',
  `sort_order` int(0) NULL DEFAULT 0 COMMENT '排序',
  `status` int(0) NULL DEFAULT 1 COMMENT '状态(0-禁用,1-启用)',
  `create_user` bigint(0) NULL DEFAULT NULL,
  `create_dept` bigint(0) NULL DEFAULT NULL,
  `create_time` datetime(0) NULL DEFAULT CURRENT_TIMESTAMP(0),
  `update_user` bigint(0) NULL DEFAULT NULL,
  `update_time` datetime(0) NULL DEFAULT CURRENT_TIMESTAMP(0) ON UPDATE CURRENT_TIMESTAMP(0),
  `is_deleted` int(0) NULL DEFAULT 0,
  `tenant_id` varchar(12) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT '000000',
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `idx_competition`(`competition_id`) USING BTREE,
  INDEX `idx_tenant`(`tenant_id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '比赛项目表' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of martial_project

CREATE TABLE `martial_registration_order`  (
  `id` bigint(0) NOT NULL COMMENT '主键ID',
  `order_no` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '订单号',
  `competition_id` bigint(0) NOT NULL COMMENT '赛事ID',
  `user_id` bigint(0) NULL DEFAULT NULL COMMENT '用户ID',
  `user_name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '用户名',
  `contact_person` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '联系人',
  `contact_phone` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '联系电话',
  `organization` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '所属单位',
  `invoice_type` int(0) NULL DEFAULT 0 COMMENT '发票类型(0-不需要,1-普通,2-增值税)',
  `invoice_title` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '发票抬头',
  `invoice_tax_no` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '税号',
  `total_participants` int(0) NULL DEFAULT 0 COMMENT '参赛总人数',
  `total_amount` decimal(10, 2) NULL DEFAULT 0.00 COMMENT '订单总金额',
  `paid_amount` decimal(10, 2) NULL DEFAULT 0.00 COMMENT '已支付金额',
  `refund_amount` decimal(10, 2) NULL DEFAULT 0.00 COMMENT '退款金额',
  `payment_method` int(0) NULL DEFAULT NULL COMMENT '支付方式(1-微信,2-支付宝,3-线下)',
  `payment_time` datetime(0) NULL DEFAULT NULL COMMENT '支付时间',
  `transaction_no` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '支付交易号',
  `refund_time` datetime(0) NULL DEFAULT NULL COMMENT '退款时间',
  `refund_reason` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '退款原因',
  `status` int(0) NULL DEFAULT 0 COMMENT '状态(0-待支付,1-已支付,2-已取消,3-已退款)',
  `remark` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '备注',
  `create_user` bigint(0) NULL DEFAULT NULL,
  `create_dept` bigint(0) NULL DEFAULT NULL,
  `create_time` datetime(0) NULL DEFAULT CURRENT_TIMESTAMP(0),
  `update_user` bigint(0) NULL DEFAULT NULL,
  `update_time` datetime(0) NULL DEFAULT CURRENT_TIMESTAMP(0) ON UPDATE CURRENT_TIMESTAMP(0),
  `is_deleted` int(0) NULL DEFAULT 0,
  `tenant_id` varchar(12) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT '000000',
  PRIMARY KEY (`id`) USING BTREE,
  UNIQUE INDEX `uk_order_no`(`order_no`) USING BTREE,
  INDEX `idx_competition`(`competition_id`) USING BTREE,
  INDEX `idx_user`(`user_id`) USING BTREE,
  INDEX `idx_tenant_status`(`tenant_id`, `status`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '报名订单表' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of martial_registration_order

CREATE TABLE `martial_result`  (
  `id` bigint(0) NOT NULL COMMENT '主键ID',
  `competition_id` bigint(0) NOT NULL COMMENT '赛事ID',
  `athlete_id` bigint(0) NOT NULL COMMENT '选手ID',
  `project_id` bigint(0) NULL DEFAULT NULL COMMENT '项目ID',
  `venue_id` bigint(0) NULL DEFAULT NULL COMMENT '场地ID',
  `player_name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '选手姓名',
  `team_name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '队伍名称',
  `total_score` decimal(10, 3) NULL DEFAULT NULL COMMENT '总分(所有裁判平均分)',
  `max_score` decimal(10, 3) NULL DEFAULT NULL COMMENT '最高分(去掉用)',
  `min_score` decimal(10, 3) NULL DEFAULT NULL COMMENT '最低分(去掉用)',
  `valid_score_count` int(0) NULL DEFAULT 0 COMMENT '有效评分数',
  `original_score` decimal(10, 3) NULL DEFAULT NULL COMMENT '原始总分',
  `adjusted_score` decimal(10, 3) NULL DEFAULT NULL COMMENT '调整后总分',
  `difficulty_coefficient` decimal(5, 2) NULL DEFAULT 1.00 COMMENT '难度系数',
  `final_score` decimal(10, 3) NULL DEFAULT NULL COMMENT '最终得分(总分*系数)',
  `adjust_range` decimal(10, 3) NULL DEFAULT 0.005 COMMENT '允许调整范围',
  `adjust_note` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '调整说明',
  `ranking` int(0) NULL DEFAULT NULL COMMENT '排名',
  `medal` int(0) NULL DEFAULT NULL COMMENT '奖牌(1-金牌,2-银牌,3-铜牌)',
  `is_final` int(0) NULL DEFAULT 0 COMMENT '是否最终成绩(0-否,1-是)',
  `publish_time` datetime(0) NULL DEFAULT NULL COMMENT '发布时间',
  `create_user` bigint(0) NULL DEFAULT NULL,
  `create_dept` bigint(0) NULL DEFAULT NULL,
  `create_time` datetime(0) NULL DEFAULT CURRENT_TIMESTAMP(0),
  `update_user` bigint(0) NULL DEFAULT NULL,
  `update_time` datetime(0) NULL DEFAULT CURRENT_TIMESTAMP(0) ON UPDATE CURRENT_TIMESTAMP(0),
  `status` int(0) NULL DEFAULT 1 COMMENT '状态(1-启用,2-禁用)',
  `is_deleted` int(0) NULL DEFAULT 0,
  `tenant_id` varchar(12) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT '000000',
  PRIMARY KEY (`id`) USING BTREE,
  UNIQUE INDEX `uk_competition_athlete`(`competition_id`, `athlete_id`, `project_id`) USING BTREE,
  INDEX `idx_athlete`(`athlete_id`) USING BTREE,
  INDEX `idx_project`(`project_id`) USING BTREE,
  INDEX `idx_ranking`(`ranking`) USING BTREE,
  INDEX `idx_tenant`(`tenant_id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '成绩表' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of martial_result

CREATE TABLE `martial_schedule`  (
  `id` bigint(0) NOT NULL COMMENT '主键ID',
  `competition_id` bigint(0) NOT NULL COMMENT '赛事ID',
  `order_id` bigint(0) NULL DEFAULT NULL COMMENT '订单ID',
  `group_title` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '分组标题',
  `group_code` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '分组编码',
  `group_type` int(0) NULL DEFAULT 1 COMMENT '分组类型(1-个人,2-双人,3-集体)',
  `venue_id` bigint(0) NULL DEFAULT NULL COMMENT '场地ID',
  `project_id` bigint(0) NULL DEFAULT NULL COMMENT '项目ID',
  `schedule_date` date NULL DEFAULT NULL COMMENT '比赛日期',
  `time_slot` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '时间段',
  `start_time` datetime(0) NULL DEFAULT NULL COMMENT '开始时间',
  `end_time` datetime(0) NULL DEFAULT NULL COMMENT '结束时间',
  `participant_count` int(0) NULL DEFAULT 0 COMMENT '参赛队伍数/人数',
  `estimated_duration` int(0) NULL DEFAULT 0 COMMENT '预估时长(分钟)',
  `is_confirmed` int(0) NULL DEFAULT 0 COMMENT '是否已确认(0-未确认,1-已确认)',
  `status` int(0) NULL DEFAULT 0 COMMENT '状态(0-待开始,1-进行中,2-已完成)',
  `remark` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '备注',
  `create_user` bigint(0) NULL DEFAULT NULL,
  `create_dept` bigint(0) NULL DEFAULT NULL,
  `create_time` datetime(0) NULL DEFAULT CURRENT_TIMESTAMP(0),
  `update_user` bigint(0) NULL DEFAULT NULL,
  `update_time` datetime(0) NULL DEFAULT CURRENT_TIMESTAMP(0) ON UPDATE CURRENT_TIMESTAMP(0),
  `is_deleted` int(0) NULL DEFAULT 0,
  `tenant_id` varchar(12) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT '000000',
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `idx_competition`(`competition_id`) USING BTREE,
  INDEX `idx_venue`(`venue_id`) USING BTREE,
  INDEX `idx_date_time`(`schedule_date`, `time_slot`) USING BTREE,
  INDEX `idx_tenant`(`tenant_id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '赛程编排表' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of martial_schedule

CREATE TABLE `martial_schedule_athlete`  (
  `id` bigint(0) NOT NULL COMMENT '主键ID',
  `schedule_id` bigint(0) NOT NULL COMMENT '赛程ID',
  `athlete_id` bigint(0) NOT NULL COMMENT '选手ID',
  `competition_id` bigint(0) NOT NULL COMMENT '赛事ID',
  `order_num` int(0) NULL DEFAULT 0 COMMENT '出场顺序',
  `is_completed` int(0) NULL DEFAULT 0 COMMENT '是否已完赛(0-未完赛,1-已完赛)',
  `is_refereed` int(0) NULL DEFAULT 0 COMMENT '是否已裁判(0-未裁判,1-已裁判)',
  `create_user` bigint(0) NULL DEFAULT NULL,
  `create_time` datetime(0) NULL DEFAULT CURRENT_TIMESTAMP(0),
  `update_user` bigint(0) NULL DEFAULT NULL,
  `update_time` datetime(0) NULL DEFAULT CURRENT_TIMESTAMP(0) ON UPDATE CURRENT_TIMESTAMP(0),
  `status` int(0) NULL DEFAULT 1 COMMENT '状态(1-启用,2-禁用)',
  `is_deleted` int(0) NULL DEFAULT 0,
  `tenant_id` varchar(12) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT '000000',
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `idx_schedule`(`schedule_id`) USING BTREE,
  INDEX `idx_athlete`(`athlete_id`) USING BTREE,
  INDEX `idx_competition`(`competition_id`) USING BTREE,
  INDEX `idx_tenant`(`tenant_id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '选手赛程关联表' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of martial_schedule_athlete

CREATE TABLE `martial_score`  (
  `id` bigint(0) NOT NULL COMMENT '主键ID',
  `competition_id` bigint(0) NOT NULL COMMENT '赛事ID',
  `athlete_id` bigint(0) NOT NULL COMMENT '选手ID',
  `project_id` bigint(0) NULL DEFAULT NULL COMMENT '项目ID',
  `schedule_id` bigint(0) NULL DEFAULT NULL COMMENT '赛程ID',
  `venue_id` bigint(0) NULL DEFAULT NULL COMMENT '场地ID',
  `judge_id` bigint(0) NOT NULL COMMENT '裁判ID',
  `judge_name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '裁判姓名',
  `score` decimal(10, 3) NOT NULL COMMENT '评分(5.000-10.000)',
  `original_score` decimal(10, 3) NULL DEFAULT NULL COMMENT '原始评分(修改前)',
  `deduction_items` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '选中的扣分项ID(JSON数组)',
  `note` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '评分备注',
  `modify_reason` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '修改原因',
  `score_time` datetime(0) NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '评分时间',
  `modify_time` datetime(0) NULL DEFAULT NULL COMMENT '修改时间',
  `ip_address` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '评分IP地址',
  `status` int(0) NULL DEFAULT 1 COMMENT '状态(1-正常,2-已修改,3-已作废)',
  `create_user` bigint(0) NULL DEFAULT NULL,
  `create_dept` bigint(0) NULL DEFAULT NULL,
  `create_time` datetime(0) NULL DEFAULT CURRENT_TIMESTAMP(0),
  `update_user` bigint(0) NULL DEFAULT NULL,
  `update_time` datetime(0) NULL DEFAULT CURRENT_TIMESTAMP(0) ON UPDATE CURRENT_TIMESTAMP(0),
  `is_deleted` int(0) NULL DEFAULT 0,
  `tenant_id` varchar(12) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT '000000',
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `idx_competition`(`competition_id`) USING BTREE,
  INDEX `idx_athlete`(`athlete_id`) USING BTREE,
  INDEX `idx_judge`(`judge_id`) USING BTREE,
  INDEX `idx_tenant`(`tenant_id`) USING BTREE,
  INDEX `idx_venue`(`venue_id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '评分记录表' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of martial_score

CREATE TABLE `martial_venue`  (
  `id` bigint(0) NOT NULL COMMENT '主键ID',
  `competition_id` bigint(0) NOT NULL COMMENT '赛事ID',
  `venue_name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '场地名称',
  `venue_code` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '场地编码',
  `location` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '场地位置',
  `capacity` int(0) NULL DEFAULT 0 COMMENT '容纳人数',
  `facilities` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '设施说明',
  `status` int(0) NULL DEFAULT 1 COMMENT '状态(0-禁用,1-启用)',
  `create_user` bigint(0) NULL DEFAULT NULL,
  `create_dept` bigint(0) NULL DEFAULT NULL,
  `create_time` datetime(0) NULL DEFAULT CURRENT_TIMESTAMP(0),
  `update_user` bigint(0) NULL DEFAULT NULL,
  `update_time` datetime(0) NULL DEFAULT CURRENT_TIMESTAMP(0) ON UPDATE CURRENT_TIMESTAMP(0),
  `is_deleted` int(0) NULL DEFAULT 0,
  `tenant_id` varchar(12) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT '000000',
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `idx_competition`(`competition_id`) USING BTREE,
  INDEX `idx_tenant`(`tenant_id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '场地信息表' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of martial_venue

