| | |
| | | } |
| | | records[k].BaseOperationType = constvar.BaseOperationTypeAdjust |
| | | } |
| | | |
| | | productIds = make([]string, 0) |
| | | for _, record := range records { |
| | | productIds = append(productIds, record.ProductId) |
| | | } |
| | | |
| | | products, err := models.NewMaterialSearch().SetIDs(productIds).FindNotTotal() |
| | | if err != nil { |
| | | util.ResponseFormat(c, code.RequestError, "查询产品失败") |
| | | return |
| | | } |
| | | |
| | | productMap := models.MaterialMap(products) |
| | | |
| | | for k, v := range records { |
| | | product := productMap[v.ProductId] |
| | | if product == nil { |
| | | continue |
| | | } |
| | | |
| | | moreUnit := product.MoreUnit |
| | | if moreUnit != nil && *moreUnit { |
| | | records[k].AmountMoreUnits = service.CreateMoreUnit(v.Amount, product.MoreUnitList) |
| | | } |
| | | } |
| | | |
| | | util.ResponseFormatListWithPage(c, code.Success, records, int(total), params.Page, params.PageSize) |
| | | } |
| | | |