92 lines
5.4 KiB
SQL
92 lines
5.4 KiB
SQL
-- 赛事规程管理相关表
|
||
|
||
-- 1. 赛事规程附件表
|
||
DROP TABLE IF EXISTS `martial_competition_rules_attachment`;
|
||
CREATE TABLE `martial_competition_rules_attachment` (
|
||
`id` bigint NOT NULL COMMENT '主键ID',
|
||
`tenant_id` varchar(12) DEFAULT '000000' COMMENT '租户ID',
|
||
`competition_id` bigint NOT NULL COMMENT '赛事ID',
|
||
`file_name` varchar(255) NOT NULL COMMENT '文件名称',
|
||
`file_url` varchar(500) NOT NULL COMMENT '文件URL',
|
||
`file_size` bigint DEFAULT NULL COMMENT '文件大小(字节)',
|
||
`file_type` varchar(20) DEFAULT NULL COMMENT '文件类型(pdf/doc/docx/xls/xlsx等)',
|
||
`order_num` int DEFAULT 0 COMMENT '排序序号',
|
||
`status` int DEFAULT 1 COMMENT '状态(1-启用 0-禁用)',
|
||
`create_user` bigint DEFAULT NULL COMMENT '创建人',
|
||
`create_dept` bigint DEFAULT NULL COMMENT '创建部门',
|
||
`create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||
`update_user` bigint DEFAULT NULL COMMENT '更新人',
|
||
`update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||
`is_deleted` int DEFAULT 0 COMMENT '是否已删除(0-否 1-是)',
|
||
PRIMARY KEY (`id`),
|
||
KEY `idx_competition_id` (`competition_id`),
|
||
KEY `idx_tenant_id` (`tenant_id`)
|
||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='赛事规程附件表';
|
||
|
||
-- 2. 赛事规程章节表
|
||
DROP TABLE IF EXISTS `martial_competition_rules_chapter`;
|
||
CREATE TABLE `martial_competition_rules_chapter` (
|
||
`id` bigint NOT NULL COMMENT '主键ID',
|
||
`tenant_id` varchar(12) DEFAULT '000000' COMMENT '租户ID',
|
||
`competition_id` bigint NOT NULL COMMENT '赛事ID',
|
||
`chapter_number` varchar(50) NOT NULL COMMENT '章节编号(如:第一章)',
|
||
`title` varchar(200) NOT NULL COMMENT '章节标题',
|
||
`order_num` int DEFAULT 0 COMMENT '排序序号',
|
||
`status` int DEFAULT 1 COMMENT '状态(1-启用 0-禁用)',
|
||
`create_user` bigint DEFAULT NULL COMMENT '创建人',
|
||
`create_dept` bigint DEFAULT NULL COMMENT '创建部门',
|
||
`create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||
`update_user` bigint DEFAULT NULL COMMENT '更新人',
|
||
`update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||
`is_deleted` int DEFAULT 0 COMMENT '是否已删除(0-否 1-是)',
|
||
PRIMARY KEY (`id`),
|
||
KEY `idx_competition_id` (`competition_id`),
|
||
KEY `idx_tenant_id` (`tenant_id`)
|
||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='赛事规程章节表';
|
||
|
||
-- 3. 赛事规程内容表
|
||
DROP TABLE IF EXISTS `martial_competition_rules_content`;
|
||
CREATE TABLE `martial_competition_rules_content` (
|
||
`id` bigint NOT NULL COMMENT '主键ID',
|
||
`tenant_id` varchar(12) DEFAULT '000000' COMMENT '租户ID',
|
||
`chapter_id` bigint NOT NULL COMMENT '章节ID',
|
||
`content` text NOT NULL COMMENT '规程内容',
|
||
`order_num` int DEFAULT 0 COMMENT '排序序号',
|
||
`status` int DEFAULT 1 COMMENT '状态(1-启用 0-禁用)',
|
||
`create_user` bigint DEFAULT NULL COMMENT '创建人',
|
||
`create_dept` bigint DEFAULT NULL COMMENT '创建部门',
|
||
`create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||
`update_user` bigint DEFAULT NULL COMMENT '更新人',
|
||
`update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||
`is_deleted` int DEFAULT 0 COMMENT '是否已删除(0-否 1-是)',
|
||
PRIMARY KEY (`id`),
|
||
KEY `idx_chapter_id` (`chapter_id`),
|
||
KEY `idx_tenant_id` (`tenant_id`)
|
||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='赛事规程内容表';
|
||
|
||
-- 插入测试数据
|
||
-- 假设赛事ID为1
|
||
INSERT INTO `martial_competition_rules_attachment` (`id`, `tenant_id`, `competition_id`, `file_name`, `file_url`, `file_size`, `file_type`, `order_num`, `status`) VALUES
|
||
(1, '000000', 1, '2025年郑州武术大赛规程.pdf', 'http://example.com/files/rules.pdf', 2621440, 'pdf', 1, 1),
|
||
(2, '000000', 1, '参赛报名表.docx', 'http://example.com/files/form.docx', 159744, 'docx', 2, 1);
|
||
|
||
INSERT INTO `martial_competition_rules_chapter` (`id`, `tenant_id`, `competition_id`, `chapter_number`, `title`, `order_num`, `status`) VALUES
|
||
(1, '000000', 1, '第一章', '总则', 1, 1),
|
||
(2, '000000', 1, '第二章', '参赛资格', 2, 1),
|
||
(3, '000000', 1, '第三章', '比赛规则', 3, 1),
|
||
(4, '000000', 1, '第四章', '奖项设置', 4, 1);
|
||
|
||
INSERT INTO `martial_competition_rules_content` (`id`, `tenant_id`, `chapter_id`, `content`, `order_num`, `status`) VALUES
|
||
(1, '000000', 1, '1.1 本次比赛遵循国际武术联合会竞赛规则。', 1, 1),
|
||
(2, '000000', 1, '1.2 所有参赛选手必须持有效证件参赛。', 2, 1),
|
||
(3, '000000', 1, '1.3 参赛选手须服从裁判判决,不得有违规行为。', 3, 1),
|
||
(4, '000000', 2, '2.1 参赛选手年龄须在18-45周岁之间。', 1, 1),
|
||
(5, '000000', 2, '2.2 参赛选手须持有武术等级证书或相关证明。', 2, 1),
|
||
(6, '000000', 2, '2.3 参赛选手须通过健康检查,身体状况良好。', 3, 1),
|
||
(7, '000000', 3, '3.1 比赛采用单败淘汰制。', 1, 1),
|
||
(8, '000000', 3, '3.2 每场比赛时间为3分钟,分3局进行。', 2, 1),
|
||
(9, '000000', 3, '3.3 得分规则按照国际标准执行。', 3, 1),
|
||
(10, '000000', 4, '4.1 各组别设金、银、铜牌各一枚。', 1, 1),
|
||
(11, '000000', 4, '4.2 设最佳表现奖、体育道德风尚奖等特别奖项。', 2, 1),
|
||
(12, '000000', 4, '4.3 所有参赛选手均可获得参赛证书。', 3, 1);
|