实现修改原料营养信息

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": [

View File

@@ -2897,6 +2897,64 @@
}
}
},
"/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": [
@@ -7360,9 +7418,6 @@
"dto.NutrientResponse": {
"type": "object",
"properties": {
"created_at": {
"type": "string"
},
"description": {
"type": "string"
},
@@ -7378,9 +7433,6 @@
"items": {
"$ref": "#/definitions/dto.NutrientRawMaterialDTO"
}
},
"updated_at": {
"type": "string"
}
}
},
@@ -7453,9 +7505,6 @@
"dto.PigAgeStageResponse": {
"type": "object",
"properties": {
"created_at": {
"type": "string"
},
"description": {
"type": "string"
},
@@ -7464,9 +7513,6 @@
},
"name": {
"type": "string"
},
"updated_at": {
"type": "string"
}
}
},
@@ -7659,9 +7705,6 @@
"breed_disadvantages": {
"type": "string"
},
"created_at": {
"type": "string"
},
"description": {
"type": "string"
},
@@ -7673,9 +7716,6 @@
},
"parent_info": {
"type": "string"
},
"updated_at": {
"type": "string"
}
}
},
@@ -7696,9 +7736,6 @@
"dto.PigNutrientRequirementDTO": {
"type": "object",
"properties": {
"created_at": {
"type": "string"
},
"id": {
"type": "integer"
},
@@ -7716,9 +7753,6 @@
"nutrient_name": {
"description": "营养素名称",
"type": "string"
},
"updated_at": {
"type": "string"
}
}
},
@@ -7897,9 +7931,6 @@
"description": "猪品种名称",
"type": "string"
},
"created_at": {
"type": "string"
},
"daily_feed_intake": {
"type": "number"
},
@@ -7930,9 +7961,6 @@
"items": {
"$ref": "#/definitions/dto.PigNutrientRequirementDTO"
}
},
"updated_at": {
"type": "string"
}
}
},
@@ -8044,9 +8072,6 @@
"dto.RawMaterialNutrientDTO": {
"type": "object",
"properties": {
"created_at": {
"type": "string"
},
"id": {
"type": "integer"
},
@@ -8057,21 +8082,32 @@
"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"
},
@@ -8087,9 +8123,6 @@
"items": {
"$ref": "#/definitions/dto.RawMaterialNutrientDTO"
}
},
"updated_at": {
"type": "string"
}
}
},
@@ -8983,6 +9016,20 @@
}
}
},
"dto.UpdateRawMaterialNutrientsRequest": {
"type": "object",
"required": [
"nutrients"
],
"properties": {
"nutrients": {
"type": "array",
"items": {
"$ref": "#/definitions/dto.RawMaterialNutrientItem"
}
}
}
},
"dto.UpdateRawMaterialRequest": {
"type": "object",
"required": [

View File

@@ -898,8 +898,6 @@ definitions:
type: object
dto.NutrientResponse:
properties:
created_at:
type: string
description:
type: string
id:
@@ -911,8 +909,6 @@ definitions:
items:
$ref: '#/definitions/dto.NutrientRawMaterialDTO'
type: array
updated_at:
type: string
type: object
dto.PaginationDTO:
properties:
@@ -959,16 +955,12 @@ definitions:
type: object
dto.PigAgeStageResponse:
properties:
created_at:
type: string
description:
type: string
id:
type: integer
name:
type: string
updated_at:
type: string
type: object
dto.PigBatchCreateDTO:
properties:
@@ -1094,8 +1086,6 @@ definitions:
type: string
breed_disadvantages:
type: string
created_at:
type: string
description:
type: string
id:
@@ -1104,8 +1094,6 @@ definitions:
type: string
parent_info:
type: string
updated_at:
type: string
type: object
dto.PigHouseResponse:
properties:
@@ -1118,8 +1106,6 @@ definitions:
type: object
dto.PigNutrientRequirementDTO:
properties:
created_at:
type: string
id:
type: integer
max_requirement:
@@ -1133,8 +1119,6 @@ definitions:
nutrient_name:
description: 营养素名称
type: string
updated_at:
type: string
type: object
dto.PigPurchaseDTO:
properties:
@@ -1252,8 +1236,6 @@ definitions:
breed_name:
description: 猪品种名称
type: string
created_at:
type: string
daily_feed_intake:
type: number
daily_gain_weight:
@@ -1275,8 +1257,6 @@ definitions:
items:
$ref: '#/definitions/dto.PigNutrientRequirementDTO'
type: array
updated_at:
type: string
type: object
dto.PlanExecutionLogDTO:
properties:
@@ -1346,8 +1326,6 @@ definitions:
type: object
dto.RawMaterialNutrientDTO:
properties:
created_at:
type: string
id:
type: integer
nutrient_id:
@@ -1355,16 +1333,24 @@ definitions:
nutrient_name:
description: 营养素名称
type: string
updated_at:
type: string
value:
description: 营养价值含量
type: number
type: object
dto.RawMaterialNutrientItem:
properties:
nutrient_id:
description: 营养素ID
type: integer
value:
description: 含量值必须大于等于0
minimum: 0
type: number
required:
- nutrient_id
type: object
dto.RawMaterialResponse:
properties:
created_at:
type: string
description:
type: string
id:
@@ -1376,8 +1362,6 @@ definitions:
items:
$ref: '#/definitions/dto.RawMaterialNutrientDTO'
type: array
updated_at:
type: string
type: object
dto.ReclassifyPenToNewBatchRequest:
properties:
@@ -1993,6 +1977,15 @@ definitions:
required:
- execution_type
type: object
dto.UpdateRawMaterialNutrientsRequest:
properties:
nutrients:
items:
$ref: '#/definitions/dto.RawMaterialNutrientItem'
type: array
required:
- nutrients
type: object
dto.UpdateRawMaterialRequest:
properties:
description:
@@ -4300,6 +4293,40 @@ paths:
summary: 更新原料
tags:
- 饲料管理
/api/v1/feed/raw-materials/{id}/nutrients:
put:
consumes:
- application/json
description: 根据原料ID替换其所有的营养成分信息。这是一个覆盖操作。
parameters:
- description: 原料ID
in: path
name: id
required: true
type: integer
- description: 新的营养成分列表
in: body
name: nutrients
required: true
schema:
$ref: '#/definitions/dto.UpdateRawMaterialNutrientsRequest'
produces:
- application/json
responses:
"200":
description: 业务码为200代表更新成功
schema:
allOf:
- $ref: '#/definitions/controller.Response'
- properties:
data:
$ref: '#/definitions/dto.RawMaterialResponse'
type: object
security:
- BearerAuth: []
summary: 全量更新原料的营养成分
tags:
- 饲料管理
/api/v1/monitor/device-command-logs:
get:
description: 根据提供的过滤条件,分页获取设备命令日志