增加创建和更新计划基本信息的界面
This commit is contained in:
@@ -121,6 +121,7 @@ func (c *Controller) convertToCreateModel(req *CreateRequest) *model.FeedingPlan
|
||||
ExecutionLimit: req.ExecutionLimit,
|
||||
ParentID: req.ParentID,
|
||||
OrderInParent: req.OrderInParent,
|
||||
// 不需要显式设置ID字段,仓库层会处理
|
||||
}
|
||||
|
||||
// 转换步骤
|
||||
|
||||
@@ -60,6 +60,9 @@ func (f *feedPlanRepo) FindFeedingPlanByID(feedingPlanID uint) (*model.FeedingPl
|
||||
|
||||
// CreateFeedingPlan 创建饲料计划,包括步骤和子计划
|
||||
func (f *feedPlanRepo) CreateFeedingPlan(feedingPlan *model.FeedingPlan) error {
|
||||
// 清空所有ID,确保创建新记录
|
||||
f.clearAllIDs(feedingPlan)
|
||||
|
||||
return f.db.Transaction(func(tx *gorm.DB) error {
|
||||
return f.createFeedingPlanWithTx(tx, feedingPlan)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user