From b68f799ee5562864642cf925ab58391cd5544825 Mon Sep 17 00:00:00 2001
From: yinbentan <yinbentan@live.com>
Date: 星期六, 06 七月 2024 17:41:59 +0800
Subject: [PATCH] 出入库明细筛选添加仓库关联,防止脏数据污染
---
controllers/location_product_amount.go | 18 ++++++++++++++++--
1 files changed, 16 insertions(+), 2 deletions(-)
diff --git a/controllers/location_product_amount.go b/controllers/location_product_amount.go
index 7754e46..abd668c 100644
--- a/controllers/location_product_amount.go
+++ b/controllers/location_product_amount.go
@@ -4,6 +4,7 @@
"errors"
"fmt"
"github.com/gin-gonic/gin"
+ "github.com/mitchellh/mapstructure"
"github.com/shopspring/decimal"
"gorm.io/gorm"
"strconv"
@@ -149,7 +150,7 @@
// @Produce application/json
// @Param object body request.GetLocationProductList true "鏌ヨ鍙傛暟"
// @Param Authorization header string true "token"
-// @Success 200 {object} util.Response "鎴愬姛"
+// @Success 200 {object} util.ResponseList(data=[]*response.LocationProductAmount) "鎴愬姛"
// @Router /api-wms/v1/locationProductAmount/locationProductList [post]
func (slf LocationProductAmountController) LocationProductList(c *gin.Context) {
var params request.GetLocationProductList
@@ -186,7 +187,20 @@
return
}
- util.ResponseFormatList(c, code.Success, records, int(total))
+ dataList := make([]*response.LocationProductAmount, 0, len(records))
+
+ for _, v := range records {
+ data := new(response.LocationProductAmount)
+ mapstructure.Decode(v.Product, &data)
+ data.ID = v.ProductId
+ data.LocationId = v.LocationId
+ data.Location = v.Location
+ data.Amount = v.Amount
+ data.ProductId = v.ProductId
+ dataList = append(dataList, data)
+ }
+
+ util.ResponseFormatList(c, code.Success, dataList, int(total))
}
// Add
--
Gitblit v1.8.0