实现从json读取猪营养需求并写入数据库

This commit is contained in:
2025-11-20 22:55:18 +08:00
parent c4ab53db12
commit aa13239e89
5 changed files with 1254 additions and 34 deletions

View File

@@ -3,8 +3,12 @@ package models
// PigBreed 猪品种模型
type PigBreed struct {
Model
Name string `gorm:"size:50;not null;comment:品种名称"`
Description string `gorm:"size:255;comment:品种描述"`
Name string `gorm:"size:50;not null;comment:品种名称"`
Description string `gorm:"type:text" json:"description"` // 保留描述字段
ParentInfo string `gorm:"type:text" json:"parent_info"` // 父母信息
AppearanceFeatures string `gorm:"type:text" json:"appearance_features"` // 外貌特征
BreedAdvantages string `gorm:"type:text" json:"breed_advantages"` // 品种优点
BreedDisadvantages string `gorm:"type:text" json:"breed_disadvantages"` // 品种缺点
}
func (PigBreed) TableName() string {