定义model

This commit is contained in:
2025-10-03 20:32:34 +08:00
parent 8cbe313c89
commit 6cc6d719e1
6 changed files with 46 additions and 22 deletions

View File

@@ -82,7 +82,7 @@ const (
// GroupMedicationLog 记录了对整个猪批次的用药情况
type GroupMedicationLog struct {
ID uint `gorm:"primaryKey"`
gorm.Model
PigBatchID uint `gorm:"not null;index;comment:关联的猪批次ID"`
MedicationID uint `gorm:"not null;index;comment:关联的药品ID"`
Medication Medication `gorm:"foreignKey:MedicationID"` // 预加载药品信息
@@ -92,9 +92,6 @@ type GroupMedicationLog struct {
Description string `gorm:"size:255;comment:具体描述,如'治疗呼吸道病'"`
Operator string `gorm:"size:50;comment:操作员"`
HappenedAt time.Time `gorm:"primaryKey;comment:用药时间"`
CreatedAt time.Time
UpdatedAt time.Time
DeletedAt gorm.DeletedAt `gorm:"index"`
}
func (GroupMedicationLog) TableName() string {