更新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": [ "enum": [
7,
-1, -1,
0, 0,
1, 1,
@@ -3078,12 +3079,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",
@@ -3093,8 +3094,7 @@
"FatalLevel", "FatalLevel",
"_minLevel", "_minLevel",
"_maxLevel", "_maxLevel",
"InvalidLevel", "InvalidLevel"
"_numLevels"
], ],
"name": "level", "name": "level",
"in": "query" "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": { "dto.NutrientResponse": {
"type": "object", "type": "object",
"properties": { "properties": {
@@ -7346,6 +7363,13 @@
"name": { "name": {
"type": "string" "type": "string"
}, },
"raw_materials": {
"description": "包含此营养的原料列表",
"type": "array",
"items": {
"$ref": "#/definitions/dto.NutrientRawMaterialDTO"
}
},
"updated_at": { "updated_at": {
"type": "string" "type": "string"
} }
@@ -9617,6 +9641,7 @@
"type": "integer", "type": "integer",
"format": "int32", "format": "int32",
"enum": [ "enum": [
7,
-1, -1,
0, 0,
1, 1,
@@ -9626,10 +9651,10 @@
5, 5,
-1, -1,
5, 5,
6, 6
7
], ],
"x-enum-varnames": [ "x-enum-varnames": [
"_numLevels",
"DebugLevel", "DebugLevel",
"InfoLevel", "InfoLevel",
"WarnLevel", "WarnLevel",
@@ -9639,8 +9664,7 @@
"FatalLevel", "FatalLevel",
"_minLevel", "_minLevel",
"_maxLevel", "_maxLevel",
"InvalidLevel", "InvalidLevel"
"_numLevels"
] ]
} }
}, },

View File

