猪栏信息接口增加猪栏当前存栏量
This commit is contained in:
@@ -276,17 +276,7 @@ func (c *PigFarmController) GetPen(ctx *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
resp := dto.PenResponse{
|
||||
ID: pen.ID,
|
||||
PenNumber: pen.PenNumber,
|
||||
HouseID: pen.HouseID,
|
||||
Capacity: pen.Capacity,
|
||||
Status: pen.Status,
|
||||
}
|
||||
if pen.PigBatchID != nil {
|
||||
resp.PigBatchID = *pen.PigBatchID
|
||||
}
|
||||
controller.SendSuccessWithAudit(ctx, controller.CodeSuccess, "获取成功", resp, action, "获取成功", resp)
|
||||
controller.SendSuccessWithAudit(ctx, controller.CodeSuccess, "获取成功", pen, action, "获取成功", pen)
|
||||
}
|
||||
|
||||
// ListPens godoc
|
||||
@@ -306,22 +296,7 @@ func (c *PigFarmController) ListPens(ctx *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
var resp []dto.PenResponse
|
||||
for _, pen := range pens {
|
||||
res := dto.PenResponse{
|
||||
ID: pen.ID,
|
||||
PenNumber: pen.PenNumber,
|
||||
HouseID: pen.HouseID,
|
||||
Capacity: pen.Capacity,
|
||||
Status: pen.Status,
|
||||
}
|
||||
if pen.PigBatchID != nil {
|
||||
res.PigBatchID = *pen.PigBatchID
|
||||
}
|
||||
resp = append(resp, res)
|
||||
}
|
||||
|
||||
controller.SendSuccessWithAudit(ctx, controller.CodeSuccess, "获取成功", resp, action, "获取成功", resp)
|
||||
controller.SendSuccessWithAudit(ctx, controller.CodeSuccess, "获取成功", pens, action, "获取成功", pens)
|
||||
}
|
||||
|
||||
// UpdatePen godoc
|
||||
@@ -362,14 +337,12 @@ func (c *PigFarmController) UpdatePen(ctx *gin.Context) {
|
||||
}
|
||||
|
||||
resp := dto.PenResponse{
|
||||
ID: pen.ID,
|
||||
PenNumber: pen.PenNumber,
|
||||
HouseID: pen.HouseID,
|
||||
Capacity: pen.Capacity,
|
||||
Status: pen.Status,
|
||||
}
|
||||
if pen.PigBatchID != nil {
|
||||
resp.PigBatchID = *pen.PigBatchID
|
||||
ID: pen.ID,
|
||||
PenNumber: pen.PenNumber,
|
||||
HouseID: pen.HouseID,
|
||||
Capacity: pen.Capacity,
|
||||
Status: pen.Status,
|
||||
PigBatchID: pen.PigBatchID,
|
||||
}
|
||||
controller.SendSuccessWithAudit(ctx, controller.CodeSuccess, "更新成功", resp, action, "更新成功", resp)
|
||||
}
|
||||
@@ -454,7 +427,7 @@ func (c *PigFarmController) UpdatePenStatus(ctx *gin.Context) {
|
||||
HouseID: pen.HouseID,
|
||||
Capacity: pen.Capacity,
|
||||
Status: pen.Status,
|
||||
PigBatchID: *pen.PigBatchID,
|
||||
PigBatchID: pen.PigBatchID,
|
||||
}
|
||||
controller.SendSuccessWithAudit(ctx, controller.CodeSuccess, "更新成功", resp, action, "更新成功", resp)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user