feat: 初始化仓库

This commit is contained in:
2024-11-11 10:57:15 +08:00
commit e568882c6f
15 changed files with 1115 additions and 0 deletions

19
models/campus.go Normal file
View File

@@ -0,0 +1,19 @@
// Package models
package models
import (
"github.com/google/uuid"
"gorm.io/gorm"
)
// Campus 校区模型
type Campus struct {
ID string `gorm:"type:uuid;primaryKey" json:"id"`
Name string `gorm:"type:varchar(255);not null" json:"name"`
}
// BeforeCreate 在创建Campus之前生成UUID
func (campus *Campus) BeforeCreate(tx *gorm.DB) (err error) {
campus.ID = uuid.New().String()
return
}