model

package
v1.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 26, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ClassInfoTableName     string = "class_info"
	StudentCourseTableName string = "student_course"
	JxbTableName           string = "jxb"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AddClassReq

type AddClassReq struct {
	StuID     string
	Year      string
	Semester  string
	ClassInfo *ClassInfo
	Sc        *StudentCourse
}

type CheckClassIdIsInRecycledBinReq

type CheckClassIdIsInRecycledBinReq struct {
	StuID    string
	Year     string
	Semester string
	ClassId  string
}

type CheckSCIdsExistReq

type CheckSCIdsExistReq struct {
	StuID    string
	Year     string
	Semester string
	ClassId  string
}

type Class

type Class struct {
	Info     *ClassInfo //课程信息
	ThisWeek bool       //是否是本周
}

func (*Class) String

func (c *Class) String() string

type ClassInfo

type ClassInfo struct {
	ID        string    `gorm:"type:varchar(150);primaryKey;column:id" json:"id"` //集合了课程信息的字符串,便于标识(课程ID)
	CreatedAt time.Time `json:"-"`
	UpdatedAt time.Time `json:"-"`
	//ClassId      string  `gorm:"column:class_id" json:"class_id"`           //课程编号
	JxbId        string  `gorm:"type:varchar(100);column:jxb_id" json:"jxb_id"`                       //教学班ID
	Day          int64   `gorm:"column:day;not null" json:"day"`                                      //星期几
	Teacher      string  `gorm:"type:varchar(50);;column:teacher;not null" json:"teacher"`            //任课教师
	Where        string  `gorm:"type:varchar(50);column:where;not null" json:"where"`                 //上课地点
	ClassWhen    string  `gorm:"type:varchar(10);column:class_when;not null" json:"class_when"`       //上课是第几节(如1-2,3-4)
	WeekDuration string  `gorm:"type:varchar(20);column:week_duration;not null" json:"week_duration"` //上课的周数
	Classname    string  `gorm:"type:varchar(20);column:class_name;not null" json:"classname"`        //课程名称
	Credit       float64 `gorm:"column:credit;default:1.0" json:"credit"`                             //学分
	Weeks        int64   `gorm:"column:weeks;not null" json:"weeks"`                                  //哪些周
	Semester     string  `gorm:"type:varchar(1);column:semester;not null" json:"semester"`            //学期
	Year         string  `gorm:"type:varchar(5);column:year;not null" json:"year"`                    //学年
}

func (*ClassInfo) BeforeCreate

func (ci *ClassInfo) BeforeCreate(tx *gorm.DB) (err error)

func (*ClassInfo) BeforeUpdate

func (ci *ClassInfo) BeforeUpdate(tx *gorm.DB) (err error)

func (*ClassInfo) SearchWeek

func (ci *ClassInfo) SearchWeek(week int64) bool

func (*ClassInfo) String

func (ci *ClassInfo) String() string

func (*ClassInfo) TableName

func (ci *ClassInfo) TableName() string

func (*ClassInfo) UpdateID

func (ci *ClassInfo) UpdateID()

type DeleteClassReq

type DeleteClassReq struct {
	StuID    string
	Year     string
	Semester string
	ClassId  []string
}

type GetAllClassesReq

type GetAllClassesReq struct {
	StuID    string
	Year     string
	Semester string
}

type GetAllClassesResp

type GetAllClassesResp struct {
	ClassInfos []*ClassInfo
}

type GetAllSchoolClassInfosReq

type GetAllSchoolClassInfosReq struct {
	Year     string
	Semester string
}

type GetAllSchoolClassInfosResp

type GetAllSchoolClassInfosResp struct {
	ClassInfos []*ClassInfo
}

type GetClassInfoForGraduateStudentReq

type GetClassInfoForGraduateStudentReq struct {
	StuID    string
	Year     string
	Semester string
	Cookie   string
}

type GetClassInfoForGraduateStudentResp

type GetClassInfoForGraduateStudentResp struct {
	ClassInfos     []*ClassInfo
	StudentCourses []*StudentCourse
}

type GetClassInfosForUndergraduateReq

type GetClassInfosForUndergraduateReq struct {
	StuID    string
	Year     string
	Semester string
	Cookie   string
}

type GetClassInfosForUndergraduateResp

type GetClassInfosForUndergraduateResp struct {
	ClassInfos     []*ClassInfo
	StudentCourses []*StudentCourse
}

type GetRecycledIdsReq

type GetRecycledIdsReq struct {
	StuID    string
	Year     string
	Semester string
}

type GetRecycledIdsResp

type GetRecycledIdsResp struct {
	Ids []string
}

type GetSpecificClassInfoReq

type GetSpecificClassInfoReq struct {
	StuID    string
	Year     string
	Semester string
	ClassId  string
}

type GetSpecificClassInfoResp

type GetSpecificClassInfoResp struct {
	ClassInfo *ClassInfo
}

type Jxb

type Jxb struct {
	JxbId string `gorm:"type:varchar(100);column:jxb_id;uniqueIndex:idx_jxb,priority:1" json:"jxb_id"` // 教学班ID
	StuId string `gorm:"type:varchar(20);column:stu_id;uniqueIndex:idx_jxb,priority:2" json:"stu_id"`  // 学号
}

Jxb 用来存取教学班

func (*Jxb) TableName

func (j *Jxb) TableName() string

type RecoverClassFromRecycleBinReq

type RecoverClassFromRecycleBinReq struct {
	StuID    string
	Year     string
	Semester string
	ClassId  string
}

type SaveClassReq

type SaveClassReq struct {
	StuID      string
	Year       string
	Semester   string
	ClassInfos []*ClassInfo
	Scs        []*StudentCourse
}

type StudentCourse

type StudentCourse struct {
	StuID           string    `gorm:"type:varchar(20);column:stu_id;not null;uniqueIndex:idx_sc,priority:3" json:"stu_id"`    //学号
	ClaID           string    `gorm:"type:varchar(120);column:cla_id;not null;uniqueIndex:idx_sc,priority:4" json:"cla_id"`   //课程ID
	Year            string    `gorm:"type:varchar(5);column:year;not null;uniqueIndex:idx_sc,priority:1" json:"year"`         //学年
	Semester        string    `gorm:"type:varchar(1);column:semester;not null;uniqueIndex:idx_sc,priority:2" json:"semester"` //学期
	IsManuallyAdded bool      `gorm:"column:is_manually_added;default:false" json:"is_manually_added"`                        //是否为手动添加
	CreatedAt       time.Time `json:"-"`
	UpdatedAt       time.Time `json:"-"`
}

func (*StudentCourse) BeforeCreate

func (sc *StudentCourse) BeforeCreate(tx *gorm.DB) (err error)

func (*StudentCourse) BeforeUpdate

func (sc *StudentCourse) BeforeUpdate(tx *gorm.DB) (err error)

func (*StudentCourse) TableName

func (sc *StudentCourse) TableName() string

type UpdateClassReq

type UpdateClassReq struct {
	StuID        string
	Year         string
	Semester     string
	NewClassInfo *ClassInfo
	NewSc        *StudentCourse
	OldClassId   string
}

type WrapClassInfo

type WrapClassInfo []*ClassInfo

func (*WrapClassInfo) ConvertToClass

func (w *WrapClassInfo) ConvertToClass(week int64) ([]*Class, []string)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL