feat: 多班级版班级管理系统 v2.0
技术栈:Go (Gin + GORM) + PHP + MySQL 5.7 + Redis 主要功能: - 多班级完全隔离(class_id 贯穿全系统) - 后端 Go Gin(端口 56789),Nginx 反代 - 超级管理员独立登录(env 配置,默认账密 admin/Admin123) - bcrypt 密码加密(无 PASSWORD_SALT) - 科任老师/课代表新角色 - 课代表作业管理页面 - 排行榜分项排行(操行分/考勤/作业) - 角色加减分上下限由班主任配置 - 家长改密功能(可开关) - 班级角色按需开关 - 宿舍号格式:南0-000 - 周度/月度重置功能 - MySQL 5.7 兼容 - 43 轮代码审查 + 全部修复 开发者: Canglan 版权归属: Sea Network Technology Studio 许可证: Apache License 2.0
This commit is contained in:
88
backend-go/internal/model/semester.go
Normal file
88
backend-go/internal/model/semester.go
Normal file
@@ -0,0 +1,88 @@
|
||||
// ===========================================
|
||||
// 多班级版班级管理系统 - Go 后端
|
||||
//
|
||||
// 开发者: Canglan
|
||||
// 联系方式: admin@sea-studio.top
|
||||
// 版权归属: Sea Network Technology Studio
|
||||
// 许可证: Apache License 2.0
|
||||
//
|
||||
// 版权所有 © Sea Network Technology Studio
|
||||
// ===========================================
|
||||
|
||||
package model
|
||||
|
||||
import "time"
|
||||
|
||||
// Semester 学期模型,对应 semesters 表
|
||||
type Semester struct {
|
||||
SemesterID int `gorm:"column:semester_id;primaryKey;autoIncrement" json:"semester_id"`
|
||||
SemesterName string `gorm:"column:semester_name;type:varchar(100);not null" json:"semester_name"`
|
||||
StartDate *time.Time `gorm:"column:start_date;type:date" json:"start_date"`
|
||||
EndDate *time.Time `gorm:"column:end_date;type:date" json:"end_date"`
|
||||
IsActive int8 `gorm:"column:is_active;default:0" json:"is_active"`
|
||||
IsArchived int8 `gorm:"column:is_archived;default:0" json:"is_archived"`
|
||||
CreatedAt time.Time `gorm:"column:created_at;autoCreateTime" json:"created_at"`
|
||||
|
||||
// 虚拟字段
|
||||
ConductCount int64 `gorm:"-" json:"conduct_count,omitempty"`
|
||||
AttendanceCount int64 `gorm:"-" json:"attendance_count,omitempty"`
|
||||
CurrentWeek *int `gorm:"-" json:"current_week,omitempty"`
|
||||
}
|
||||
|
||||
// TableName 指定表名
|
||||
func (Semester) TableName() string {
|
||||
return "semesters"
|
||||
}
|
||||
|
||||
// SemesterArchive 学期归档快照模型,对应 semester_archives 表
|
||||
type SemesterArchive struct {
|
||||
ArchiveID int `gorm:"column:archive_id;primaryKey;autoIncrement" json:"archive_id"`
|
||||
SemesterID int `gorm:"column:semester_id;not null;index:idx_semester_id" json:"semester_id"`
|
||||
ClassID int `gorm:"column:class_id;not null;index:idx_archive_class" json:"class_id"`
|
||||
StudentID int `gorm:"column:student_id;not null" json:"student_id"`
|
||||
StudentNo string `gorm:"column:student_no;type:varchar(20);not null" json:"student_no"`
|
||||
StudentName string `gorm:"column:student_name;type:varchar(50);not null" json:"student_name"`
|
||||
FinalPoints int `gorm:"column:final_points;not null" json:"final_points"`
|
||||
RankPosition *int `gorm:"column:rank_position" json:"rank_position"`
|
||||
TotalStudents *int `gorm:"column:total_students" json:"total_students"`
|
||||
AttendancePresent int `gorm:"column:attendance_present;default:0" json:"attendance_present"`
|
||||
AttendanceAbsent int `gorm:"column:attendance_absent;default:0" json:"attendance_absent"`
|
||||
AttendanceLate int `gorm:"column:attendance_late;default:0" json:"attendance_late"`
|
||||
AttendanceLeave int `gorm:"column:attendance_leave;default:0" json:"attendance_leave"`
|
||||
HomeworkSubmitted int `gorm:"column:homework_submitted;default:0" json:"homework_submitted"`
|
||||
HomeworkNotSubmitted int `gorm:"column:homework_not_submitted;default:0" json:"homework_not_submitted"`
|
||||
HomeworkLate int `gorm:"column:homework_late;default:0" json:"homework_late"`
|
||||
ArchivedAt time.Time `gorm:"column:archived_at;autoCreateTime" json:"archived_at"`
|
||||
|
||||
// 虚拟字段
|
||||
SemesterName *string `gorm:"-" json:"semester_name,omitempty"`
|
||||
SStartDate *time.Time `gorm:"-" json:"start_date,omitempty"`
|
||||
SEndDate *time.Time `gorm:"-" json:"end_date,omitempty"`
|
||||
}
|
||||
|
||||
// TableName 指定表名
|
||||
func (SemesterArchive) TableName() string {
|
||||
return "semester_archives"
|
||||
}
|
||||
|
||||
// PeriodArchive 周期归档快照模型,对应 period_archives 表
|
||||
type PeriodArchive struct {
|
||||
ArchiveID int `gorm:"column:archive_id;primaryKey;autoIncrement" json:"archive_id"`
|
||||
ClassID int `gorm:"column:class_id;not null;index:idx_period_archive_class" json:"class_id"`
|
||||
PeriodType string `gorm:"column:period_type;type:enum('weekly','monthly');not null;index:idx_period_archive_type" json:"period_type"`
|
||||
PeriodLabel string `gorm:"column:period_label;type:varchar(50);not null;index:idx_period_archive_type" json:"period_label"`
|
||||
StudentID int `gorm:"column:student_id;not null" json:"student_id"`
|
||||
StudentNo string `gorm:"column:student_no;type:varchar(20);not null" json:"student_no"`
|
||||
StudentName string `gorm:"column:student_name;type:varchar(50);not null" json:"student_name"`
|
||||
FinalPoints int `gorm:"column:final_points;not null" json:"final_points"`
|
||||
RankPosition *int `gorm:"column:rank_position" json:"rank_position"`
|
||||
TotalStudents *int `gorm:"column:total_students" json:"total_students"`
|
||||
ArchivedAt time.Time `gorm:"column:archived_at;autoCreateTime" json:"archived_at"`
|
||||
ResetBy string `gorm:"column:reset_by;type:varchar(20);default:auto" json:"reset_by"`
|
||||
OperatorID *int `gorm:"column:operator_id" json:"operator_id"`
|
||||
}
|
||||
|
||||
// TableName 指定表名
|
||||
func (PeriodArchive) TableName() string {
|
||||
return "period_archives"
|
||||
}
|
||||
Reference in New Issue
Block a user