更新swag

This commit is contained in:
2025-11-21 16:46:25 +08:00
parent 9cf0c07996
commit f925df405f
2 changed files with 112 additions and 80 deletions

View File

@@ -3069,6 +3069,7 @@
},
{
"enum": [
7,
-1,
0,
1,
@@ -3078,12 +3079,12 @@
5,
-1,
5,
6,
7
6
],
"type": "integer",
"format": "int32",
"x-enum-varnames": [
"_numLevels",
"DebugLevel",
"InfoLevel",
"WarnLevel",
@@ -3093,8 +3094,7 @@
"FatalLevel",
"_minLevel",
"_maxLevel",
"InvalidLevel",
"_numLevels"
"InvalidLevel"
],
"name": "level",
"in": "query"
@@ -7331,6 +7331,23 @@
}
}
},
"dto.NutrientRawMaterialDTO": {
"type": "object",
"properties": {
"id": {
"description": "原料ID",
"type": "integer"
},
"name": {
"description": "原料名称",
"type": "string"
},
"value": {
"description": "该原料中此营养素的含量",
"type": "number"
}
}
},
"dto.NutrientResponse": {
"type": "object",
"properties": {
@@ -7346,6 +7363,13 @@
"name": {
"type": "string"
},
"raw_materials": {
"description": "包含此营养的原料列表",
"type": "array",
"items": {
"$ref": "#/definitions/dto.NutrientRawMaterialDTO"
}
},
"updated_at": {
"type": "string"
}
@@ -9617,6 +9641,7 @@
"type": "integer",
"format": "int32",
"enum": [
7,
-1,
0,
1,
@@ -9626,10 +9651,10 @@
5,
-1,
5,
6,
7
6
],
"x-enum-varnames": [
"_numLevels",
"DebugLevel",
"InfoLevel",
"WarnLevel",
@@ -9639,8 +9664,7 @@
"FatalLevel",
"_minLevel",
"_maxLevel",
"InvalidLevel",
"_numLevels"
"InvalidLevel"
]
}
},

View File

