From 2d6875c93b25d0b7336c7fa11e066d213259fe2e Mon Sep 17 00:00:00 2001 From: zhangqian <zhangqian@123.com> Date: 星期四, 25 四月 2024 10:02:01 +0800 Subject: [PATCH] 更改定时任务时区设置 --- model/work_order.go | 39 ++++++++++++++++----------------------- 1 files changed, 16 insertions(+), 23 deletions(-) diff --git a/model/work_order.go b/model/work_order.go index 8dc4507..e28834e 100644 --- a/model/work_order.go +++ b/model/work_order.go @@ -9,19 +9,19 @@ type ( Order struct { - gorm.Model - WorkOrderID string `gorm:"index;type:varchar(191);not null;comment:'宸ュ崟ID'" json:"workOrderId"` - OrderID string `gorm:"index;type:varchar(191);not null;comment:'璁㈠崟ID'" json:"orderId"` - ProductID string `gorm:"type:varchar(191);comment:'浜у搧ID'" json:"productId"` - ProductName string `gorm:"type:varchar(191);comment:'浜у搧鍚嶇О'" json:"productName"` - Parameter string `gorm:"type:varchar(1024);comment:'鍙傛暟闇�姹�'" json:"parameter"` - Customer string `gorm:"type:varchar(191);comment:'瀹㈡埛缂栫爜'" json:"customer"` - DeliverDate string `gorm:"type:varchar(100);comment:'浜よ揣鏃ユ湡'" json:"deliverDate"` + CommonModel + WorkOrderID string `gorm:"index;type:varchar(191);not null" json:"workOrderId"` + OrderID string `gorm:"index;type:varchar(191);not null" json:"orderId"` + ProductID string `gorm:"type:varchar(191)" json:"productId"` + ProductName string `gorm:"type:varchar(191)" json:"productName"` + Parameter string `gorm:"type:varchar(1024)" json:"parameter"` + Customer string `gorm:"type:varchar(191)" json:"customer"` + DeliverDate string `gorm:"type:varchar(100)" json:"deliverDate"` OrderAttr string `json:"orderAttr"` // 璁㈠崟灞炴�ф嫾鎺ョ殑瀛楃涓诧紝鍗宠揣鐗╂弿杩� - Amount decimal.Decimal `gorm:"type:decimal(35,18);comment:'鏁伴噺'" json:"amount"` - Unit string `gorm:"type:varchar(100);comment:'鍗曚綅'" json:"unit"` - StartTime int64 `gorm:"comment:'璁″垝寮�濮嬫椂闂�'" json:"startTime"` - EndTime int64 `gorm:"comment:'璁″垝缁撴潫鏃堕棿'" json:"endTime"` + Amount decimal.Decimal `gorm:"type:decimal(35,18)" json:"amount"` + Unit string `gorm:"type:varchar(100)" json:"unit"` + StartTime int64 `json:"startTime"` + EndTime int64 `json:"endTime"` Status OrderStatus } @@ -127,6 +127,10 @@ db = db.Where("work_order_id = ?", slf.WorkOrderID) } + if len(slf.WorkOrderIDs) != 0 { + db = db.Where("work_order_id in (?)", slf.WorkOrderIDs) + } + if slf.Status != 0 { db = db.Where("status = ?", slf.Status) } @@ -156,17 +160,6 @@ if err := db.Create(record).Error; err != nil { return fmt.Errorf("create err: %v, record: %+v", err, record) - } - - return nil -} - -// CreateBatch 鎵归噺鎻掑叆 -func (slf *OrderSearch) CreateBatch(records []*Order) error { - var db = slf.build() - - if err := db.Create(&records).Error; err != nil { - return fmt.Errorf("create batch err: %v, records: %+v", err, records) } return nil -- Gitblit v1.8.0