更新swag
This commit is contained in:
@@ -3016,6 +3016,252 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"/api/v1/feed/recipes": {
|
||||||
|
"get": {
|
||||||
|
"security": [
|
||||||
|
{
|
||||||
|
"BearerAuth": []
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "获取所有配方的列表,支持分页和过滤。",
|
||||||
|
"produces": [
|
||||||
|
"application/json"
|
||||||
|
],
|
||||||
|
"tags": [
|
||||||
|
"饲料管理-配方"
|
||||||
|
],
|
||||||
|
"summary": "获取配方列表",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"type": "string",
|
||||||
|
"description": "按名称模糊查询",
|
||||||
|
"name": "name",
|
||||||
|
"in": "query"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "string",
|
||||||
|
"description": "排序字段,例如 \"id DESC\"",
|
||||||
|
"name": "order_by",
|
||||||
|
"in": "query"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "integer",
|
||||||
|
"description": "页码",
|
||||||
|
"name": "page",
|
||||||
|
"in": "query"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "integer",
|
||||||
|
"description": "每页数量",
|
||||||
|
"name": "page_size",
|
||||||
|
"in": "query"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "业务码为200代表成功获取列表",
|
||||||
|
"schema": {
|
||||||
|
"allOf": [
|
||||||
|
{
|
||||||
|
"$ref": "#/definitions/controller.Response"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"data": {
|
||||||
|
"$ref": "#/definitions/dto.ListRecipeResponse"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"post": {
|
||||||
|
"security": [
|
||||||
|
{
|
||||||
|
"BearerAuth": []
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "创建一个新的配方,包含其原料组成。",
|
||||||
|
"consumes": [
|
||||||
|
"application/json"
|
||||||
|
],
|
||||||
|
"produces": [
|
||||||
|
"application/json"
|
||||||
|
],
|
||||||
|
"tags": [
|
||||||
|
"饲料管理-配方"
|
||||||
|
],
|
||||||
|
"summary": "创建配方",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"description": "配方信息",
|
||||||
|
"name": "recipe",
|
||||||
|
"in": "body",
|
||||||
|
"required": true,
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/dto.CreateRecipeRequest"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "业务码为201代表创建成功",
|
||||||
|
"schema": {
|
||||||
|
"allOf": [
|
||||||
|
{
|
||||||
|
"$ref": "#/definitions/controller.Response"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"data": {
|
||||||
|
"$ref": "#/definitions/dto.RecipeResponse"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"/api/v1/feed/recipes/{id}": {
|
||||||
|
"get": {
|
||||||
|
"security": [
|
||||||
|
{
|
||||||
|
"BearerAuth": []
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "根据ID获取单个配方的详细信息。",
|
||||||
|
"produces": [
|
||||||
|
"application/json"
|
||||||
|
],
|
||||||
|
"tags": [
|
||||||
|
"饲料管理-配方"
|
||||||
|
],
|
||||||
|
"summary": "获取配方详情",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"type": "integer",
|
||||||
|
"description": "配方ID",
|
||||||
|
"name": "id",
|
||||||
|
"in": "path",
|
||||||
|
"required": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "业务码为200代表成功获取",
|
||||||
|
"schema": {
|
||||||
|
"allOf": [
|
||||||
|
{
|
||||||
|
"$ref": "#/definitions/controller.Response"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"data": {
|
||||||
|
"$ref": "#/definitions/dto.RecipeResponse"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"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": "recipe",
|
||||||
|
"in": "body",
|
||||||
|
"required": true,
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/dto.UpdateRecipeRequest"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "业务码为200代表更新成功",
|
||||||
|
"schema": {
|
||||||
|
"allOf": [
|
||||||
|
{
|
||||||
|
"$ref": "#/definitions/controller.Response"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"data": {
|
||||||
|
"$ref": "#/definitions/dto.RecipeResponse"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"delete": {
|
||||||
|
"security": [
|
||||||
|
{
|
||||||
|
"BearerAuth": []
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "根据ID删除配方。",
|
||||||
|
"produces": [
|
||||||
|
"application/json"
|
||||||
|
],
|
||||||
|
"tags": [
|
||||||
|
"饲料管理-配方"
|
||||||
|
],
|
||||||
|
"summary": "删除配方",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"type": "integer",
|
||||||
|
"description": "配方ID",
|
||||||
|
"name": "id",
|
||||||
|
"in": "path",
|
||||||
|
"required": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "业务码为200代表删除成功",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/controller.Response"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"/api/v1/monitor/device-command-logs": {
|
"/api/v1/monitor/device-command-logs": {
|
||||||
"get": {
|
"get": {
|
||||||
"security": [
|
"security": [
|
||||||
@@ -6756,6 +7002,31 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"dto.CreateRecipeRequest": {
|
||||||
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"name"
|
||||||
|
],
|
||||||
|
"properties": {
|
||||||
|
"description": {
|
||||||
|
"description": "配方描述",
|
||||||
|
"type": "string",
|
||||||
|
"maxLength": 255
|
||||||
|
},
|
||||||
|
"name": {
|
||||||
|
"description": "配方名称",
|
||||||
|
"type": "string",
|
||||||
|
"maxLength": 100
|
||||||
|
},
|
||||||
|
"recipe_ingredients": {
|
||||||
|
"description": "配方原料组成",
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"$ref": "#/definitions/dto.RecipeIngredientDto"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"dto.CreateUserRequest": {
|
"dto.CreateUserRequest": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"required": [
|
"required": [
|
||||||
@@ -7236,6 +7507,20 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"dto.ListRecipeResponse": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"list": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"$ref": "#/definitions/dto.RecipeResponse"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"pagination": {
|
||||||
|
"$ref": "#/definitions/dto.PaginationDTO"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"dto.ListSensorDataResponse": {
|
"dto.ListSensorDataResponse": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
@@ -8209,6 +8494,44 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"dto.RecipeIngredientDto": {
|
||||||
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"raw_material_id"
|
||||||
|
],
|
||||||
|
"properties": {
|
||||||
|
"percentage": {
|
||||||
|
"description": "原料在配方中的百分比 (0-1之间)",
|
||||||
|
"type": "number",
|
||||||
|
"maximum": 1,
|
||||||
|
"minimum": 0
|
||||||
|
},
|
||||||
|
"raw_material_id": {
|
||||||
|
"description": "原料ID",
|
||||||
|
"type": "integer"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"dto.RecipeResponse": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"description": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"id": {
|
||||||
|
"type": "integer"
|
||||||
|
},
|
||||||
|
"name": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"recipe_ingredients": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"$ref": "#/definitions/dto.RecipeIngredientDto"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"dto.ReclassifyPenToNewBatchRequest": {
|
"dto.ReclassifyPenToNewBatchRequest": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"required": [
|
"required": [
|
||||||
@@ -9145,6 +9468,31 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"dto.UpdateRecipeRequest": {
|
||||||
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"name"
|
||||||
|
],
|
||||||
|
"properties": {
|
||||||
|
"description": {
|
||||||
|
"description": "配方描述",
|
||||||
|
"type": "string",
|
||||||
|
"maxLength": 255
|
||||||
|
},
|
||||||
|
"name": {
|
||||||
|
"description": "配方名称",
|
||||||
|
"type": "string",
|
||||||
|
"maxLength": 100
|
||||||
|
},
|
||||||
|
"recipe_ingredients": {
|
||||||
|
"description": "配方原料组成",
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"$ref": "#/definitions/dto.RecipeIngredientDto"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"dto.UserActionLogDTO": {
|
"dto.UserActionLogDTO": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
|
|||||||
189
src/api/feed.js
189
src/api/feed.js
@@ -212,6 +212,98 @@ import {PaginationDTO, Response} from '../enums';
|
|||||||
* @property {Array<PigNutrientRequirementItem>} nutrient_requirements - 新的营养需求列表
|
* @property {Array<PigNutrientRequirementItem>} nutrient_requirements - 新的营养需求列表
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// --- Recipe ---
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @typedef {object} RecipeIngredientDto
|
||||||
|
* @property {number} raw_material_id - 原料ID
|
||||||
|
* @property {number} [percentage] - 原料在配方中的百分比 (0-1之间)
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @typedef {object} RecipeResponse
|
||||||
|
* @property {number} id
|
||||||
|
* @property {string} name
|
||||||
|
* @property {string} description
|
||||||
|
* @property {Array<RecipeIngredientDto>} recipe_ingredients
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @typedef {object} ListRecipeResponse
|
||||||
|
* @property {Array<RecipeResponse>} list
|
||||||
|
* @property {PaginationDTO} pagination
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @typedef {object} RecipesParams
|
||||||
|
* @property {string} [name] - 按名称模糊查询
|
||||||
|
* @property {string} [order_by] - 排序字段,例如 "id DESC"
|
||||||
|
* @property {number} [page]
|
||||||
|
* @property {number} [page_size]
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @typedef {object} CreateRecipeRequest
|
||||||
|
* @property {string} name - 配方名称
|
||||||
|
* @property {string} [description] - 配方描述
|
||||||
|
* @property {Array<RecipeIngredientDto>} [recipe_ingredients] - 配方原料组成
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @typedef {object} UpdateRecipeRequest
|
||||||
|
* @property {string} name - 配方名称
|
||||||
|
* @property {string} [description] - 配方描述
|
||||||
|
* @property {Array<RecipeIngredientDto>} [recipe_ingredients] - 配方原料组成
|
||||||
|
*/
|
||||||
|
|
||||||
|
// --- Recipe ---
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取配方列表
|
||||||
|
* @param {RecipesParams} params - 查询参数
|
||||||
|
* @returns {Promise<Response<ListRecipeResponse>>}
|
||||||
|
*/
|
||||||
|
export const getRecipes = (params) => {
|
||||||
|
return http.get('/api/v1/feed/recipes', {params});
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建配方
|
||||||
|
* @param {CreateRecipeRequest} data - 请求体
|
||||||
|
* @returns {Promise<Response<RecipeResponse>>}
|
||||||
|
*/
|
||||||
|
export const createRecipe = (data) => {
|
||||||
|
return http.post('/api/v1/feed/recipes', data);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取配方详情
|
||||||
|
* @param {number} id - 配方ID
|
||||||
|
* @returns {Promise<Response<RecipeResponse>>}
|
||||||
|
*/
|
||||||
|
export const getRecipeById = (id) => {
|
||||||
|
return http.get(`/api/v1/feed/recipes/${id}`);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新配方
|
||||||
|
* @param {number} id - 配方ID
|
||||||
|
* @param {UpdateRecipeRequest} data - 请求体
|
||||||
|
* @returns {Promise<Response<RecipeResponse>>}
|
||||||
|
*/
|
||||||
|
export const updateRecipe = (id, data) => {
|
||||||
|
return http.put(`/api/v1/feed/recipes/${id}`, data);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除配方
|
||||||
|
* @param {number} id - 配方ID
|
||||||
|
* @returns {Promise<Response>}
|
||||||
|
*/
|
||||||
|
export const deleteRecipe = (id) => {
|
||||||
|
return http.delete(`/api/v1/feed/recipes/${id}`);
|
||||||
|
};
|
||||||
|
|
||||||
// --- RawMaterial ---
|
// --- RawMaterial ---
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -473,6 +565,98 @@ export const updatePigTypeNutrientRequirements = (id, data) => {
|
|||||||
return http.put(`/api/v1/feed/pig-types/${id}/nutrient-requirements`, data);
|
return http.put(`/api/v1/feed/pig-types/${id}/nutrient-requirements`, data);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// --- Recipe ---
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @typedef {object} RecipeIngredientDto
|
||||||
|
* @property {number} raw_material_id - 原料ID
|
||||||
|
* @property {number} [percentage] - 原料在配方中的百分比 (0-1之间)
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @typedef {object} RecipeResponse
|
||||||
|
* @property {number} id
|
||||||
|
* @property {string} name
|
||||||
|
* @property {string} description
|
||||||
|
* @property {Array<RecipeIngredientDto>} recipe_ingredients
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @typedef {object} ListRecipeResponse
|
||||||
|
* @property {Array<RecipeResponse>} list
|
||||||
|
* @property {PaginationDTO} pagination
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @typedef {object} RecipesParams
|
||||||
|
* @property {string} [name] - 按名称模糊查询
|
||||||
|
* @property {string} [order_by] - 排序字段,例如 "id DESC"
|
||||||
|
* @property {number} [page]
|
||||||
|
* @property {number} [page_size]
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @typedef {object} CreateRecipeRequest
|
||||||
|
* @property {string} name - 配方名称
|
||||||
|
* @property {string} [description] - 配方描述
|
||||||
|
* @property {Array<RecipeIngredientDto>} [recipe_ingredients] - 配方原料组成
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @typedef {object} UpdateRecipeRequest
|
||||||
|
* @property {string} name - 配方名称
|
||||||
|
* @property {string} [description] - 配方描述
|
||||||
|
* @property {Array<RecipeIngredientDto>} [recipe_ingredients] - 配方原料组成
|
||||||
|
*/
|
||||||
|
|
||||||
|
// --- Recipe ---
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取配方列表
|
||||||
|
* @param {RecipesParams} params - 查询参数
|
||||||
|
* @returns {Promise<Response<ListRecipeResponse>>}
|
||||||
|
*/
|
||||||
|
export const getRecipes = (params) => {
|
||||||
|
return http.get('/api/v1/feed/recipes', {params});
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建配方
|
||||||
|
* @param {CreateRecipeRequest} data - 请求体
|
||||||
|
* @returns {Promise<Response<RecipeResponse>>}
|
||||||
|
*/
|
||||||
|
export const createRecipe = (data) => {
|
||||||
|
return http.post('/api/v1/feed/recipes', data);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取配方详情
|
||||||
|
* @param {number} id - 配方ID
|
||||||
|
* @returns {Promise<Response<RecipeResponse>>}
|
||||||
|
*/
|
||||||
|
export const getRecipeById = (id) => {
|
||||||
|
return http.get(`/api/v1/feed/recipes/${id}`);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新配方
|
||||||
|
* @param {number} id - 配方ID
|
||||||
|
* @param {UpdateRecipeRequest} data - 请求体
|
||||||
|
* @returns {Promise<Response<RecipeResponse>>}
|
||||||
|
*/
|
||||||
|
export const updateRecipe = (id, data) => {
|
||||||
|
return http.put(`/api/v1/feed/recipes/${id}`, data);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除配方
|
||||||
|
* @param {number} id - 配方ID
|
||||||
|
* @returns {Promise<Response>}
|
||||||
|
*/
|
||||||
|
export const deleteRecipe = (id) => {
|
||||||
|
return http.delete(`/api/v1/feed/recipes/${id}`);
|
||||||
|
};
|
||||||
|
|
||||||
// --- RawMaterial ---
|
// --- RawMaterial ---
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -554,6 +738,11 @@ export const FeedApi = {
|
|||||||
updatePigType,
|
updatePigType,
|
||||||
deletePigType,
|
deletePigType,
|
||||||
updatePigTypeNutrientRequirements,
|
updatePigTypeNutrientRequirements,
|
||||||
|
getRecipes,
|
||||||
|
createRecipe,
|
||||||
|
getRecipeById,
|
||||||
|
updateRecipe,
|
||||||
|
deleteRecipe,
|
||||||
getRawMaterials,
|
getRawMaterials,
|
||||||
createRawMaterial,
|
createRawMaterial,
|
||||||
getRawMaterialById,
|
getRawMaterialById,
|
||||||
|
|||||||
Reference in New Issue
Block a user