@@ -1,9 +1,9 @@
import http from '../utils/http';
import { PaginationDTO, Response } from '../enums';
import {PaginationDTO, Response} from '../enums';
// --- Typedefs for Feed Management ---
// --- Nutrient ---
// --- NutrientRawMaterial ---
/**
* @typedef {object} NutrientResponse
@@ -12,6 +12,14 @@ import { PaginationDTO, Response } from '../enums';
* @property {string} description
* @property {string} created_at
* @property {string} updated_at
* @property {Array<NutrientRawMaterialDTO>} raw_materials - 包含此营养的原料列表
*/
/**
* @typedef {object} NutrientRawMaterialDTO
* @property {number} id - 原料ID
* @property {string} name - 原料名称
* @property {number} value - 该原料中此营养素的含量
*/
/**
@@ -257,38 +265,38 @@ import { PaginationDTO, Response } from '../enums';
/**
* 获取营养种类列表
* @param {NutrientsParams} params - 查询参数
* @returns {Promise<ListNutrientResponse>}
* @returns {Promise<Response<ListNutrientResponse>>}
*/
export const getNutrients = (params) => {
return http.get('/api/v1/feed/nutrients', { params });
return http.get('/api/v1/feed/nutrients', {params});
};
/**
* 创建营养种类
* @param {CreateNutrientRequest} data - 请求体
* @returns {Promise<NutrientResponse>}
* @returns {Promise<Response<NutrientResponse>>}
*/
export const createNutrient = (data) => {
return http.post('/api/v1/feed/nutrients', data);
return http.post('/api/v1/feed/nutrients', data);
};
/**
* 获取营养种类详情
* @param {number} id - 营养种类ID
* @returns {Promise<NutrientResponse>}
* @returns {Promise<Response<NutrientResponse>>}
*/
export const getNutrientById = (id) => {
return http.get(`/api/v1/feed/nutrients/${id}`);
return http.get(`/api/v1/feed/nutrients/${id}`);
};
/**
* 更新营养种类
* @param {number} id - 营养种类ID
* @param {UpdateNutrientRequest} data - 请求体
* @returns {Promise<NutrientResponse>}
* @returns {Promise<Response<NutrientResponse>>}
*/
export const updateNutrient = (id, data) => {
return http.put(`/api/v1/feed/nutrients/${id}`, data);
return http.put(`/api/v1/feed/nutrients/${id}`, data);
};
/**
@@ -297,7 +305,7 @@ export const updateNutrient = (id, data) => {
* @returns {Promise<Response>}
*/
export const deleteNutrient = (id) => {
return http.delete(`/api/v1/feed/nutrients/${id}`);
return http.delete(`/api/v1/feed/nutrients/${id}`);
};
// --- PigAgeStage ---
@@ -305,38 +313,38 @@ export const deleteNutrient = (id) => {
/**
* 获取猪年龄阶段列表
* @param {PigAgeStagesParams} params - 查询参数
* @returns {Promise<ListPigAgeStageResponse>}
* @returns {Promise<Response<ListPigAgeStageResponse>>}
*/
export const getPigAgeStages = (params) => {
return http.get('/api/v1/feed/pig-age-stages', { params });
return http.get('/api/v1/feed/pig-age-stages', {params});
};
/**
* 创建猪年龄阶段
* @param {CreatePigAgeStageRequest} data - 请求体
* @returns {Promise<PigAgeStageResponse>}
* @returns {Promise<Response<PigAgeStageResponse>>}
*/
export const createPigAgeStage = (data) => {
return http.post('/api/v1/feed/pig-age-stages', data);
return http.post('/api/v1/feed/pig-age-stages', data);
};
/**
* 获取猪年龄阶段详情
* @param {number} id - 猪年龄阶段ID
* @returns {Promise<PigAgeStageResponse>}
* @returns {Promise<Response<PigAgeStageResponse>>}
*/
export const getPigAgeStageById = (id) => {
return http.get(`/api/v1/feed/pig-age-stages/${id}`);
return http.get(`/api/v1/feed/pig-age-stages/${id}`);
};
/**
* 更新猪年龄阶段
* @param {number} id - 猪年龄阶段ID
* @param {UpdatePigAgeStageRequest} data - 请求体
* @returns {Promise<PigAgeStageResponse>}
* @returns {Promise<Response<PigAgeStageResponse>>}
*/
export const updatePigAgeStage = (id, data) => {
return http.put(`/api/v1/feed/pig-age-stages/${id}`, data);
return http.put(`/api/v1/feed/pig-age-stages/${id}`, data);
};
/**
@@ -345,7 +353,7 @@ export const updatePigAgeStage = (id, data) => {
* @returns {Promise<Response>}
*/
export const deletePigAgeStage = (id) => {
return http.delete(`/api/v1/feed/pig-age-stages/${id}`);
return http.delete(`/api/v1/feed/pig-age-stages/${id}`);
};
// --- PigBreed ---
@@ -353,38 +361,38 @@ export const deletePigAgeStage = (id) => {
/**
* 获取猪品种列表
* @param {PigBreedsParams} params - 查询参数
* @returns {Promise<ListPigBreedResponse>}
* @returns {Promise<Response<ListPigBreedResponse>>}
*/
export const getPigBreeds = (params) => {
return http.get('/api/v1/feed/pig-breeds', { params });
return http.get('/api/v1/feed/pig-breeds', {params});
};
/**
* 创建猪品种
* @param {CreatePigBreedRequest} data - 请求体
* @returns {Promise<PigBreedResponse>}
* @returns {Promise<Response<PigBreedResponse>>}
*/
export const createPigBreed = (data) => {
return http.post('/api/v1/feed/pig-breeds', data);
return http.post('/api/v1/feed/pig-breeds', data);
};
/**
* 获取猪品种详情
* @param {number} id - 猪品种ID
* @returns {Promise<PigBreedResponse>}
* @returns {Promise<Response<PigBreedResponse>>}
*/
export const getPigBreedById = (id) => {
return http.get(`/api/v1/feed/pig-breeds/${id}`);
return http.get(`/api/v1/feed/pig-breeds/${id}`);
};
/**
* 更新猪品种
* @param {number} id - 猪品种ID
* @param {UpdatePigBreedRequest} data - 请求体
* @returns {Promise<PigBreedResponse>}
* @returns {Promise<Response<PigBreedResponse>>}
*/
export const updatePigBreed = (id, data) => {
return http.put(`/api/v1/feed/pig-breeds/${id}`, data);
return http.put(`/api/v1/feed/pig-breeds/${id}`, data);
};
/**
@@ -393,7 +401,7 @@ export const updatePigBreed = (id, data) => {
* @returns {Promise<Response>}
*/
export const deletePigBreed = (id) => {
return http.delete(`/api/v1/feed/pig-breeds/${id}`);
return http.delete(`/api/v1/feed/pig-breeds/${id}`);
};
// --- PigType ---
@@ -401,38 +409,38 @@ export const deletePigBreed = (id) => {
/**
* 获取猪类型列表
* @param {PigTypesParams} params - 查询参数
* @returns {Promise<ListPigTypeResponse>}
* @returns {Promise<Response<ListPigTypeResponse>>}
*/
export const getPigTypes = (params) => {
return http.get('/api/v1/feed/pig-types', { params });
return http.get('/api/v1/feed/pig-types', {params});
};
/**
* 创建猪类型
* @param {CreatePigTypeRequest} data - 请求体
* @returns {Promise<PigTypeResponse>}
* @returns {Promise<Response<PigTypeResponse>>}
*/
export const createPigType = (data) => {
return http.post('/api/v1/feed/pig-types', data);
return http.post('/api/v1/feed/pig-types', data);
};
/**
* 获取猪类型详情
* @param {number} id - 猪类型ID
* @returns {Promise<PigTypeResponse>}
* @returns {Promise<Response<PigTypeResponse>>}
*/
export const getPigTypeById = (id) => {
return http.get(`/api/v1/feed/pig-types/${id}`);
return http.get(`/api/v1/feed/pig-types/${id}`);
};
/**
* 更新猪类型
* @param {number} id - 猪类型ID
* @param {UpdatePigTypeRequest} data - 请求体
* @returns {Promise<PigTypeResponse>}
* @returns {Promise<Response<PigTypeResponse>>}
*/
export const updatePigType = (id, data) => {
return http.put(`/api/v1/feed/pig-types/${id}`, data);
return http.put(`/api/v1/feed/pig-types/${id}`, data);
};
/**
@@ -441,7 +449,7 @@ export const updatePigType = (id, data) => {
* @returns {Promise<Response>}
*/
export const deletePigType = (id) => {
return http.delete(`/api/v1/feed/pig-types/${id}`);
return http.delete(`/api/v1/feed/pig-types/${id}`);
};
// --- RawMaterial ---
@@ -449,38 +457,38 @@ export const deletePigType = (id) => {
/**
* 获取原料列表
* @param {RawMaterialsParams} params - 查询参数
* @returns {Promise<ListRawMaterialResponse>}
* @returns {Promise<Response<ListRawMaterialResponse>>}
*/
export const getRawMaterials = (params) => {
return http.get('/api/v1/feed/raw-materials', { params });
return http.get('/api/v1/feed/raw-materials', {params});
};
/**
* 创建原料
* @param {CreateRawMaterialRequest} data - 请求体
* @returns {Promise<RawMaterialResponse>}
* @returns {Promise<Response<RawMaterialResponse>>}
*/
export const createRawMaterial = (data) => {
return http.post('/api/v1/feed/raw-materials', data);
return http.post('/api/v1/feed/raw-materials', data);
};
/**
* 获取原料详情
* @param {number} id - 原料ID
* @returns {Promise<RawMaterialResponse>}
* @returns {Promise<Response<RawMaterialResponse>>}
*/
export const getRawMaterialById = (id) => {
return http.get(`/api/v1/feed/raw-materials/${id}`);
return http.get(`/api/v1/feed/raw-materials/${id}`);
};
/**
* 更新原料
* @param {number} id - 原料ID
* @param {UpdateRawMaterialRequest} data - 请求体
* @returns {Promise<RawMaterialResponse>}
* @returns {Promise<Response<RawMaterialResponse>>}
*/
export const updateRawMaterial = (id, data) => {
return http.put(`/api/v1/feed/raw-materials/${id}`, data);
return http.put(`/api/v1/feed/raw-materials/${id}`, data);
};
/**
@@ -489,34 +497,34 @@ export const updateRawMaterial = (id, data) => {
* @returns {Promise<Response>}
*/
export const deleteRawMaterial = (id) => {
return http.delete(`/api/v1/feed/raw-materials/${id}`);
return http.delete(`/api/v1/feed/raw-materials/${id}`);
};
export const FeedApi = {
getNutrients,
createNutrient,
getNutrientById,
updateNutrient,
deleteNutrient,
getPigAgeStages,
createPigAgeStage,
getPigAgeStageById,
updatePigAgeStage,
deletePigAgeStage,
getPigBreeds,
createPigBreed,
getPigBreedById,
updatePigBreed,
deletePigBreed,
getPigTypes,
createPigType,
getPigTypeById,
updatePigType,
deletePigType,
getRawMaterials,
createRawMaterial,
getRawMaterialById,
updateRawMaterial,
deleteRawMaterial,
getNutrients,
createNutrient,
getNutrientById,
updateNutrient,
deleteNutrient,
getPigAgeStages,
createPigAgeStage,
getPigAgeStageById,
updatePigAgeStage,
deletePigAgeStage,
getPigBreeds,
createPigBreed,
getPigBreedById,
updatePigBreed,
deletePigBreed,
getPigTypes,
createPigType,
getPigTypeById,
updatePigType,
deletePigType,
getRawMaterials,
createRawMaterial,
getRawMaterialById,
updateRawMaterial,
deleteRawMaterial,
};