feat: 成长记录
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
package plant
|
||||
|
||||
import (
|
||||
"sundynix-go/global"
|
||||
"sundynix-go/model/system"
|
||||
)
|
||||
|
||||
type GrowthRecord struct {
|
||||
global.BaseModel
|
||||
PlantId string `json:"plantId" form:"plantId" gorm:"index;column:plant_id;comment:植物id"`
|
||||
UserId string `json:"userId" form:"userId" gorm:"index;column:user_id;comment:用户id"`
|
||||
Name string `json:"name" form:"name" gorm:"column:name;size:50;comment:名称"`
|
||||
Tag string `json:"tag" form:"tag" gorm:"column:tag;size:50;comment:标签"`
|
||||
Desc string `json:"desc" form:"desc" gorm:"column:desc;size:200;comment:描述"`
|
||||
Content string `json:"content" form:"content" gorm:"column:content;size:200;comment:内容"`
|
||||
//图片
|
||||
ImgList []*system.Oss `json:"imgList" form:"imgList" gorm:"many2many:growth_record_oss;comment:图片列表"`
|
||||
}
|
||||
@@ -51,3 +51,12 @@ type CompleteTask struct {
|
||||
TaskId string `json:"taskId" binding:"required"`
|
||||
Remark string `json:"remark"`
|
||||
}
|
||||
|
||||
type CreateGrowthRecord struct {
|
||||
PlantId string `json:"plantId" binding:"required"`
|
||||
OssIds []string `json:"ossIds"`
|
||||
Name string `json:"name"`
|
||||
Tag string `json:"tag"`
|
||||
Desc string `json:"desc"`
|
||||
Content string `json:"content"`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user