实现修改原料营养信息

This commit is contained in:
2025-11-22 16:44:22 +08:00
parent f81635f997
commit 9aea487537
11 changed files with 411 additions and 165 deletions

View File

@@ -2905,6 +2905,64 @@ const docTemplate = `{
}
}
},
"/api/v1/feed/raw-materials/{id}/nutrients": {
"put": {
"security": [
{
"BearerAuth": []
}
],
"description": "根据原料ID替换其所有的营养成分信息。这是一个覆盖操作。",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"饲料管理"
],
"summary": "全量更新原料的营养成分",
"parameters": [
{
"type": "integer",
"description": "原料ID",
"name": "id",
"in": "path",
"required": true
},
{
"description": "新的营养成分列表",
"name": "nutrients",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/dto.UpdateRawMaterialNutrientsRequest"
}
}
],
"responses": {
"200": {
"description": "业务码为200代表更新成功",
"schema": {
"allOf": [
{
"$ref": "#/definitions/controller.Response"
},
{
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/dto.RawMaterialResponse"
}
}
}
]
}
}
}
}
},
"/api/v1/monitor/device-command-logs": {
"get": {
"security": [
@@ -7368,9 +7426,6 @@ const docTemplate = `{
"dto.NutrientResponse": {
"type": "object",
"properties": {
"created_at": {
"type": "string"
},
"description": {
"type": "string"
},
@@ -7386,9 +7441,6 @@ const docTemplate = `{
"items": {
"$ref": "#/definitions/dto.NutrientRawMaterialDTO"
}
},
"updated_at": {
"type": "string"
}
}
},
@@ -7461,9 +7513,6 @@ const docTemplate = `{
"dto.PigAgeStageResponse": {
"type": "object",
"properties": {
"created_at": {
"type": "string"
},
"description": {
"type": "string"
},
@@ -7472,9 +7521,6 @@ const docTemplate = `{
},
"name": {
"type": "string"
},
"updated_at": {
"type": "string"
}
}
},
@@ -7667,9 +7713,6 @@ const docTemplate = `{
"breed_disadvantages": {
"type": "string"
},
"created_at": {
"type": "string"
},
"description": {
"type": "string"
},
@@ -7681,9 +7724,6 @@ const docTemplate = `{
},
"parent_info": {
"type": "string"
},
"updated_at": {
"type": "string"
}
}
},
@@ -7704,9 +7744,6 @@ const docTemplate = `{
"dto.PigNutrientRequirementDTO": {
"type": "object",
"properties": {
"created_at": {
"type": "string"
},
"id": {
"type": "integer"
},
@@ -7724,9 +7761,6 @@ const docTemplate = `{
"nutrient_name": {
"description": "营养素名称",
"type": "string"
},
"updated_at": {
"type": "string"
}
}
},
@@ -7905,9 +7939,6 @@ const docTemplate = `{
"description": "猪品种名称",
"type": "string"
},
"created_at": {
"type": "string"
},
"daily_feed_intake": {
"type": "number"
},
@@ -7938,9 +7969,6 @@ const docTemplate = `{
"items": {
"$ref": "#/definitions/dto.PigNutrientRequirementDTO"
}
},
"updated_at": {
"type": "string"
}
}
},
@@ -8052,9 +8080,6 @@ const docTemplate = `{
"dto.RawMaterialNutrientDTO": {
"type": "object",
"properties": {
"created_at": {
"type": "string"
},
"id": {
"type": "integer"
},
@@ -8065,21 +8090,32 @@ const docTemplate = `{
"description": "营养素名称",
"type": "string"
},
"updated_at": {
"type": "string"
},
"value": {
"description": "营养价值含量",
"type": "number"
}
}
},
"dto.RawMaterialNutrientItem": {
"type": "object",
"required": [
"nutrient_id"
],
"properties": {
"nutrient_id": {
"description": "营养素ID",
"type": "integer"
},
"value": {
"description": "含量值必须大于等于0",
"type": "number",
"minimum": 0
}
}
},
"dto.RawMaterialResponse": {
"type": "object",
"properties": {
"created_at": {
"type": "string"
},
"description": {
"type": "string"
},
@@ -8095,9 +8131,6 @@ const docTemplate = `{
"items": {
"$ref": "#/definitions/dto.RawMaterialNutrientDTO"
}
},
"updated_at": {
"type": "string"
}
}
},
@@ -8991,6 +9024,20 @@ const docTemplate = `{
}
}
},
"dto.UpdateRawMaterialNutrientsRequest": {
"type": "object",
"required": [
"nutrients"
],
"properties": {
"nutrients": {
"type": "array",
"items": {
"$ref": "#/definitions/dto.RawMaterialNutrientItem"
}
}
}
},
"dto.UpdateRawMaterialRequest": {
"type": "object",
"required": [