智慧教务系统
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

7.5 KiB

school_course_schedule 表文档

表概述

表名: school_course_schedule
功能: 课程安排管理表,负责管理教务系统中的课程排课信息,包括上课时间、场地安排、教练分配、学员管理等核心排课功能

字段说明

Field	Type	Collation	Null	Key	Default	Extra	Privileges	Comment
id	int	NULL	NO	PRI	NULL	auto_increment	select,insert,update,references	课程安排编号
campus_id	int	NULL	NO		NULL		select,insert,update,references	校区ID
venue_id	int	NULL	NO	MUL	NULL		select,insert,update,references	场地ID
course_date	date	NULL	NO	MUL	NULL		select,insert,update,references	上课日期
time_slot	varchar(255)	utf8mb4_general_ci	NO		NULL		select,insert,update,references	上课时段
start_time	time	NULL	YES		NULL		select,insert,update,references	
end_time	time	NULL	YES		NULL		select,insert,update,references	
course_id	int	NULL	NO		NULL		select,insert,update,references	课程ID
coach_id	int	NULL	NO	MUL	NULL		select,insert,update,references	上课教练ID
participants	json	NULL	YES		NULL		select,insert,update,references	参与人员列表,存储为JSON数组,包含学员ID和来源信息
student_ids	json	NULL	YES		NULL		select,insert,update,references	上课学生ID列表,存储为JSON数组
available_capacity	int	NULL	YES		NULL		select,insert,update,references	根据场地容量判断的可安排学员位置数量
status	enum('pending','upcoming','ongoing','completed')	utf8mb4_general_ci	YES		pending		select,insert,update,references	课程状态: pending-待开始, upcoming-即将开始, ongoing-进行中, completed-已结束
auto_schedule	tinyint(1)	NULL	YES		NULL		select,insert,update,references	是否自动排课1是0否
created_by	enum('manual','system')	utf8mb4_general_ci	NO		NULL		select,insert,update,references	课程安排创建方式: manual-人员安排, system-系统创建
created_at	timestamp	NULL	YES		CURRENT_TIMESTAMP	DEFAULT_GENERATED	select,insert,update,references	创建时间
updated_at	timestamp	NULL	YES		CURRENT_TIMESTAMP	DEFAULT_GENERATED on update CURRENT_TIMESTAMP	select,insert,update,references	修改时间
deleted_at	int	NULL	YES		0		select,insert,update,references	逻辑删除时间
assistant_ids	varchar(255)	utf8mb4_general_ci	YES		NULL		select,insert,update,references	助教ID列表(逗号分隔)
education_id	int	NULL	YES		NULL		select,insert,update,references	教务ID
recurring_type	enum('none','daily','weekly','monthly')	utf8mb4_general_ci	YES		none		select,insert,update,references	重复类型
recurring_end_date	date	NULL	YES		NULL		select,insert,update,references	重复结束日期
is_trial_class	tinyint(1)	NULL	YES		0		select,insert,update,references	是否体验课
max_students	int	NULL	YES		NULL		select,insert,update,references	本次课程最大学员数
remarks	varchar(255)	utf8mb4_general_ci	YES		NULL		select,insert,update,references	课程备注
begin_img	varchar(255)	utf8mb4_general_ci	YES		NULL		select,insert,update,references	开课图片
class_id	int	NULL	YES		NULL		select,insert,update,references	班级 id

功能用途

主要功能

  • 课程排期管理: 管理具体的上课日期、时段和时间安排
  • 场地资源调度: 分配和管理上课场地,控制场地使用冲突
  • 教练安排: 分配主教练和助教,支持教练排课管理
  • 学员管理: 管理参与课程的学员列表,控制课程容量
  • 容量控制: 根据场地容量和课程设置控制学员数量上限
  • 课程状态跟踪: 跟踪课程从待开始到已结束的全生命周期状态
  • 自动排课: 支持系统自动排课和人工手动排课两种模式
  • 重复课程: 支持日、周、月重复课程的批量生成
  • 体验课管理: 区分正式课程和体验课程
  • 教务管理: 支持教务人员的课程管理和监督

