diff --git a/docs/docs.go b/docs/docs.go index 12ddeb1..5826ff3 100644 --- a/docs/docs.go +++ b/docs/docs.go @@ -899,12 +899,6 @@ const docTemplate = `{ } ] } - }, - "500": { - "description": "内部服务器错误", - "schema": { - "$ref": "#/definitions/controller.Response" - } } } }, @@ -949,18 +943,6 @@ const docTemplate = `{ } ] } - }, - "400": { - "description": "请求参数错误", - "schema": { - "$ref": "#/definitions/controller.Response" - } - }, - "500": { - "description": "内部服务器错误", - "schema": { - "$ref": "#/definitions/controller.Response" - } } } } @@ -1002,24 +984,6 @@ const docTemplate = `{ } ] } - }, - "400": { - "description": "无效的ID格式", - "schema": { - "$ref": "#/definitions/controller.Response" - } - }, - "404": { - "description": "猪批次不存在", - "schema": { - "$ref": "#/definitions/controller.Response" - } - }, - "500": { - "description": "内部服务器错误", - "schema": { - "$ref": "#/definitions/controller.Response" - } } } }, @@ -1071,24 +1035,6 @@ const docTemplate = `{ } ] } - }, - "400": { - "description": "请求参数错误或无效的ID格式", - "schema": { - "$ref": "#/definitions/controller.Response" - } - }, - "404": { - "description": "猪批次不存在", - "schema": { - "$ref": "#/definitions/controller.Response" - } - }, - "500": { - "description": "内部服务器错误", - "schema": { - "$ref": "#/definitions/controller.Response" - } } } }, @@ -1116,24 +1062,6 @@ const docTemplate = `{ "schema": { "$ref": "#/definitions/controller.Response" } - }, - "400": { - "description": "无效的ID格式", - "schema": { - "$ref": "#/definitions/controller.Response" - } - }, - "404": { - "description": "猪批次不存在", - "schema": { - "$ref": "#/definitions/controller.Response" - } - }, - "500": { - "description": "内部服务器错误", - "schema": { - "$ref": "#/definitions/controller.Response" - } } } } @@ -1175,30 +1103,6 @@ const docTemplate = `{ "schema": { "$ref": "#/definitions/controller.Response" } - }, - "400": { - "description": "请求参数错误或无效的ID格式", - "schema": { - "$ref": "#/definitions/controller.Response" - } - }, - "404": { - "description": "猪批次或猪栏不存在", - "schema": { - "$ref": "#/definitions/controller.Response" - } - }, - "409": { - "description": "业务逻辑冲突 (如猪栏已被使用)", - "schema": { - "$ref": "#/definitions/controller.Response" - } - }, - "500": { - "description": "内部服务器错误", - "schema": { - "$ref": "#/definitions/controller.Response" - } } } } diff --git a/docs/swagger.json b/docs/swagger.json index 349588d..44315f0 100644 --- a/docs/swagger.json +++ b/docs/swagger.json @@ -888,12 +888,6 @@ } ] } - }, - "500": { - "description": "内部服务器错误", - "schema": { - "$ref": "#/definitions/controller.Response" - } } } }, @@ -938,18 +932,6 @@ } ] } - }, - "400": { - "description": "请求参数错误", - "schema": { - "$ref": "#/definitions/controller.Response" - } - }, - "500": { - "description": "内部服务器错误", - "schema": { - "$ref": "#/definitions/controller.Response" - } } } } @@ -991,24 +973,6 @@ } ] } - }, - "400": { - "description": "无效的ID格式", - "schema": { - "$ref": "#/definitions/controller.Response" - } - }, - "404": { - "description": "猪批次不存在", - "schema": { - "$ref": "#/definitions/controller.Response" - } - }, - "500": { - "description": "内部服务器错误", - "schema": { - "$ref": "#/definitions/controller.Response" - } } } }, @@ -1060,24 +1024,6 @@ } ] } - }, - "400": { - "description": "请求参数错误或无效的ID格式", - "schema": { - "$ref": "#/definitions/controller.Response" - } - }, - "404": { - "description": "猪批次不存在", - "schema": { - "$ref": "#/definitions/controller.Response" - } - }, - "500": { - "description": "内部服务器错误", - "schema": { - "$ref": "#/definitions/controller.Response" - } } } }, @@ -1105,24 +1051,6 @@ "schema": { "$ref": "#/definitions/controller.Response" } - }, - "400": { - "description": "无效的ID格式", - "schema": { - "$ref": "#/definitions/controller.Response" - } - }, - "404": { - "description": "猪批次不存在", - "schema": { - "$ref": "#/definitions/controller.Response" - } - }, - "500": { - "description": "内部服务器错误", - "schema": { - "$ref": "#/definitions/controller.Response" - } } } } @@ -1164,30 +1092,6 @@ "schema": { "$ref": "#/definitions/controller.Response" } - }, - "400": { - "description": "请求参数错误或无效的ID格式", - "schema": { - "$ref": "#/definitions/controller.Response" - } - }, - "404": { - "description": "猪批次或猪栏不存在", - "schema": { - "$ref": "#/definitions/controller.Response" - } - }, - "409": { - "description": "业务逻辑冲突 (如猪栏已被使用)", - "schema": { - "$ref": "#/definitions/controller.Response" - } - }, - "500": { - "description": "内部服务器错误", - "schema": { - "$ref": "#/definitions/controller.Response" - } } } } diff --git a/docs/swagger.yaml b/docs/swagger.yaml index b74f124..aa93e84 100644 --- a/docs/swagger.yaml +++ b/docs/swagger.yaml @@ -1344,10 +1344,6 @@ paths: $ref: '#/definitions/dto.PigBatchResponseDTO' type: array type: object - "500": - description: 内部服务器错误 - schema: - $ref: '#/definitions/controller.Response' summary: 获取猪批次列表 tags: - 猪批次管理 @@ -1374,14 +1370,6 @@ paths: data: $ref: '#/definitions/dto.PigBatchResponseDTO' type: object - "400": - description: 请求参数错误 - schema: - $ref: '#/definitions/controller.Response' - "500": - description: 内部服务器错误 - schema: - $ref: '#/definitions/controller.Response' summary: 创建猪批次 tags: - 猪批次管理 @@ -1401,18 +1389,6 @@ paths: description: 删除成功 schema: $ref: '#/definitions/controller.Response' - "400": - description: 无效的ID格式 - schema: - $ref: '#/definitions/controller.Response' - "404": - description: 猪批次不存在 - schema: - $ref: '#/definitions/controller.Response' - "500": - description: 内部服务器错误 - schema: - $ref: '#/definitions/controller.Response' summary: 删除猪批次 tags: - 猪批次管理 @@ -1436,18 +1412,6 @@ paths: data: $ref: '#/definitions/dto.PigBatchResponseDTO' type: object - "400": - description: 无效的ID格式 - schema: - $ref: '#/definitions/controller.Response' - "404": - description: 猪批次不存在 - schema: - $ref: '#/definitions/controller.Response' - "500": - description: 内部服务器错误 - schema: - $ref: '#/definitions/controller.Response' summary: 获取单个猪批次 tags: - 猪批次管理 @@ -1479,18 +1443,6 @@ paths: data: $ref: '#/definitions/dto.PigBatchResponseDTO' type: object - "400": - description: 请求参数错误或无效的ID格式 - schema: - $ref: '#/definitions/controller.Response' - "404": - description: 猪批次不存在 - schema: - $ref: '#/definitions/controller.Response' - "500": - description: 内部服务器错误 - schema: - $ref: '#/definitions/controller.Response' summary: 更新猪批次 tags: - 猪批次管理 @@ -1518,22 +1470,6 @@ paths: description: 更新成功 schema: $ref: '#/definitions/controller.Response' - "400": - description: 请求参数错误或无效的ID格式 - schema: - $ref: '#/definitions/controller.Response' - "404": - description: 猪批次或猪栏不存在 - schema: - $ref: '#/definitions/controller.Response' - "409": - description: 业务逻辑冲突 (如猪栏已被使用) - schema: - $ref: '#/definitions/controller.Response' - "500": - description: 内部服务器错误 - schema: - $ref: '#/definitions/controller.Response' summary: 更新猪批次关联的猪栏 tags: - 猪批次管理 diff --git a/internal/app/controller/management/pig_batch_controller.go b/internal/app/controller/management/pig_batch_controller.go index 4debac0..a08f83d 100644 --- a/internal/app/controller/management/pig_batch_controller.go +++ b/internal/app/controller/management/pig_batch_controller.go @@ -34,8 +34,6 @@ func NewPigBatchController(logger *logs.Logger, service service.PigBatchService) // @Produce json // @Param body body dto.PigBatchCreateDTO true "猪批次信息" // @Success 201 {object} controller.Response{data=dto.PigBatchResponseDTO} "创建成功" -// @Failure 400 {object} controller.Response "请求参数错误" -// @Failure 500 {object} controller.Response "内部服务器错误" // @Router /api/v1/pig-batches [post] func (c *PigBatchController) CreatePigBatch(ctx *gin.Context) { const action = "创建猪批次" @@ -64,9 +62,6 @@ func (c *PigBatchController) CreatePigBatch(ctx *gin.Context) { // @Produce json // @Param id path int true "猪批次ID" // @Success 200 {object} controller.Response{data=dto.PigBatchResponseDTO} "获取成功" -// @Failure 400 {object} controller.Response "无效的ID格式" -// @Failure 404 {object} controller.Response "猪批次不存在" -// @Failure 500 {object} controller.Response "内部服务器错误" // @Router /api/v1/pig-batches/{id} [get] func (c *PigBatchController) GetPigBatch(ctx *gin.Context) { const action = "获取猪批次" @@ -99,9 +94,6 @@ func (c *PigBatchController) GetPigBatch(ctx *gin.Context) { // @Param id path int true "猪批次ID" // @Param body body dto.PigBatchUpdateDTO true "猪批次信息" // @Success 200 {object} controller.Response{data=dto.PigBatchResponseDTO} "更新成功" -// @Failure 400 {object} controller.Response "请求参数错误或无效的ID格式" -// @Failure 404 {object} controller.Response "猪批次不存在" -// @Failure 500 {object} controller.Response "内部服务器错误" // @Router /api/v1/pig-batches/{id} [put] func (c *PigBatchController) UpdatePigBatch(ctx *gin.Context) { const action = "更新猪批次" @@ -138,9 +130,6 @@ func (c *PigBatchController) UpdatePigBatch(ctx *gin.Context) { // @Produce json // @Param id path int true "猪批次ID" // @Success 200 {object} controller.Response "删除成功" -// @Failure 400 {object} controller.Response "无效的ID格式" -// @Failure 404 {object} controller.Response "猪批次不存在" -// @Failure 500 {object} controller.Response "内部服务器错误" // @Router /api/v1/pig-batches/{id} [delete] func (c *PigBatchController) DeletePigBatch(ctx *gin.Context) { const action = "删除猪批次" @@ -170,7 +159,6 @@ func (c *PigBatchController) DeletePigBatch(ctx *gin.Context) { // @Produce json // @Param is_active query bool false "是否活跃 (true/false)" // @Success 200 {object} controller.Response{data=[]dto.PigBatchResponseDTO} "获取成功" -// @Failure 500 {object} controller.Response "内部服务器错误" // @Router /api/v1/pig-batches [get] func (c *PigBatchController) ListPigBatches(ctx *gin.Context) { const action = "获取猪批次列表" @@ -200,10 +188,6 @@ func (c *PigBatchController) ListPigBatches(ctx *gin.Context) { // @Param id path int true "猪批次ID" // @Param body body dto.PigBatchUpdatePensRequest true "猪批次关联的猪栏ID列表" // @Success 200 {object} controller.Response "更新成功" -// @Failure 400 {object} controller.Response "请求参数错误或无效的ID格式" -// @Failure 404 {object} controller.Response "猪批次或猪栏不存在" -// @Failure 409 {object} controller.Response "业务逻辑冲突 (如猪栏已被使用)" -// @Failure 500 {object} controller.Response "内部服务器错误" // @Router /api/v1/pig-batches/{id}/pens [put] func (c *PigBatchController) UpdatePigBatchPens(ctx *gin.Context) { const action = "更新猪批次关联猪栏"