From 2dc22e8068ac5616a3581d4a261725d4ac02cf2b Mon Sep 17 00:00:00 2001
From: zhangqian <zhangqian@123.com>
Date: 星期五, 22 三月 2024 17:18:20 +0800
Subject: [PATCH] 产品列表增加型号字段,发货历史倒序
---
models/outsourcing_order_product.go | 1 +
models/outsourcing_order_delivery_details.go | 10 ++++++++++
controllers/order.go | 6 +++++-
docs/swagger.yaml | 2 ++
docs/docs.go | 3 +++
docs/swagger.json | 3 +++
6 files changed, 24 insertions(+), 1 deletions(-)
diff --git a/controllers/order.go b/controllers/order.go
index d575584..7666d09 100644
--- a/controllers/order.go
+++ b/controllers/order.go
@@ -282,7 +282,11 @@
util.ResponseFormat(c, code.RequestParamError, "鍙傛暟瑙f瀽澶辫触锛屾暟鎹被鍨嬮敊璇�")
return
}
- list, err := models.NewOutsourcingOrderDeliveryDetailsSearch().SetOutsourcingOrderID(params.OutsourcingOrderID).SetPreload(true).FindNotTotal()
+ list, err := models.NewOutsourcingOrderDeliveryDetailsSearch().
+ SetOutsourcingOrderID(params.OutsourcingOrderID).
+ SetPreload(true).
+ SetOrder("id desc").
+ FindNotTotal()
if err != nil {
util.ResponseFormat(c, code.RequestParamError, "鏌ヨ澶辫触")
return
diff --git a/docs/docs.go b/docs/docs.go
index 065f80e..6514254 100644
--- a/docs/docs.go
+++ b/docs/docs.go
@@ -453,6 +453,9 @@
"specs": {
"type": "string"
},
+ "type": {
+ "type": "string"
+ },
"unit": {
"type": "string"
}
diff --git a/docs/swagger.json b/docs/swagger.json
index 5193e77..92367ad 100644
--- a/docs/swagger.json
+++ b/docs/swagger.json
@@ -441,6 +441,9 @@
"specs": {
"type": "string"
},
+ "type": {
+ "type": "string"
+ },
"unit": {
"type": "string"
}
diff --git a/docs/swagger.yaml b/docs/swagger.yaml
index e6bf993..5b11f0f 100644
--- a/docs/swagger.yaml
+++ b/docs/swagger.yaml
@@ -83,6 +83,8 @@
type: number
specs:
type: string
+ type:
+ type: string
unit:
type: string
type: object
diff --git a/models/outsourcing_order_delivery_details.go b/models/outsourcing_order_delivery_details.go
index 969bca7..7a85074 100644
--- a/models/outsourcing_order_delivery_details.go
+++ b/models/outsourcing_order_delivery_details.go
@@ -22,6 +22,7 @@
PageNum int
PageSize int
Orm *gorm.DB
+ Order string
Preload bool
}
)
@@ -36,6 +37,11 @@
func (slf *OutsourcingOrderDeliveryDetailsSearch) SetOrm(tx *gorm.DB) *OutsourcingOrderDeliveryDetailsSearch {
slf.Orm = tx
+ return slf
+}
+
+func (slf *OutsourcingOrderDeliveryDetailsSearch) SetOrder(order string) *OutsourcingOrderDeliveryDetailsSearch {
+ slf.Order = order
return slf
}
@@ -70,6 +76,10 @@
db = db.Where("outsourcing_order_id = ?", slf.OutsourcingOrderID)
}
+ if slf.Order != "" {
+ db = db.Order(slf.Order)
+ }
+
if slf.Preload {
db = db.Preload("OutsourcingOrderDelivery").Preload("OutsourcingOrderProduct")
}
diff --git a/models/outsourcing_order_product.go b/models/outsourcing_order_product.go
index 36e172b..3ff57e6 100644
--- a/models/outsourcing_order_product.go
+++ b/models/outsourcing_order_product.go
@@ -16,6 +16,7 @@
ProductId string `gorm:"type:varchar(191);comment:浜у搧id" json:"productId"`
ProductName string `gorm:"type:varchar(191);comment:浜у搧鍚嶇О" json:"productName"`
Specs string `gorm:"type:varchar(191);comment:鐗╂枡瑙勬牸" json:"specs"`
+ Type string `gorm:"type:varchar(191);comment:鐗╂枡鍨嬪彿" json:"type"`
Amount int64 `gorm:"type:int(11);comment:璁㈠崟鏁伴噺" json:"amount"`
Unit string `gorm:"type:varchar(100);comment:鍗曚綅" json:"unit"`
BomID string `gorm:"type:varchar(255);default '';comment:bomID" json:"bomID"`
--
Gitblit v1.8.0