更新swag

This commit is contained in:
2025-11-26 20:51:22 +08:00
parent 6387a5798b
commit 17ae47fa68
2 changed files with 88 additions and 8 deletions

View File

@@ -3140,6 +3140,52 @@
} }
} }
}, },
"/api/v1/feed/recipes/generate-from-all-materials/{pig_type_id}": {
"post": {
"security": [
{
"BearerAuth": []
}
],
"description": "根据指定的猪类型ID使用系统中所有可用的原料自动计算并创建一个成本最优的配方。",
"produces": [
"application/json"
],
"tags": [
"饲料管理-配方"
],
"summary": "使用系统中所有可用的原料一键生成配方",
"parameters": [
{
"type": "integer",
"description": "猪类型ID",
"name": "pig_type_id",
"in": "path",
"required": true
}
],
"responses": {
"201": {
"description": "业务码为201代表创建成功",
"schema": {
"allOf": [
{
"$ref": "#/definitions/controller.Response"
},
{
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/dto.GenerateRecipeResponse"
}
}
}
]
}
}
}
}
},
"/api/v1/feed/recipes/{id}": { "/api/v1/feed/recipes/{id}": {
"get": { "get": {
"security": [ "security": [
@@ -3664,7 +3710,6 @@
}, },
{ {
"enum": [ "enum": [
7,
-1, -1,
0, 0,
1, 1,
@@ -3674,12 +3719,12 @@
5, 5,
-1, -1,
5, 5,
6 6,
7
], ],
"type": "integer", "type": "integer",
"format": "int32", "format": "int32",
"x-enum-varnames": [ "x-enum-varnames": [
"_numLevels",
"DebugLevel", "DebugLevel",
"InfoLevel", "InfoLevel",
"WarnLevel", "WarnLevel",
@@ -3689,7 +3734,8 @@
"FatalLevel", "FatalLevel",
"_minLevel", "_minLevel",
"_maxLevel", "_maxLevel",
"InvalidLevel" "InvalidLevel",
"_numLevels"
], ],
"name": "level", "name": "level",
"in": "query" "in": "query"
@@ -7434,6 +7480,23 @@
} }
} }
}, },
"dto.GenerateRecipeResponse": {
"type": "object",
"properties": {
"description": {
"description": "新生成的配方描述",
"type": "string"
},
"id": {
"description": "新生成的配方ID",
"type": "integer"
},
"name": {
"description": "新生成的配方名称",
"type": "string"
}
}
},
"dto.HistoricalAlarmDTO": { "dto.HistoricalAlarmDTO": {
"type": "object", "type": "object",
"properties": { "properties": {
@@ -10518,7 +10581,6 @@
"type": "integer", "type": "integer",
"format": "int32", "format": "int32",
"enum": [ "enum": [
7,
-1, -1,
0, 0,
1, 1,
@@ -10528,10 +10590,10 @@
5, 5,
-1, -1,
5, 5,
6 6,
7
], ],
"x-enum-varnames": [ "x-enum-varnames": [
"_numLevels",
"DebugLevel", "DebugLevel",
"InfoLevel", "InfoLevel",
"WarnLevel", "WarnLevel",
@@ -10541,7 +10603,8 @@
"FatalLevel", "FatalLevel",
"_minLevel", "_minLevel",
"_maxLevel", "_maxLevel",
"InvalidLevel" "InvalidLevel",
"_numLevels"
] ]
} }
}, },

View File

@@ -317,6 +317,13 @@ import {PaginationDTO, Response} from '../enums';
* @property {Array<RecipeIngredientDto>} [recipe_ingredients] - 配方原料组成 * @property {Array<RecipeIngredientDto>} [recipe_ingredients] - 配方原料组成
*/ */
/**
* @typedef {object} GenerateRecipeResponse
* @property {number} id - 新生成的配方ID
* @property {string} name - 新生成的配方名称
* @property {string} description - 新生成的配方描述
*/
// --- API Functions --- // --- API Functions ---
@@ -628,6 +635,15 @@ export const deleteRecipe = (id) => {
return http.delete(`/api/v1/feed/recipes/${id}`); return http.delete(`/api/v1/feed/recipes/${id}`);
}; };
/**
* 使用系统中所有可用的原料一键生成配方
* @param {number} pigTypeId - 猪类型ID
* @returns {Promise<Response<GenerateRecipeResponse>>}
*/
export const generateRecipeFromAllMaterials = (pigTypeId) => {
return http.post(`/api/v1/feed/recipes/generate-from-all-materials/${pigTypeId}`);
};
export const FeedApi = { export const FeedApi = {
getNutrients, getNutrients,
@@ -662,4 +678,5 @@ export const FeedApi = {
getRecipeById, getRecipeById,
updateRecipe, updateRecipe,
deleteRecipe, deleteRecipe,
generateRecipeFromAllMaterials,
}; };