package models import "time" // Class đại diện cho lớp học từ QLĐT type Class struct { ID uint `gorm:"primaryKey" json:"id"` CreatedAt time.Time `json:"createdAt"` UpdatedAt time.Time `json:"updatedAt"` RkID int64 `gorm:"column:rk_id;uniqueIndex;not null" json:"rkId"` Name string `gorm:"column:name;size:512" json:"name"` ClassCode string `gorm:"column:class_code;size:128" json:"classCode"` Type string `gorm:"column:type;size:64" json:"type"` StudentCount int `gorm:"column:student_count;default:0" json:"studentCount"` SpecializeRkID *int64 `gorm:"column:specialize_rk_id" json:"specializeRkId"` SpecializeName *string `gorm:"column:specialize_name;size:255" json:"specializeName"` SystemRkID *int64 `gorm:"column:system_rk_id;index" json:"systemRkId"` SystemCode *string `gorm:"column:system_code;size:64" json:"systemCode"` SystemName *string `gorm:"column:system_name;size:512" json:"systemName"` IsStudying bool `gorm:"column:is_studying;default:false;index" json:"isStudying"` } func (Class) TableName() string { return "classes" } // ClassCourseLink lưu danh sách môn học của mỗi lớp type ClassCourseLink struct { ClassRkID int64 `gorm:"column:class_rk_id;primaryKey;not null" json:"classRkId"` CourseRkID int64 `gorm:"column:course_rk_id;primaryKey;not null" json:"courseRkId"` CourseName string `gorm:"column:course_name;size:512" json:"courseName"` CourseOrder int `gorm:"column:course_order;default:0" json:"courseOrder"` } func (ClassCourseLink) TableName() string { return "class_course_links" } // Student đại diện cho sinh viên type Student struct { ID uint `gorm:"primaryKey" json:"id"` CreatedAt time.Time `json:"createdAt"` UpdatedAt time.Time `json:"updatedAt"` RkID int64 `gorm:"column:rk_id;uniqueIndex;not null" json:"rkId"` StudentCode string `gorm:"column:student_code;size:64;index" json:"studentCode"` FullName string `gorm:"column:full_name;size:255;index" json:"fullName"` Phone *string `gorm:"column:phone;size:32" json:"phone"` Email string `gorm:"column:email;size:255;index" json:"email"` DateOfBirth *time.Time `gorm:"column:date_of_birth" json:"dateOfBirth"` Gender *int `gorm:"column:gender" json:"gender"` Status *string `gorm:"column:status;size:64" json:"status"` Location *string `gorm:"column:location;size:32" json:"location"` SystemID *int64 `gorm:"column:system_id" json:"systemId"` SystemName *string `gorm:"column:system_name;size:255" json:"systemName"` } func (Student) TableName() string { return "students" } // ClassStudent map sinh viên vào lớp tương ứng type ClassStudent struct { ClassRkID int64 `gorm:"column:class_rk_id;primaryKey;not null;index" json:"classRkId"` StudentRkID int64 `gorm:"column:student_rk_id;primaryKey;not null;index" json:"studentRkId"` } func (ClassStudent) TableName() string { return "class_students" }