feat: 成长记录

This commit is contained in:
Blizzard
2026-02-11 10:40:21 +08:00
parent 88aeb86296
commit 6be24bdbda
7 changed files with 108 additions and 4 deletions
+5 -4
View File
@@ -22,10 +22,11 @@ type MyPlant struct {
Sunlight string `json:"sunlight" form:"sunlight" gorm:"column:sunlight;size:50;comment:光照条件"` // 如每日12小时
PlantingMaterial string `json:"plantingMaterial" form:"plantingMaterial" gorm:"column:planting_material;size:50;comment:植料"`
ImgList []*system.Oss `json:"imgList" form:"imgList" gorm:"many2many:my_plant_oss;comment:图片列表"`
CarePlans []*CarePlan `json:"carePlans" form:"carePlans" gorm:"foreignKey:PlantId;comment:养护计划"`
CareTasks []*CareTask `json:"careTasks" form:"careTasks" gorm:"foreignKey:PlantId;comment:养护任务"`
CareRecords []*CareRecord `json:"careRecords" form:"careRecords" gorm:"foreignKey:PlantId;comment:养护记录"`
ImgList []*system.Oss `json:"imgList" form:"imgList" gorm:"many2many:my_plant_oss;comment:图片列表"`
CarePlans []*CarePlan `json:"carePlans" form:"carePlans" gorm:"foreignKey:PlantId;comment:养护计划"`
CareTasks []*CareTask `json:"careTasks" form:"careTasks" gorm:"foreignKey:PlantId;comment:养护任务"`
CareRecords []*CareRecord `json:"careRecords" form:"careRecords" gorm:"foreignKey:PlantId;comment:养护记录"`
GrowthRecords []*GrowthRecord `json:"growthRecords" form:"growthRecords" gorm:"foreignKey:PlantId;comment:成长记录"`
}
// AfterCreate 钩子函数 创建plant时自动创建careTask