287 lines
16 KiB
SQL
287 lines
16 KiB
SQL
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 '更新时间',
|
||
is_delete int default 0 not null 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 '嘉宾排序(数字越小越靠前)',
|
||
is_delete int default 0 not 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 page_image
|
||
(
|
||
id int auto_increment comment '图片ID(主键)'
|
||
primary key,
|
||
page varchar(50) not null comment '所属页面(固定值:home-首页,base-基地概况,research-科学研究,academic-学术交流,service-社会服务,cases-案例资源)',
|
||
image_url varchar(512) not null comment '图片URL',
|
||
sort int not null comment '排序(首页1-3对应轮播顺序,其他页面固定1)',
|
||
create_time datetime default CURRENT_TIMESTAMP null comment '创建时间',
|
||
update_time datetime default CURRENT_TIMESTAMP null on update CURRENT_TIMESTAMP comment '更新时间',
|
||
constraint uk_page_sort
|
||
unique (page, sort) comment '唯一约束:同一页面+排序值只能有一条记录(控制数量)'
|
||
)
|
||
comment '页面图片表(首页3张轮播,其他页面1张顶部图)' charset = utf8mb4;
|
||
|
||
create index idx_page
|
||
on page_image (page)
|
||
comment '按页面查询图片';
|
||
|
||
create table social_service
|
||
(
|
||
id bigint auto_increment comment '主键ID'
|
||
primary key,
|
||
title varchar(255) not null comment '标题',
|
||
subtitle varchar(255) null comment '副标题',
|
||
cover_url varchar(512) null comment '封面图片URL',
|
||
intro varchar(1000) null comment '简介(纯文字)',
|
||
content longtext null comment '内容(Markdown格式)',
|
||
image_editors varchar(512) null comment '图片编辑者名单(多个用逗号分隔)',
|
||
text_editors varchar(512) null comment '文字编辑者名单(多个用逗号分隔)',
|
||
chief_editor varchar(100) null comment '总编辑',
|
||
proofreaders varchar(512) null comment '校对者名单(多个用逗号分隔)',
|
||
reviewers varchar(512) null comment '审核者名单(多个用逗号分隔)',
|
||
publish_time datetime default CURRENT_TIMESTAMP null comment '发布时间(默认插入时的当前时间)',
|
||
update_time datetime default CURRENT_TIMESTAMP null on update CURRENT_TIMESTAMP comment '最后更改时间(自动更新)',
|
||
is_delete int default 0 not null comment '软删除'
|
||
)
|
||
comment '社会服务表' charset = utf8mb4;
|
||
|
||
create table social_service_governmentprogram
|
||
(
|
||
id bigint auto_increment comment '主键ID'
|
||
primary key,
|
||
title varchar(255) not null comment '标题',
|
||
subtitle varchar(255) null comment '副标题',
|
||
cover_url varchar(512) null comment '封面图片URL',
|
||
intro varchar(1000) null comment '简介(纯文字)',
|
||
content longtext null comment '内容(Markdown格式)',
|
||
image_editors varchar(512) null comment '图片编辑者名单(多个用逗号分隔)',
|
||
text_editors varchar(512) null comment '文字编辑者名单(多个用逗号分隔)',
|
||
chief_editor varchar(100) null comment '总编辑',
|
||
proofreaders varchar(512) null comment '校对者名单(多个用逗号分隔)',
|
||
reviewers varchar(512) null comment '审核者名单(多个用逗号分隔)',
|
||
publish_time datetime default CURRENT_TIMESTAMP null comment '发布时间(默认插入时的当前时间)',
|
||
update_time datetime default CURRENT_TIMESTAMP null on update CURRENT_TIMESTAMP comment '最后更改时间(自动更新)',
|
||
is_delete int default 0 not null comment '软删除'
|
||
)
|
||
comment '乡村政府项目表' charset = utf8mb4;
|
||
|
||
create table social_service_internship
|
||
(
|
||
id bigint auto_increment comment '主键ID'
|
||
primary key,
|
||
title varchar(255) not null comment '标题',
|
||
subtitle varchar(255) null comment '副标题',
|
||
cover_url varchar(512) null comment '封面图片URL',
|
||
intro varchar(1000) null comment '简介(纯文字)',
|
||
content longtext null comment '内容(Markdown格式)',
|
||
image_editors varchar(512) null comment '图片编辑者名单(多个用逗号分隔)',
|
||
text_editors varchar(512) null comment '文字编辑者名单(多个用逗号分隔)',
|
||
chief_editor varchar(100) null comment '总编辑',
|
||
proofreaders varchar(512) null comment '校对者名单(多个用逗号分隔)',
|
||
reviewers varchar(512) null comment '审核者名单(多个用逗号分隔)',
|
||
publish_time datetime default CURRENT_TIMESTAMP null comment '发布时间(默认插入时的当前时间)',
|
||
update_time datetime default CURRENT_TIMESTAMP null on update CURRENT_TIMESTAMP comment '最后更改时间(自动更新)',
|
||
is_delete int default 0 not null comment '软删除'
|
||
)
|
||
comment '研究实习项目表' charset = utf8mb4;
|
||
|
||
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;
|
||
|