From 53b83f1b5fd89336438dfa6de33541fcd81a290f Mon Sep 17 00:00:00 2001 From: yinbentan <yinbentan@live.com> Date: 星期三, 03 七月 2024 11:27:43 +0800 Subject: [PATCH] 字典添加报废类型与出入库类型对应 --- models/material.go | 9 ++++++++- 1 files changed, 8 insertions(+), 1 deletions(-) diff --git a/models/material.go b/models/material.go index 20896fc..e410f35 100644 --- a/models/material.go +++ b/models/material.go @@ -164,7 +164,14 @@ } } if len(slf.MoreUnitList) != 0 { - str, err := json.Marshal(slf.MoreUnitList) + items := make([]UnitItems, 0) + for k, item := range slf.MoreUnitList { + if item.Unit != "" && !item.Amount.IsZero() { + items = append(items, slf.MoreUnitList[k]) + } + } + + str, err := json.Marshal(items) if err != nil { return err } -- Gitblit v1.8.0