业务场景

  • 日常排课: 教务人员根据课程计划安排具体的上课时间和场地
  • 教练调配: 根据教练时间安排和专业能力分配合适的教练
  • 学员选课: 学员根据课程安排选择合适的时间段上课
  • 场地管理: 避免场地冲突,合理利用场地资源
  • 容量控制: 确保课程人数不超过场地和教学质量要求
  • 课程调整: 处理临时的课程时间、教练、场地变更
  • 体验课安排: 为潜在学员安排体验课程
  • 批量排课: 使用重复功能批量生成常规课程安排
  • 课程监控: 实时监控课程状态和进度

关联关系

主要关联表

  • school_campus: 校区信息表 (campus_id)
  • school_venue: 场地信息表 (venue_id)
  • school_course: 课程信息表 (course_id)
  • school_personnel: 人员信息表 (coach_id, assistant_ids, education_id)
  • school_class: 班级信息表 (class_id)
  • school_member: 学员信息表 (通过student_ids关联)
  • school_attendance: 考勤记录表 (关联上课记录)
  • school_homework: 作业管理表 (关联课程作业)
  • school_class_member: 班级学员表 (关联班级学员)

关联说明

  • 校区场地: campus_id和venue_id确定上课的具体位置和场地
  • 课程关联: course_id关联具体的课程信息,class_id关联班级
  • 人员关联: coach_id关联主教练,assistant_ids关联助教,education_id关联教务
  • 学员关联: student_ids(JSON)存储参与课程的学员ID列表
  • 参与人员: participants(JSON)存储详细的参与人员信息
  • 教学关联: 与考勤、作业等教学管理功能关联
  • 容量关联: available_capacity与场地容量和课程设置关联

索引建议

  • 主键索引: id (已存在)
  • 外键索引:
    • campus_id (校区查询)
    • venue_id (场地查询,已存在MUL)
    • course_id (课程查询)
    • coach_id (教练查询,已存在MUL)
    • class_id (班级查询)
    • education_id (教务查询)
  • 时间索引:
    • course_date (上课日期查询,已存在MUL)
    • created_at (创建时间查询)
  • 状态索引: status (课程状态查询)
  • 复合索引:
    • (campus_id, course_date) (校区日期查询)
    • (venue_id, course_date, time_slot) (场地时间冲突检查)
    • (coach_id, course_date) (教练排课查询)
    • (course_id, course_date) (课程安排查询)
    • (class_id, course_date) (班级课程查询)
    • (course_date, status) (日期状态查询)
  • 特殊索引:
    • recurring_type (重复课程查询)
    • is_trial_class (体验课查询)

注意事项

  • 时间逻辑: end_time必须大于start_time,course_date不能是过去的日期
  • 场地冲突: 同一场地在同一时间段不能安排多个课程
  • 教练冲突: 同一教练在同一时间不能安排多个课程
  • 容量控制: 实际学员数不能超过available_capacity和max_students
  • JSON字段: student_ids和participants使用JSON格式,需要注意数据格式验证
  • 状态流转: 课程状态有严格的时间顺序,不能随意跳跃
  • 重复课程: recurring_type不为none时,必须设置recurring_end_date
  • 软删除: 使用deleted_at字段进行逻辑删除,删除时需要考虑关联数据
  • 自动排课: auto_schedule为1时,系统可能自动调整课程安排
  • 体验课标识: is_trial_class影响课程的计费和统计逻辑
  • 助教管理: assistant_ids使用逗号分隔,需要验证人员ID的有效性
  • 图片管理: begin_img需要验证图片格式和大小
  • 权限控制: 不同角色对课程安排的操作权限需要严格控制
  • 数据一致性: 修改课程安排时需要同步更新相关的考勤、作业等数据
  • 时区处理: 时间字段需要考虑时区问题,确保时间显示正确