更新swag
This commit is contained in:
@@ -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": {
|
||||
"get": {
|
||||
"security": [
|
||||
@@ -7363,9 +7421,6 @@
|
||||
"dto.NutrientResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"created_at": {
|
||||
"type": "string"
|
||||
},
|
||||
"description": {
|
||||
"type": "string"
|
||||
},
|
||||
@@ -7381,9 +7436,6 @@
|
||||
"items": {
|
||||
"$ref": "#/definitions/dto.NutrientRawMaterialDTO"
|
||||
}
|
||||
},
|
||||
"updated_at": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -7456,9 +7508,6 @@
|
||||
"dto.PigAgeStageResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"created_at": {
|
||||
"type": "string"
|
||||
},
|
||||
"description": {
|
||||
"type": "string"
|
||||
},
|
||||
@@ -7467,9 +7516,6 @@
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"updated_at": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -7662,9 +7708,6 @@
|
||||
"breed_disadvantages": {
|
||||
"type": "string"
|
||||
},
|
||||
"created_at": {
|
||||
"type": "string"
|
||||
},
|
||||
"description": {
|
||||
"type": "string"
|
||||
},
|
||||
@@ -7676,9 +7719,6 @@
|
||||
},
|
||||
"parent_info": {
|
||||
"type": "string"
|
||||
},
|
||||
"updated_at": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -7699,9 +7739,6 @@
|
||||
"dto.PigNutrientRequirementDTO": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"created_at": {
|
||||
"type": "string"
|
||||
},
|
||||
"id": {
|
||||
"type": "integer"
|
||||
},
|
||||
@@ -7719,9 +7756,6 @@
|
||||
"nutrient_name": {
|
||||
"description": "营养素名称",
|
||||
"type": "string"
|
||||
},
|
||||
"updated_at": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -7900,9 +7934,6 @@
|
||||
"description": "猪品种名称",
|
||||
"type": "string"
|
||||
},
|
||||
"created_at": {
|
||||
"type": "string"
|
||||
},
|
||||
"daily_feed_intake": {
|
||||
"type": "number"
|
||||
},
|
||||
@@ -7933,9 +7964,6 @@
|
||||
"items": {
|
||||
"$ref": "#/definitions/dto.PigNutrientRequirementDTO"
|
||||
}
|
||||
},
|
||||
"updated_at": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -8047,9 +8075,6 @@
|
||||
"dto.RawMaterialNutrientDTO": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"created_at": {
|
||||
"type": "string"
|
||||
},
|
||||
"id": {
|
||||
"type": "integer"
|
||||
},
|
||||
@@ -8060,21 +8085,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"
|
||||
},
|
||||
@@ -8090,9 +8126,6 @@
|
||||
"items": {
|
||||
"$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": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
@@ -9265,10 +9312,10 @@
|
||||
"models.Operator": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"\u003c",
|
||||
"\u003c=",
|
||||
"\u003e",
|
||||
"\u003e=",
|
||||
"\u003C",
|
||||
"\u003C=",
|
||||
"\u003E",
|
||||
"\u003E=",
|
||||
"=",
|
||||
"!="
|
||||
],
|
||||
|
||||
@@ -10,8 +10,6 @@ import {PaginationDTO, Response} from '../enums';
|
||||
* @property {number} id
|
||||
* @property {string} name
|
||||
* @property {string} description
|
||||
* @property {string} created_at
|
||||
* @property {string} updated_at
|
||||
* @property {Array<NutrientRawMaterialDTO>} raw_materials - 包含此营养的原料列表
|
||||
*/
|
||||
|
||||
@@ -56,8 +54,6 @@ import {PaginationDTO, Response} from '../enums';
|
||||
* @property {number} id
|
||||
* @property {string} name
|
||||
* @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} [breed_advantages]
|
||||
* @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 {number} min_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_feed_intake]
|
||||
* @property {Array<PigNutrientRequirementDTO>} pig_nutrient_requirements
|
||||
* @property {string} created_at
|
||||
* @property {string} updated_at
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -212,14 +202,23 @@ import {PaginationDTO, Response} from '../enums';
|
||||
|
||||
// --- RawMaterial ---
|
||||
|
||||
/**
|
||||
* @typedef {object} RawMaterialNutrientItem
|
||||
* @property {number} nutrient_id - 营养素ID
|
||||
* @property {number} value - 含量值,必须大于等于0
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {object} UpdateRawMaterialNutrientsRequest
|
||||
* @property {Array<RawMaterialNutrientItem>} nutrients
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {object} RawMaterialNutrientDTO
|
||||
* @property {number} id
|
||||
* @property {number} nutrient_id
|
||||
* @property {string} nutrient_name
|
||||
* @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} description
|
||||
* @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}`);
|
||||
};
|
||||
|
||||
/**
|
||||
* 全量更新原料的营养成分
|
||||
* @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 = {
|
||||
getNutrients,
|
||||
@@ -529,4 +536,5 @@ export const FeedApi = {
|
||||
getRawMaterialById,
|
||||
updateRawMaterial,
|
||||
deleteRawMaterial,
|
||||
updateRawMaterialNutrients,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user