更新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

@@ -1,9 +1,9 @@
import http from '../utils/http'; import http from '../utils/http';
import { PaginationDTO, Response } from '../enums'; 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,38 +265,38 @@ 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});
}; };
/** /**
* 创建营养种类 * 创建营养种类
* @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);
}; };
/** /**
* 获取营养种类详情 * 获取营养种类详情
* @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}`);
}; };
/** /**
* 更新营养种类 * 更新营养种类
* @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);
}; };
/** /**
@@ -297,7 +305,7 @@ export const updateNutrient = (id, data) => {
* @returns {Promise<Response>} * @returns {Promise<Response>}
*/ */
export const deleteNutrient = (id) => { export const deleteNutrient = (id) => {
return http.delete(`/api/v1/feed/nutrients/${id}`); return http.delete(`/api/v1/feed/nutrients/${id}`);
}; };
// --- PigAgeStage --- // --- PigAgeStage ---
@@ -305,38 +313,38 @@ 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});
}; };
/** /**
* 创建猪年龄阶段 * 创建猪年龄阶段
* @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);
}; };
/** /**
* 获取猪年龄阶段详情 * 获取猪年龄阶段详情
* @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}`);
}; };
/** /**
* 更新猪年龄阶段 * 更新猪年龄阶段
* @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);
}; };
/** /**
@@ -345,7 +353,7 @@ export const updatePigAgeStage = (id, data) => {
* @returns {Promise<Response>} * @returns {Promise<Response>}
*/ */
export const deletePigAgeStage = (id) => { 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 --- // --- PigBreed ---
@@ -353,38 +361,38 @@ 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});
}; };
/** /**
* 创建猪品种 * 创建猪品种
* @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);
}; };
/** /**
* 获取猪品种详情 * 获取猪品种详情
* @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}`);
}; };
/** /**
* 更新猪品种 * 更新猪品种
* @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);
}; };
/** /**
@@ -393,7 +401,7 @@ export const updatePigBreed = (id, data) => {
* @returns {Promise<Response>} * @returns {Promise<Response>}
*/ */
export const deletePigBreed = (id) => { export const deletePigBreed = (id) => {
return http.delete(`/api/v1/feed/pig-breeds/${id}`); return http.delete(`/api/v1/feed/pig-breeds/${id}`);
}; };
// --- PigType --- // --- PigType ---
@@ -401,38 +409,38 @@ 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});
}; };
/** /**
* 创建猪类型 * 创建猪类型
* @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);
}; };
/** /**
* 获取猪类型详情 * 获取猪类型详情
* @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}`);
}; };
/** /**
* 更新猪类型 * 更新猪类型
* @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);
}; };
/** /**
@@ -441,7 +449,7 @@ export const updatePigType = (id, data) => {
* @returns {Promise<Response>} * @returns {Promise<Response>}
*/ */
export const deletePigType = (id) => { export const deletePigType = (id) => {
return http.delete(`/api/v1/feed/pig-types/${id}`); return http.delete(`/api/v1/feed/pig-types/${id}`);
}; };
// --- RawMaterial --- // --- RawMaterial ---
@@ -449,38 +457,38 @@ 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});
}; };
/** /**
* 创建原料 * 创建原料
* @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);
}; };
/** /**
* 获取原料详情 * 获取原料详情
* @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}`);
}; };
/** /**
* 更新原料 * 更新原料
* @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);
}; };
/** /**
@@ -489,34 +497,34 @@ export const updateRawMaterial = (id, data) => {
* @returns {Promise<Response>} * @returns {Promise<Response>}
*/ */
export const deleteRawMaterial = (id) => { 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 = { export const FeedApi = {
getNutrients, getNutrients,
createNutrient, createNutrient,
getNutrientById, getNutrientById,
updateNutrient, updateNutrient,
deleteNutrient, deleteNutrient,
getPigAgeStages, getPigAgeStages,
createPigAgeStage, createPigAgeStage,
getPigAgeStageById, getPigAgeStageById,
updatePigAgeStage, updatePigAgeStage,
deletePigAgeStage, deletePigAgeStage,
getPigBreeds, getPigBreeds,
createPigBreed, createPigBreed,
getPigBreedById, getPigBreedById,
updatePigBreed, updatePigBreed,
deletePigBreed, deletePigBreed,
getPigTypes, getPigTypes,
createPigType, createPigType,
getPigTypeById, getPigTypeById,
updatePigType, updatePigType,
deletePigType, deletePigType,
getRawMaterials, getRawMaterials,
createRawMaterial, createRawMaterial,
getRawMaterialById, getRawMaterialById,
updateRawMaterial, updateRawMaterial,
deleteRawMaterial, deleteRawMaterial,
}; };