修改总体sql
This commit is contained in:
@@ -0,0 +1,206 @@
|
||||
create table article
|
||||
(
|
||||
id bigint auto_increment
|
||||
primary key,
|
||||
title varchar(100) not null,
|
||||
topic varchar(50) not null,
|
||||
excerpt varchar(255) not null,
|
||||
cover varchar(255) not null,
|
||||
content text not null,
|
||||
create_at datetime default (now()) not null,
|
||||
update_at datetime default (now()) not null on update CURRENT_TIMESTAMP,
|
||||
is_delete tinyint not null
|
||||
);
|
||||
|
||||
create table baseoverview
|
||||
(
|
||||
id int auto_increment
|
||||
primary key,
|
||||
introduction longtext null comment '基地简介',
|
||||
regulations longtext null comment '规章制度',
|
||||
address varchar(255) null,
|
||||
phone varchar(20) null,
|
||||
email varchar(100) null,
|
||||
website varchar(100) null,
|
||||
director varchar(255) null comment '主任姓名',
|
||||
deputy_director varchar(255) null comment '副主任姓名',
|
||||
researchers varchar(255) null comment '研究人员'
|
||||
);
|
||||
|
||||
create table course
|
||||
(
|
||||
id int auto_increment comment '课程ID(主键)'
|
||||
primary key,
|
||||
title varchar(255) not null comment '课程标题',
|
||||
subtitle varchar(255) default '' null comment '课程副标题',
|
||||
cover_url varchar(512) default '' null comment '课程封面图URL',
|
||||
intro text null comment '课程简介(对应“课程简介”模块)',
|
||||
status tinyint default 1 null comment '课程状态(0删除,1-已发布)',
|
||||
create_time datetime default CURRENT_TIMESTAMP null comment '创建时间',
|
||||
update_time datetime default CURRENT_TIMESTAMP null on update CURRENT_TIMESTAMP comment '更新时间'
|
||||
)
|
||||
comment '课程主表' charset = utf8mb4;
|
||||
|
||||
create table course_activity
|
||||
(
|
||||
id int auto_increment comment '活动ID(主键)'
|
||||
primary key,
|
||||
course_id int not null comment '关联课程ID(外键)',
|
||||
title varchar(255) not null comment '活动标题(如“第1章作业”“期中测试”)',
|
||||
activity_type tinyint default 1 null comment '活动类型(1-作业,2-考试,3-讨论,4-直播)',
|
||||
content text null comment '活动详情(如作业要求、考试说明)',
|
||||
start_time datetime null comment '活动开始时间(如直播时间、作业发布时间)',
|
||||
end_time datetime null comment '活动结束时间(如作业截止时间)',
|
||||
sort int default 0 null comment '排序',
|
||||
constraint fk_activity_course
|
||||
foreign key (course_id) references course (id)
|
||||
on delete cascade
|
||||
)
|
||||
comment '学生活动表' charset = utf8mb4;
|
||||
|
||||
create index idx_course_id
|
||||
on course_activity (course_id)
|
||||
comment '按课程查询活动';
|
||||
|
||||
create table course_content
|
||||
(
|
||||
id int auto_increment comment '内容ID(主键)'
|
||||
primary key,
|
||||
course_id int not null comment '关联课程ID(外键)',
|
||||
parent_id int default 0 null comment '父级ID(0表示章节,>0表示小节,关联自身id)',
|
||||
title varchar(255) not null comment '章节/小节标题',
|
||||
content text null comment '内容详情(如视频地址、图文内容等)',
|
||||
sort int default 0 null comment '排序(数字越小越靠前)',
|
||||
constraint fk_content_course
|
||||
foreign key (course_id) references course (id)
|
||||
on delete cascade
|
||||
)
|
||||
comment '课程内容表(章节/小节)' charset = utf8mb4;
|
||||
|
||||
create index idx_course_id
|
||||
on course_content (course_id)
|
||||
comment '按课程查询内容';
|
||||
|
||||
create index idx_parent_id
|
||||
on course_content (parent_id)
|
||||
comment '按父级查询子内容';
|
||||
|
||||
create table course_resource
|
||||
(
|
||||
id int auto_increment comment '资源ID(主键)'
|
||||
primary key,
|
||||
course_id int not null comment '关联课程ID(外键)',
|
||||
title varchar(255) not null comment '资源标题(如“第1章课件.pdf”)',
|
||||
resource_url varchar(512) not null comment '资源文件URL(如PDF、压缩包地址)',
|
||||
size int default 0 null comment '文件大小(KB)',
|
||||
sort int default 0 null comment '排序',
|
||||
constraint fk_resource_course
|
||||
foreign key (course_id) references course (id)
|
||||
on delete cascade
|
||||
)
|
||||
comment '课程拓展资源表' charset = utf8mb4;
|
||||
|
||||
create index idx_course_id
|
||||
on course_resource (course_id)
|
||||
comment '按课程查询资源';
|
||||
|
||||
create table course_teacher
|
||||
(
|
||||
id int auto_increment comment '关联ID(主键)'
|
||||
primary key,
|
||||
course_id int not null comment '关联课程ID(外键)',
|
||||
teacher_id int not null comment '教师ID(建议关联用户表user.id)',
|
||||
name varchar(100) not null comment '教师姓名',
|
||||
title varchar(200) default '' null comment '教师头衔(如“XXX大学教授”)',
|
||||
avatar varchar(512) default '' null comment '教师头像URL',
|
||||
intro text null comment '教师简介',
|
||||
sort int default 0 null comment '排序(团队展示顺序)',
|
||||
constraint fk_teacher_course
|
||||
foreign key (course_id) references course (id)
|
||||
on delete cascade
|
||||
)
|
||||
comment '教学团队表' charset = utf8mb4;
|
||||
|
||||
create index idx_course_id
|
||||
on course_teacher (course_id)
|
||||
comment '按课程查询教师';
|
||||
|
||||
create table devproject
|
||||
(
|
||||
id int not null comment '基地开放项目ID'
|
||||
primary key,
|
||||
basic_dev_project_management_system text null comment '基础开发项目管理制度',
|
||||
basic_dev_project_initiation_result text null comment '基础开发项目立项结果',
|
||||
basic_dev_project_midterm_inspection text null comment '基础开发项目中期检查',
|
||||
basic_dev_project_achievements text null comment '基础开发项目成果'
|
||||
)
|
||||
comment '基地开放项目表';
|
||||
|
||||
create table meeting
|
||||
(
|
||||
id int auto_increment comment '会议ID(主键)'
|
||||
primary key,
|
||||
theme varchar(255) not null comment '会议主题',
|
||||
subtitle varchar(255) default '' null comment '会议副标题(允许为空)',
|
||||
intro text null comment '会议简介(支持长文本,可存Markdown)',
|
||||
cover_url varchar(512) default '' null comment '会议封面图片URL(允许为空)',
|
||||
schedule_image_url varchar(512) default '' null comment '会议日程图片URL(允许为空,无日程图时存空字符串)',
|
||||
start_time datetime not null comment '会议开始时间',
|
||||
end_time datetime not null comment '会议结束时间',
|
||||
create_time datetime default CURRENT_TIMESTAMP null comment '创建时间',
|
||||
update_time datetime default CURRENT_TIMESTAMP null on update CURRENT_TIMESTAMP comment '更新时间'
|
||||
)
|
||||
comment '会议主表' charset = utf8mb4;
|
||||
|
||||
create table meeting_speaker
|
||||
(
|
||||
id int auto_increment comment '嘉宾ID(主键)'
|
||||
primary key,
|
||||
meeting_id int not null comment '关联会议ID(外键,对应meeting表id)',
|
||||
name varchar(100) not null comment '嘉宾姓名',
|
||||
title varchar(200) default '' null comment '嘉宾头衔(如:XX公司技术总监)',
|
||||
avatar varchar(512) default '' null comment '嘉宾头像URL',
|
||||
intro text null comment '嘉宾简介',
|
||||
sort int default 0 null comment '嘉宾排序(数字越小越靠前)',
|
||||
constraint fk_meeting_speaker_meeting
|
||||
foreign key (meeting_id) references meeting (id)
|
||||
on delete cascade
|
||||
)
|
||||
comment '会议演讲嘉宾表' charset = utf8mb4;
|
||||
|
||||
create index idx_meeting_id
|
||||
on meeting_speaker (meeting_id)
|
||||
comment '索引:优化按会议查询嘉宾';
|
||||
|
||||
create table teaching_case
|
||||
(
|
||||
id int auto_increment comment '案例ID(主键)'
|
||||
primary key,
|
||||
title varchar(255) not null comment '案例标题',
|
||||
tutor_name varchar(100) not null comment '导师姓名',
|
||||
tutor_title varchar(200) default '' null comment '导师头衔(如:XX讲师)',
|
||||
student_names varchar(500) not null comment '学生姓名(多人用逗号分隔,如“张三,李四”)',
|
||||
content text not null comment '案例内容(详细描述)',
|
||||
cover_url varchar(512) default '' null comment '案例封面图URL',
|
||||
sort int default 0 null comment '排序(数字越小越靠前)',
|
||||
create_time datetime default CURRENT_TIMESTAMP null comment '创建时间',
|
||||
update_time datetime default CURRENT_TIMESTAMP null on update CURRENT_TIMESTAMP comment '更新时间'
|
||||
)
|
||||
comment '独立教学案例表' charset = utf8mb4;
|
||||
|
||||
create table video_case
|
||||
(
|
||||
id int auto_increment comment '视频案例ID(主键)'
|
||||
primary key,
|
||||
title varchar(255) not null comment '视频案例标题',
|
||||
intro text null comment '视频简介(描述案例背景、内容等)',
|
||||
video_url varchar(512) not null comment '视频播放地址(如MP4 URL、视频平台嵌入链接)',
|
||||
duration int default 0 null comment '视频时长(秒,可选,用于前端展示)',
|
||||
designer_names varchar(1000) not null comment '设计人员名单(多人用逗号分隔,如“张三,李四,王五”)',
|
||||
tutor_names varchar(1000) not null comment '指导老师名单(多人用逗号分隔,如“赵六,钱七”)',
|
||||
sort int default 0 null comment '排序(数字越小越靠前)',
|
||||
create_time datetime default CURRENT_TIMESTAMP null comment '创建时间',
|
||||
update_time datetime default CURRENT_TIMESTAMP null on update CURRENT_TIMESTAMP comment '更新时间'
|
||||
)
|
||||
comment '视频案例表(独立存储,不关联其他表)' charset = utf8mb4;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user