@@ -3,7 +3,7 @@ import { PaginationDTO, Response } from '../enums';
// --- Typedefs for Feed Management --- // --- Typedefs for Feed Management ---
// --- Nutrient --- // --- NutrientRawMaterial ---
/** /**
* @typedef {object} NutrientResponse * @typedef {object} NutrientResponse
@@ -12,6 +12,14 @@ import { PaginationDTO, Response } from '../enums';
* @property {string} description * @property {string} description
* @property {string} created_at * @property {string} created_at
* @property {string} updated_at * @property {string} updated_at
* @property {Array<NutrientRawMaterialDTO>} raw_materials - 包含此营养的原料列表
*/
/**
* @typedef {object} NutrientRawMaterialDTO
* @property {number} id - 原料ID
* @property {string} name - 原料名称
* @property {number} value - 该原料中此营养素的含量
*/ */
/** /**
@@ -257,7 +265,7 @@ import { PaginationDTO, Response } from '../enums';
/** /**
* 获取营养种类列表 * 获取营养种类列表
* @param {NutrientsParams} params - 查询参数 * @param {NutrientsParams} params - 查询参数
* @returns {Promise<ListNutrientResponse>} * @returns {Promise<Response<ListNutrientResponse>>}
*/ */
export const getNutrients = (params) => { export const getNutrients = (params) => {
return http.get('/api/v1/feed/nutrients', {params}); return http.get('/api/v1/feed/nutrients', {params});
@@ -266,7 +274,7 @@ export const getNutrients = (params) => {
/** /**
* 创建营养种类 * 创建营养种类
* @param {CreateNutrientRequest} data - 请求体 * @param {CreateNutrientRequest} data - 请求体
* @returns {Promise<NutrientResponse>} * @returns {Promise<Response<NutrientResponse>>}
*/ */
export const createNutrient = (data) => { export const createNutrient = (data) => {
return http.post('/api/v1/feed/nutrients', data); return http.post('/api/v1/feed/nutrients', data);
@@ -275,7 +283,7 @@ export const createNutrient = (data) => {
/** /**
* 获取营养种类详情 * 获取营养种类详情
* @param {number} id - 营养种类ID * @param {number} id - 营养种类ID
* @returns {Promise<NutrientResponse>} * @returns {Promise<Response<NutrientResponse>>}
*/ */
export const getNutrientById = (id) => { export const getNutrientById = (id) => {
return http.get(`/api/v1/feed/nutrients/${id}`); return http.get(`/api/v1/feed/nutrients/${id}`);
@@ -285,7 +293,7 @@ export const getNutrientById = (id) => {
* 更新营养种类 * 更新营养种类
* @param {number} id - 营养种类ID * @param {number} id - 营养种类ID
* @param {UpdateNutrientRequest} data - 请求体 * @param {UpdateNutrientRequest} data - 请求体
* @returns {Promise<NutrientResponse>} * @returns {Promise<Response<NutrientResponse>>}
*/ */
export const updateNutrient = (id, data) => { export const updateNutrient = (id, data) => {
return http.put(`/api/v1/feed/nutrients/${id}`, data); return http.put(`/api/v1/feed/nutrients/${id}`, data);
@@ -305,7 +313,7 @@ export const deleteNutrient = (id) => {
/** /**
* 获取猪年龄阶段列表 * 获取猪年龄阶段列表
* @param {PigAgeStagesParams} params - 查询参数 * @param {PigAgeStagesParams} params - 查询参数
* @returns {Promise<ListPigAgeStageResponse>} * @returns {Promise<Response<ListPigAgeStageResponse>>}
*/ */
export const getPigAgeStages = (params) => { export const getPigAgeStages = (params) => {
return http.get('/api/v1/feed/pig-age-stages', {params}); return http.get('/api/v1/feed/pig-age-stages', {params});
@@ -314,7 +322,7 @@ export const getPigAgeStages = (params) => {
/** /**
* 创建猪年龄阶段 * 创建猪年龄阶段
* @param {CreatePigAgeStageRequest} data - 请求体 * @param {CreatePigAgeStageRequest} data - 请求体
* @returns {Promise<PigAgeStageResponse>} * @returns {Promise<Response<PigAgeStageResponse>>}
*/ */
export const createPigAgeStage = (data) => { export const createPigAgeStage = (data) => {
return http.post('/api/v1/feed/pig-age-stages', data); return http.post('/api/v1/feed/pig-age-stages', data);
@@ -323,7 +331,7 @@ export const createPigAgeStage = (data) => {
/** /**
* 获取猪年龄阶段详情 * 获取猪年龄阶段详情
* @param {number} id - 猪年龄阶段ID * @param {number} id - 猪年龄阶段ID
* @returns {Promise<PigAgeStageResponse>} * @returns {Promise<Response<PigAgeStageResponse>>}
*/ */
export const getPigAgeStageById = (id) => { export const getPigAgeStageById = (id) => {
return http.get(`/api/v1/feed/pig-age-stages/${id}`); return http.get(`/api/v1/feed/pig-age-stages/${id}`);
@@ -333,7 +341,7 @@ export const getPigAgeStageById = (id) => {
* 更新猪年龄阶段 * 更新猪年龄阶段
* @param {number} id - 猪年龄阶段ID * @param {number} id - 猪年龄阶段ID
* @param {UpdatePigAgeStageRequest} data - 请求体 * @param {UpdatePigAgeStageRequest} data - 请求体
* @returns {Promise<PigAgeStageResponse>} * @returns {Promise<Response<PigAgeStageResponse>>}
*/ */
export const updatePigAgeStage = (id, data) => { 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);
@@ -353,7 +361,7 @@ export const deletePigAgeStage = (id) => {
/** /**
* 获取猪品种列表 * 获取猪品种列表
* @param {PigBreedsParams} params - 查询参数 * @param {PigBreedsParams} params - 查询参数
* @returns {Promise<ListPigBreedResponse>} * @returns {Promise<Response<ListPigBreedResponse>>}
*/ */
export const getPigBreeds = (params) => { export const getPigBreeds = (params) => {
return http.get('/api/v1/feed/pig-breeds', {params}); return http.get('/api/v1/feed/pig-breeds', {params});
@@ -362,7 +370,7 @@ export const getPigBreeds = (params) => {
/** /**
* 创建猪品种 * 创建猪品种
* @param {CreatePigBreedRequest} data - 请求体 * @param {CreatePigBreedRequest} data - 请求体
* @returns {Promise<PigBreedResponse>} * @returns {Promise<Response<PigBreedResponse>>}
*/ */
export const createPigBreed = (data) => { export const createPigBreed = (data) => {
return http.post('/api/v1/feed/pig-breeds', data); return http.post('/api/v1/feed/pig-breeds', data);
@@ -371,7 +379,7 @@ export const createPigBreed = (data) => {
/** /**
* 获取猪品种详情 * 获取猪品种详情
* @param {number} id - 猪品种ID * @param {number} id - 猪品种ID
* @returns {Promise<PigBreedResponse>} * @returns {Promise<Response<PigBreedResponse>>}
*/ */
export const getPigBreedById = (id) => { export const getPigBreedById = (id) => {
return http.get(`/api/v1/feed/pig-breeds/${id}`); return http.get(`/api/v1/feed/pig-breeds/${id}`);
@@ -381,7 +389,7 @@ export const getPigBreedById = (id) => {
* 更新猪品种 * 更新猪品种
* @param {number} id - 猪品种ID * @param {number} id - 猪品种ID
* @param {UpdatePigBreedRequest} data - 请求体 * @param {UpdatePigBreedRequest} data - 请求体
* @returns {Promise<PigBreedResponse>} * @returns {Promise<Response<PigBreedResponse>>}
*/ */
export const updatePigBreed = (id, data) => { 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);
@@ -401,7 +409,7 @@ export const deletePigBreed = (id) => {
/** /**
* 获取猪类型列表 * 获取猪类型列表
* @param {PigTypesParams} params - 查询参数 * @param {PigTypesParams} params - 查询参数
* @returns {Promise<ListPigTypeResponse>} * @returns {Promise<Response<ListPigTypeResponse>>}
*/ */
export const getPigTypes = (params) => { export const getPigTypes = (params) => {
return http.get('/api/v1/feed/pig-types', {params}); return http.get('/api/v1/feed/pig-types', {params});
@@ -410,7 +418,7 @@ export const getPigTypes = (params) => {
/** /**
* 创建猪类型 * 创建猪类型
* @param {CreatePigTypeRequest} data - 请求体 * @param {CreatePigTypeRequest} data - 请求体
* @returns {Promise<PigTypeResponse>} * @returns {Promise<Response<PigTypeResponse>>}
*/ */
export const createPigType = (data) => { export const createPigType = (data) => {
return http.post('/api/v1/feed/pig-types', data); return http.post('/api/v1/feed/pig-types', data);
@@ -419,7 +427,7 @@ export const createPigType = (data) => {
/** /**
* 获取猪类型详情 * 获取猪类型详情
* @param {number} id - 猪类型ID * @param {number} id - 猪类型ID
* @returns {Promise<PigTypeResponse>} * @returns {Promise<Response<PigTypeResponse>>}
*/ */
export const getPigTypeById = (id) => { export const getPigTypeById = (id) => {
return http.get(`/api/v1/feed/pig-types/${id}`); return http.get(`/api/v1/feed/pig-types/${id}`);
@@ -429,7 +437,7 @@ export const getPigTypeById = (id) => {
* 更新猪类型 * 更新猪类型
* @param {number} id - 猪类型ID * @param {number} id - 猪类型ID
* @param {UpdatePigTypeRequest} data - 请求体 * @param {UpdatePigTypeRequest} data - 请求体
* @returns {Promise<PigTypeResponse>} * @returns {Promise<Response<PigTypeResponse>>}
*/ */
export const updatePigType = (id, data) => { 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);
@@ -449,7 +457,7 @@ export const deletePigType = (id) => {
/** /**
* 获取原料列表 * 获取原料列表
* @param {RawMaterialsParams} params - 查询参数 * @param {RawMaterialsParams} params - 查询参数
* @returns {Promise<ListRawMaterialResponse>} * @returns {Promise<Response<ListRawMaterialResponse>>}
*/ */
export const getRawMaterials = (params) => { export const getRawMaterials = (params) => {
return http.get('/api/v1/feed/raw-materials', {params}); return http.get('/api/v1/feed/raw-materials', {params});
@@ -458,7 +466,7 @@ export const getRawMaterials = (params) => {
/** /**
* 创建原料 * 创建原料
* @param {CreateRawMaterialRequest} data - 请求体 * @param {CreateRawMaterialRequest} data - 请求体
* @returns {Promise<RawMaterialResponse>} * @returns {Promise<Response<RawMaterialResponse>>}
*/ */
export const createRawMaterial = (data) => { export const createRawMaterial = (data) => {
return http.post('/api/v1/feed/raw-materials', data); return http.post('/api/v1/feed/raw-materials', data);
@@ -467,7 +475,7 @@ export const createRawMaterial = (data) => {
/** /**
* 获取原料详情 * 获取原料详情
* @param {number} id - 原料ID * @param {number} id - 原料ID
* @returns {Promise<RawMaterialResponse>} * @returns {Promise<Response<RawMaterialResponse>>}
*/ */
export const getRawMaterialById = (id) => { export const getRawMaterialById = (id) => {
return http.get(`/api/v1/feed/raw-materials/${id}`); return http.get(`/api/v1/feed/raw-materials/${id}`);
@@ -477,7 +485,7 @@ export const getRawMaterialById = (id) => {
* 更新原料 * 更新原料
* @param {number} id - 原料ID * @param {number} id - 原料ID
* @param {UpdateRawMaterialRequest} data - 请求体 * @param {UpdateRawMaterialRequest} data - 请求体
* @returns {Promise<RawMaterialResponse>} * @returns {Promise<Response<RawMaterialResponse>>}
*/ */
export const updateRawMaterial = (id, data) => { 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);