调整swag

This commit is contained in:
2025-10-13 14:15:38 +08:00
parent 8c0dc6c815
commit bcec36f7e2
13 changed files with 760 additions and 7 deletions

View File

@@ -28,6 +28,7 @@ func NewPigBatchController(logger *logs.Logger, service service.PigBatchService)
// @Summary 创建猪批次
// @Description 创建一个新的猪批次
// @Tags 猪群管理
// @Security BearerAuth
// @Accept json
// @Produce json
// @Param body body dto.PigBatchCreateDTO true "猪批次信息"
@@ -52,6 +53,7 @@ func (c *PigBatchController) CreatePigBatch(ctx *gin.Context) {
// @Summary 获取单个猪批次
// @Description 根据ID获取单个猪批次信息
// @Tags 猪群管理
// @Security BearerAuth
// @Produce json
// @Param id path int true "猪批次ID"
// @Success 200 {object} controller.Response{data=dto.PigBatchResponseDTO} "获取成功"
@@ -73,6 +75,7 @@ func (c *PigBatchController) GetPigBatch(ctx *gin.Context) {
// @Summary 更新猪批次
// @Description 更新一个已存在的猪批次信息
// @Tags 猪群管理
// @Security BearerAuth
// @Accept json
// @Produce json
// @Param id path int true "猪批次ID"
@@ -97,6 +100,7 @@ func (c *PigBatchController) UpdatePigBatch(ctx *gin.Context) {
// @Summary 删除猪批次
// @Description 根据ID删除一个猪批次
// @Tags 猪群管理
// @Security BearerAuth
// @Produce json
// @Param id path int true "猪批次ID"
// @Success 200 {object} controller.Response "删除成功"
@@ -118,6 +122,7 @@ func (c *PigBatchController) DeletePigBatch(ctx *gin.Context) {
// @Summary 获取猪批次列表
// @Description 获取所有猪批次的列表,支持按活跃状态筛选
// @Tags 猪群管理
// @Security BearerAuth
// @Produce json
// @Param is_active query bool false "是否活跃 (true/false)"
// @Success 200 {object} controller.Response{data=[]dto.PigBatchResponseDTO} "获取成功"
@@ -139,6 +144,7 @@ func (c *PigBatchController) ListPigBatches(ctx *gin.Context) {
// @Summary 为猪批次分配空栏
// @Description 将一个或多个空闲猪栏分配给指定的猪批次
// @Tags 猪群管理
// @Security BearerAuth
// @Accept json
// @Produce json
// @Param id path int true "猪批次ID"
@@ -163,6 +169,7 @@ func (c *PigBatchController) AssignEmptyPensToBatch(ctx *gin.Context) {
// @Summary 将猪栏划拨到新批次
// @Description 将一个猪栏(连同其中的猪只)从一个批次整体划拨到另一个批次
// @Tags 猪群管理
// @Security BearerAuth
// @Accept json
// @Produce json
// @Param fromBatchID path int true "源猪批次ID"
@@ -195,6 +202,7 @@ func (c *PigBatchController) ReclassifyPenToNewBatch(ctx *gin.Context) {
// @Summary 从猪批次移除空栏
// @Description 将一个空闲猪栏从指定的猪批次中移除
// @Tags 猪群管理
// @Security BearerAuth
// @Produce json
// @Param batchID path int true "猪批次ID"
// @Param penID path int true "待移除的猪栏ID"
@@ -230,6 +238,7 @@ func (c *PigBatchController) RemoveEmptyPenFromBatch(ctx *gin.Context) {
// @Summary 将猪只从“虚拟库存”移入指定猪栏
// @Description 将指定数量的猪只从批次的“虚拟库存”移入一个已分配的猪栏
// @Tags 猪群管理
// @Security BearerAuth
// @Accept json
// @Produce json
// @Param id path int true "猪批次ID"

View File

@@ -9,6 +9,7 @@ import (
// @Summary 记录新增病猪事件
// @Description 记录猪批次中新增病猪的数量、治疗地点和发生时间
// @Tags 猪群管理
// @Security BearerAuth
// @Accept json
// @Produce json
// @Param id path int true "猪批次ID"
@@ -33,6 +34,7 @@ func (c *PigBatchController) RecordSickPigs(ctx *gin.Context) {
// @Summary 记录病猪康复事件
// @Description 记录猪批次中病猪康复的数量、治疗地点和发生时间
// @Tags 猪群管理
// @Security BearerAuth
// @Accept json
// @Produce json
// @Param id path int true "猪批次ID"
@@ -57,6 +59,7 @@ func (c *PigBatchController) RecordSickPigRecovery(ctx *gin.Context) {
// @Summary 记录病猪死亡事件
// @Description 记录猪批次中病猪死亡的数量、治疗地点和发生时间
// @Tags 猪群管理
// @Security BearerAuth
// @Accept json
// @Produce json
// @Param id path int true "猪批次ID"
@@ -81,6 +84,7 @@ func (c *PigBatchController) RecordSickPigDeath(ctx *gin.Context) {
// @Summary 记录病猪淘汰事件
// @Description 记录猪批次中病猪淘汰的数量、治疗地点和发生时间
// @Tags 猪群管理
// @Security BearerAuth
// @Accept json
// @Produce json
// @Param id path int true "猪批次ID"
@@ -105,6 +109,7 @@ func (c *PigBatchController) RecordSickPigCull(ctx *gin.Context) {
// @Summary 记录正常猪只死亡事件
// @Description 记录猪批次中正常猪只死亡的数量和发生时间
// @Tags 猪群管理
// @Security BearerAuth
// @Accept json
// @Produce json
// @Param id path int true "猪批次ID"
@@ -129,6 +134,7 @@ func (c *PigBatchController) RecordDeath(ctx *gin.Context) {
// @Summary 记录正常猪只淘汰事件
// @Description 记录猪批次中正常猪只淘汰的数量和发生时间
// @Tags 猪群管理
// @Security BearerAuth
// @Accept json
// @Produce json
// @Param id path int true "猪批次ID"

View File

@@ -9,6 +9,7 @@ import (
// @Summary 处理卖猪的业务逻辑
// @Description 记录猪批次中的猪只出售事件
// @Tags 猪群管理
// @Security BearerAuth
// @Accept json
// @Produce json
// @Param id path int true "猪批次ID"
@@ -33,6 +34,7 @@ func (c *PigBatchController) SellPigs(ctx *gin.Context) {
// @Summary 处理买猪的业务逻辑
// @Description 记录猪批次中的猪只购买事件
// @Tags 猪群管理
// @Security BearerAuth
// @Accept json
// @Produce json
// @Param id path int true "猪批次ID"

View File

@@ -11,6 +11,7 @@ import (
// @Summary 跨猪群调栏
// @Description 将指定数量的猪只从一个猪群的猪栏调动到另一个猪群的猪栏
// @Tags 猪群管理
// @Security BearerAuth
// @Accept json
// @Produce json
// @Param sourceBatchID path int true "源猪批次ID"
@@ -43,6 +44,7 @@ func (c *PigBatchController) TransferPigsAcrossBatches(ctx *gin.Context) {
// @Summary 群内调栏
// @Description 将指定数量的猪只在同一个猪群的不同猪栏间调动
// @Tags 猪群管理
// @Security BearerAuth
// @Accept json
// @Produce json
// @Param id path int true "猪批次ID"

View File

@@ -33,6 +33,7 @@ func NewPigFarmController(logger *logs.Logger, service service.PigFarmService) *
// @Summary 创建猪舍
// @Description 创建一个新的猪舍
// @Tags 猪场管理
// @Security BearerAuth
// @Accept json
// @Produce json
// @Param body body dto.CreatePigHouseRequest true "猪舍信息"
@@ -65,6 +66,7 @@ func (c *PigFarmController) CreatePigHouse(ctx *gin.Context) {
// @Summary 获取单个猪舍
// @Description 根据ID获取单个猪舍信息
// @Tags 猪场管理
// @Security BearerAuth
// @Produce json
// @Param id path int true "猪舍ID"
// @Success 200 {object} controller.Response{data=dto.PigHouseResponse} "获取成功"
@@ -100,6 +102,7 @@ func (c *PigFarmController) GetPigHouse(ctx *gin.Context) {
// @Summary 获取猪舍列表
// @Description 获取所有猪舍的列表
// @Tags 猪场管理
// @Security BearerAuth
// @Produce json
// @Success 200 {object} controller.Response{data=[]dto.PigHouseResponse} "获取成功"
// @Router /api/v1/pig-houses [get]
@@ -128,6 +131,7 @@ func (c *PigFarmController) ListPigHouses(ctx *gin.Context) {
// @Summary 更新猪舍
// @Description 更新一个已存在的猪舍信息
// @Tags 猪场管理
// @Security BearerAuth
// @Accept json
// @Produce json
// @Param id path int true "猪舍ID"
@@ -171,6 +175,7 @@ func (c *PigFarmController) UpdatePigHouse(ctx *gin.Context) {
// @Summary 删除猪舍
// @Description 根据ID删除一个猪舍
// @Tags 猪场管理
// @Security BearerAuth
// @Produce json
// @Param id path int true "猪舍ID"
// @Success 200 {object} controller.Response "删除成功"
@@ -207,6 +212,7 @@ func (c *PigFarmController) DeletePigHouse(ctx *gin.Context) {
// @Summary 创建猪栏
// @Description 创建一个新的猪栏
// @Tags 猪场管理
// @Security BearerAuth
// @Accept json
// @Produce json
// @Param body body dto.CreatePenRequest true "猪栏信息"
@@ -247,6 +253,7 @@ func (c *PigFarmController) CreatePen(ctx *gin.Context) {
// @Summary 获取单个猪栏
// @Description 根据ID获取单个猪栏信息
// @Tags 猪场管理
// @Security BearerAuth
// @Produce json
// @Param id path int true "猪栏ID"
// @Success 200 {object} controller.Response{data=dto.PenResponse} "获取成功"
@@ -285,6 +292,7 @@ func (c *PigFarmController) GetPen(ctx *gin.Context) {
// @Summary 获取猪栏列表
// @Description 获取所有猪栏的列表
// @Tags 猪场管理
// @Security BearerAuth
// @Produce json
// @Success 200 {object} controller.Response{data=[]dto.PenResponse} "获取成功"
// @Router /api/v1/pens [get]
@@ -316,6 +324,7 @@ func (c *PigFarmController) ListPens(ctx *gin.Context) {
// @Summary 更新猪栏
// @Description 更新一个已存在的猪栏信息
// @Tags 猪场管理
// @Security BearerAuth
// @Accept json
// @Produce json
// @Param id path int true "猪栏ID"
@@ -363,6 +372,7 @@ func (c *PigFarmController) UpdatePen(ctx *gin.Context) {
// @Summary 删除猪栏
// @Description 根据ID删除一个猪栏
// @Tags 猪场管理
// @Security BearerAuth
// @Produce json
// @Param id path int true "猪栏ID"
// @Success 200 {object} controller.Response "删除成功"
@@ -397,6 +407,7 @@ func (c *PigFarmController) DeletePen(ctx *gin.Context) {
// @Summary 更新猪栏状态
// @Description 更新指定猪栏的当前状态
// @Tags 猪场管理
// @Security BearerAuth
// @Accept json
// @Produce json
// @Param id path int true "猪栏ID"