定义猪的模型和营养需求模型
This commit is contained in:
16
internal/infra/models/pig_nutrient.go
Normal file
16
internal/infra/models/pig_nutrient.go
Normal file
@@ -0,0 +1,16 @@
|
||||
package models
|
||||
|
||||
// PigNutrientRequirement 猪营养需求模型
|
||||
type PigNutrientRequirement struct {
|
||||
Model
|
||||
PigTypeID uint32 `gorm:"not null;index;comment:关联的猪类型ID"`
|
||||
PigType PigType `gorm:"foreignKey:PigTypeID"`
|
||||
NutrientID uint32 `gorm:"not null;index;comment:关联的营养素ID"`
|
||||
Nutrient Nutrient `gorm:"foreignKey:NutrientID"`
|
||||
MinRequirement float32 `gorm:"not null;comment:最低营养需求量"`
|
||||
MaxRequirement float32 `gorm:"not null;comment:最高营养需求量"`
|
||||
}
|
||||
|
||||
func (PigNutrientRequirement) TableName() string {
|
||||
return "pig_nutrient_requirements"
|
||||
}
|
||||
Reference in New Issue
Block a user