| | |
| | | } |
| | | util.ResponseFormat(c, code.Success, "删除成功") |
| | | } |
| | | |
| | | // ListOperation |
| | | // @Tags 产品 |
| | | // @Summary 产品历史出入库信息 |
| | | // @Produce application/json |
| | | // @Param object body request.QueryOperationList true "查询参数" |
| | | // @Success 200 {object} util.ResponseList{data=[]models.Operation} "成功" |
| | | // @Router /api-wms/v1/product/listOperaton [post] |
| | | func (slf ProductController) ListOperation(c *gin.Context) { |
| | | var params request.QueryOperationList |
| | | if err := c.BindJSON(¶ms); err != nil { |
| | | util.ResponseFormat(c, code.RequestParamError, "参数解析失败,数据类型错误:"+err.Error()) |
| | | return |
| | | } |
| | | if !params.PageInfo.Check() { |
| | | util.ResponseFormat(c, code.RequestParamError, "页码信息错误") |
| | | return |
| | | } |
| | | |
| | | search := models.NewOperationSearch().SetPage(params.Page, params.PageSize).SetPreload(true).SetOrder("created_at desc") |
| | | search.SetOrm(search.Orm.InnerJoins("inner join wms_operation_details on wms_operation_details.operation_id=wms_operation.id").Where("wms_operation_details.product_id=?", params.ProductId)) |
| | | |
| | | list, total, err := search.Find() |
| | | if err != nil { |
| | | util.ResponseFormat(c, code.RequestError, "查找失败:"+err.Error()) |
| | | return |
| | | } |
| | | |
| | | util.ResponseFormatListWithPage(c, code.Success, list, int(total), params.Page, params.PageSize) |
| | | } |