| | |
| | | // @Success 200 {object} util.Response "成功" |
| | | // @Router /api-wms/v1/locationProduct/list [post] |
| | | func (slf LocationProductController) List(c *gin.Context) { |
| | | var params request.PageInfo |
| | | var params request.QueryLocationProductConditon |
| | | if err := c.BindJSON(¶ms); err != nil { |
| | | util.ResponseFormat(c, code.RequestParamError, "参数解析失败,数据类型错误:"+err.Error()) |
| | | return |
| | |
| | | |
| | | search := models.NewLocationProductSearch() |
| | | search.SetPage(params.Page, params.PageSize) |
| | | |
| | | if params.ProductId != "" { |
| | | search = search.SetProductId(params.ProductId) |
| | | } |
| | | |
| | | if params.ProductCategoryId != 0 { |
| | | search = search.SetProductCategoryId(params.ProductCategoryId) |
| | | } |
| | | list, total, err := search.SetPreload(true).SetOrder("created_at desc").FindByPage() |
| | | if err != nil { |
| | | util.ResponseFormat(c, code.RequestError, "查找失败:"+err.Error()) |