更新swag

This commit is contained in:
2025-11-22 17:00:49 +08:00
parent 21f71317fb
commit 21cfa50011
2 changed files with 115 additions and 60 deletions

View File

@@ -2900,6 +2900,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": { "/api/v1/monitor/device-command-logs": {
"get": { "get": {
"security": [ "security": [
@@ -7363,9 +7421,6 @@
"dto.NutrientResponse": { "dto.NutrientResponse": {
"type": "object", "type": "object",
"properties": { "properties": {
"created_at": {
"type": "string"
},
"description": { "description": {
"type": "string" "type": "string"
}, },
@@ -7381,9 +7436,6 @@
"items": { "items": {
"$ref": "#/definitions/dto.NutrientRawMaterialDTO" "$ref": "#/definitions/dto.NutrientRawMaterialDTO"
} }
},
"updated_at": {
"type": "string"
} }
} }
}, },
@@ -7456,9 +7508,6 @@
"dto.PigAgeStageResponse": { "dto.PigAgeStageResponse": {
"type": "object", "type": "object",
"properties": { "properties": {
"created_at": {
"type": "string"
},
"description": { "description": {
"type": "string" "type": "string"
}, },
@@ -7467,9 +7516,6 @@
}, },
"name": { "name": {
"type": "string" "type": "string"
},
"updated_at": {
"type": "string"
} }
} }
}, },
@@ -7662,9 +7708,6 @@
"breed_disadvantages": { "breed_disadvantages": {
"type": "string" "type": "string"
}, },
"created_at": {
"type": "string"
},
"description": { "description": {
"type": "string" "type": "string"
}, },
@@ -7676,9 +7719,6 @@
}, },
"parent_info": { "parent_info": {
"type": "string" "type": "string"
},
"updated_at": {
"type": "string"
} }
} }
}, },
@@ -7699,9 +7739,6 @@
"dto.PigNutrientRequirementDTO": { "dto.PigNutrientRequirementDTO": {
"type": "object", "type": "object",
"properties": { "properties": {
"created_at": {
"type": "string"
},
"id": { "id": {
"type": "integer" "type": "integer"
}, },
@@ -7719,9 +7756,6 @@
"nutrient_name": { "nutrient_name": {
"description": "营养素名称", "description": "营养素名称",
"type": "string" "type": "string"
},
"updated_at": {
"type": "string"
} }
} }
}, },
@@ -7900,9 +7934,6 @@
"description": "猪品种名称", "description": "猪品种名称",
"type": "string" "type": "string"
}, },
"created_at": {
"type": "string"
},
"daily_feed_intake": { "daily_feed_intake": {
"type": "number" "type": "number"
}, },
@@ -7933,9 +7964,6 @@
"items": { "items": {
"$ref": "#/definitions/dto.PigNutrientRequirementDTO" "$ref": "#/definitions/dto.PigNutrientRequirementDTO"
} }
},
"updated_at": {
"type": "string"
} }
} }
}, },
@@ -8047,9 +8075,6 @@
"dto.RawMaterialNutrientDTO": { "dto.RawMaterialNutrientDTO": {
"type": "object", "type": "object",
"properties": { "properties": {
"created_at": {
"type": "string"
},
"id": { "id": {
"type": "integer" "type": "integer"
}, },
@@ -8060,21 +8085,32 @@
"description": "营养素名称", "description": "营养素名称",
"type": "string" "type": "string"
}, },
"updated_at": {
"type": "string"
},
"value": { "value": {
"description": "营养价值含量", "description": "营养价值含量",
"type": "number" "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": { "dto.RawMaterialResponse": {
"type": "object", "type": "object",
"properties": { "properties": {
"created_at": {
"type": "string"
},
"description": { "description": {
"type": "string" "type": "string"
}, },
@@ -8090,9 +8126,6 @@
"items": { "items": {
"$ref": "#/definitions/dto.RawMaterialNutrientDTO" "$ref": "#/definitions/dto.RawMaterialNutrientDTO"
} }
},
"updated_at": {
"type": "string"
} }
} }
}, },
@@ -8986,6 +9019,20 @@
} }
} }
}, },
"dto.UpdateRawMaterialNutrientsRequest": {
"type": "object",
"required": [
"nutrients"
],
"properties": {
"nutrients": {
"type": "array",
"items": {
"$ref": "#/definitions/dto.RawMaterialNutrientItem"
}
}
}
},
"dto.UpdateRawMaterialRequest": { "dto.UpdateRawMaterialRequest": {
"type": "object", "type": "object",
"required": [ "required": [
@@ -9265,10 +9312,10 @@
"models.Operator": { "models.Operator": {
"type": "string", "type": "string",
"enum": [ "enum": [
"\u003c", "\u003C",
"\u003c=", "\u003C=",
"\u003e", "\u003E",
"\u003e=", "\u003E=",
"=", "=",
"!=" "!="
], ],

View File

@@ -10,8 +10,6 @@ import {PaginationDTO, Response} from '../enums';
* @property {number} id * @property {number} id
* @property {string} name * @property {string} name
* @property {string} description * @property {string} description
* @property {string} created_at
* @property {string} updated_at
* @property {Array<NutrientRawMaterialDTO>} raw_materials - 包含此营养的原料列表 * @property {Array<NutrientRawMaterialDTO>} raw_materials - 包含此营养的原料列表
*/ */
@@ -56,8 +54,6 @@ import {PaginationDTO, Response} from '../enums';
* @property {number} id * @property {number} id
* @property {string} name * @property {string} name
* @property {string} description * @property {string} description
* @property {string} created_at
* @property {string} updated_at
*/ */
/** /**
@@ -97,8 +93,6 @@ import {PaginationDTO, Response} from '../enums';
* @property {string} [appearance_features] * @property {string} [appearance_features]
* @property {string} [breed_advantages] * @property {string} [breed_advantages]
* @property {string} [breed_disadvantages] * @property {string} [breed_disadvantages]
* @property {string} created_at
* @property {string} updated_at
*/ */
/** /**
@@ -144,8 +138,6 @@ import {PaginationDTO, Response} from '../enums';
* @property {string} nutrient_name * @property {string} nutrient_name
* @property {number} min_requirement * @property {number} min_requirement
* @property {number} max_requirement * @property {number} max_requirement
* @property {string} created_at
* @property {string} updated_at
*/ */
/** /**
@@ -163,8 +155,6 @@ import {PaginationDTO, Response} from '../enums';
* @property {number} [daily_gain_weight] * @property {number} [daily_gain_weight]
* @property {number} [daily_feed_intake] * @property {number} [daily_feed_intake]
* @property {Array<PigNutrientRequirementDTO>} pig_nutrient_requirements * @property {Array<PigNutrientRequirementDTO>} pig_nutrient_requirements
* @property {string} created_at
* @property {string} updated_at
*/ */
/** /**
@@ -212,14 +202,23 @@ import {PaginationDTO, Response} from '../enums';
// --- RawMaterial --- // --- RawMaterial ---
/**
* @typedef {object} RawMaterialNutrientItem
* @property {number} nutrient_id - 营养素ID
* @property {number} value - 含量值必须大于等于0
*/
/**
* @typedef {object} UpdateRawMaterialNutrientsRequest
* @property {Array<RawMaterialNutrientItem>} nutrients
*/
/** /**
* @typedef {object} RawMaterialNutrientDTO * @typedef {object} RawMaterialNutrientDTO
* @property {number} id * @property {number} id
* @property {number} nutrient_id * @property {number} nutrient_id
* @property {string} nutrient_name * @property {string} nutrient_name
* @property {number} value * @property {number} value
* @property {string} created_at
* @property {string} updated_at
*/ */
/** /**
@@ -228,8 +227,6 @@ import {PaginationDTO, Response} from '../enums';
* @property {string} name * @property {string} name
* @property {string} description * @property {string} description
* @property {Array<RawMaterialNutrientDTO>} raw_material_nutrients * @property {Array<RawMaterialNutrientDTO>} raw_material_nutrients
* @property {string} created_at
* @property {string} updated_at
*/ */
/** /**
@@ -502,6 +499,16 @@ export const deleteRawMaterial = (id) => {
return http.delete(`/api/v1/feed/raw-materials/${id}`); return http.delete(`/api/v1/feed/raw-materials/${id}`);
}; };
/**
* 全量更新原料的营养成分
* @param {number} id - 原料ID
* @param {UpdateRawMaterialNutrientsRequest} data - 新的营养成分列表
* @returns {Promise<Response<RawMaterialResponse>>}
*/
export const updateRawMaterialNutrients = (id, data) => {
return http.put(`/api/v1/feed/raw-materials/${id}/nutrients`, data);
};
export const FeedApi = { export const FeedApi = {
getNutrients, getNutrients,
@@ -529,4 +536,5 @@ export const FeedApi = {
getRawMaterialById, getRawMaterialById,
updateRawMaterial, updateRawMaterial,
deleteRawMaterial, deleteRawMaterial,
updateRawMaterialNutrients,
}; };