This commit is contained in:
2025-11-22 17:29:25 +08:00
parent 9aea487537
commit 4405d1f3f1
2 changed files with 4 additions and 2 deletions

View File

@@ -226,6 +226,7 @@ func (a *API) setupRoutes() {
// 原料 (RawMaterial) 路由 // 原料 (RawMaterial) 路由
feedGroup.POST("/raw-materials", a.feedController.CreateRawMaterial) feedGroup.POST("/raw-materials", a.feedController.CreateRawMaterial)
feedGroup.PUT("/raw-materials/:id", a.feedController.UpdateRawMaterial) feedGroup.PUT("/raw-materials/:id", a.feedController.UpdateRawMaterial)
feedGroup.PUT("/raw-materials/:id/nutrients", a.feedController.UpdateRawMaterialNutrients)
feedGroup.DELETE("/raw-materials/:id", a.feedController.DeleteRawMaterial) feedGroup.DELETE("/raw-materials/:id", a.feedController.DeleteRawMaterial)
feedGroup.GET("/raw-materials/:id", a.feedController.GetRawMaterial) feedGroup.GET("/raw-materials/:id", a.feedController.GetRawMaterial)
feedGroup.GET("/raw-materials", a.feedController.ListRawMaterials) feedGroup.GET("/raw-materials", a.feedController.ListRawMaterials)

View File

@@ -245,6 +245,7 @@ func (s *feedManagementServiceImpl) UpdateRawMaterialNutrients(ctx context.Conte
nutrients := make([]models.RawMaterialNutrient, len(req.Nutrients)) nutrients := make([]models.RawMaterialNutrient, len(req.Nutrients))
for i, item := range req.Nutrients { for i, item := range req.Nutrients {
nutrients[i] = models.RawMaterialNutrient{ nutrients[i] = models.RawMaterialNutrient{
RawMaterialID: id,
NutrientID: item.NutrientID, NutrientID: item.NutrientID,
Value: item.Value, Value: item.Value,
} }