修复报错
This commit is contained in:
@@ -42,7 +42,7 @@ func (c *PigBatchController) CreatePigBatch(ctx echo.Context) error {
|
||||
var req dto.PigBatchCreateDTO
|
||||
|
||||
return handleAPIRequestWithResponse(
|
||||
c, ctx, action, &req,
|
||||
reqCtx, c, ctx, action, &req,
|
||||
func(ctx echo.Context, operatorID uint, primaryID uint, req *dto.PigBatchCreateDTO) (*dto.PigBatchResponseDTO, error) {
|
||||
// 对于创建操作,primaryID通常不从路径中获取,而是由服务层生成
|
||||
return c.service.CreatePigBatch(reqCtx, operatorID, req)
|
||||
@@ -67,7 +67,7 @@ func (c *PigBatchController) GetPigBatch(ctx echo.Context) error {
|
||||
const action = "获取猪批次"
|
||||
|
||||
return handleNoBodyAPIRequestWithResponse(
|
||||
c, ctx, action,
|
||||
reqCtx, c, ctx, action,
|
||||
func(ctx echo.Context, operatorID uint, primaryID uint) (*dto.PigBatchResponseDTO, error) {
|
||||
return c.service.GetPigBatch(reqCtx, primaryID)
|
||||
},
|
||||
@@ -94,7 +94,7 @@ func (c *PigBatchController) UpdatePigBatch(ctx echo.Context) error {
|
||||
var req dto.PigBatchUpdateDTO
|
||||
|
||||
return handleAPIRequestWithResponse(
|
||||
c, ctx, action, &req,
|
||||
reqCtx, c, ctx, action, &req,
|
||||
func(ctx echo.Context, operatorID uint, primaryID uint, req *dto.PigBatchUpdateDTO) (*dto.PigBatchResponseDTO, error) {
|
||||
return c.service.UpdatePigBatch(reqCtx, primaryID, req)
|
||||
},
|
||||
@@ -118,7 +118,7 @@ func (c *PigBatchController) DeletePigBatch(ctx echo.Context) error {
|
||||
const action = "删除猪批次"
|
||||
|
||||
return handleNoBodyAPIRequest(
|
||||
c, ctx, action,
|
||||
reqCtx, c, ctx, action,
|
||||
func(ctx echo.Context, operatorID uint, primaryID uint) error {
|
||||
return c.service.DeletePigBatch(reqCtx, primaryID)
|
||||
},
|
||||
@@ -143,7 +143,7 @@ func (c *PigBatchController) ListPigBatches(ctx echo.Context) error {
|
||||
var query dto.PigBatchQueryDTO
|
||||
|
||||
return handleQueryAPIRequestWithResponse(
|
||||
c, ctx, action, &query,
|
||||
reqCtx, c, ctx, action, &query,
|
||||
func(ctx echo.Context, operatorID uint, query *dto.PigBatchQueryDTO) ([]*dto.PigBatchResponseDTO, error) {
|
||||
return c.service.ListPigBatches(reqCtx, query.IsActive)
|
||||
},
|
||||
@@ -169,7 +169,7 @@ func (c *PigBatchController) AssignEmptyPensToBatch(ctx echo.Context) error {
|
||||
var req dto.AssignEmptyPensToBatchRequest
|
||||
|
||||
return handleAPIRequest(
|
||||
c, ctx, action, &req,
|
||||
reqCtx, c, ctx, action, &req,
|
||||
func(ctx echo.Context, operatorID uint, primaryID uint, req *dto.AssignEmptyPensToBatchRequest) error {
|
||||
return c.service.AssignEmptyPensToBatch(reqCtx, primaryID, req.PenIDs, operatorID)
|
||||
},
|
||||
@@ -196,7 +196,7 @@ func (c *PigBatchController) ReclassifyPenToNewBatch(ctx echo.Context) error {
|
||||
var req dto.ReclassifyPenToNewBatchRequest
|
||||
|
||||
return handleAPIRequest(
|
||||
c, ctx, action, &req,
|
||||
reqCtx, c, ctx, action, &req,
|
||||
func(ctx echo.Context, operatorID uint, primaryID uint, req *dto.ReclassifyPenToNewBatchRequest) error {
|
||||
// primaryID 在这里是 fromBatchID
|
||||
return c.service.ReclassifyPenToNewBatch(reqCtx, primaryID, req.ToBatchID, req.PenID, operatorID, req.Remarks)
|
||||
@@ -229,7 +229,7 @@ func (c *PigBatchController) RemoveEmptyPenFromBatch(ctx echo.Context) error {
|
||||
const action = "从猪批次移除空栏"
|
||||
|
||||
return handleNoBodyAPIRequest(
|
||||
c, ctx, action,
|
||||
reqCtx, c, ctx, action,
|
||||
func(ctx echo.Context, operatorID uint, primaryID uint) error {
|
||||
// primaryID 在这里是 batchID
|
||||
penIDParam := ctx.Param("penID")
|
||||
@@ -269,7 +269,7 @@ func (c *PigBatchController) MovePigsIntoPen(ctx echo.Context) error {
|
||||
var req dto.MovePigsIntoPenRequest
|
||||
|
||||
return handleAPIRequest(
|
||||
c, ctx, action, &req,
|
||||
reqCtx, c, ctx, action, &req,
|
||||
func(ctx echo.Context, operatorID uint, primaryID uint, req *dto.MovePigsIntoPenRequest) error {
|
||||
return c.service.MovePigsIntoPen(reqCtx, primaryID, req.ToPenID, req.Quantity, operatorID, req.Remarks)
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user