From cdbda5e3895814b688bcc0e6b34b6067b0b9b773 Mon Sep 17 00:00:00 2001
From: zhangqian <zhangqian@123.com>
Date: 星期四, 21 九月 2023 20:17:08 +0800
Subject: [PATCH] fix

---
 model/procedures.go |   22 ++++++++++++++++++++++
 1 files changed, 22 insertions(+), 0 deletions(-)

diff --git a/model/procedures.go b/model/procedures.go
index 6a4762e..8933c88 100644
--- a/model/procedures.go
+++ b/model/procedures.go
@@ -17,6 +17,7 @@
 		OrderID        string `gorm:"index;type:varchar(191);not null;comment:璁㈠崟ID" json:"-"`
 		DeviceID       string `gorm:"index;type:varchar(191);comment:璁惧ID" json:"deviceId"`
 		ProcedureID    string `gorm:"index;type:varchar(191);comment:宸ュ簭ID" json:"procedureId"`
+		Position       int    `gorm:"type:int;comment:宸ヤ綔浣嶇疆" json:"position"` //姣忎釜璁惧鍙兘鏈夊涓満浣嶅悓鏃剁敓浜э紝鐢╬osition琛ㄧず浣嶇疆
 		StartTime      int64  `gorm:"comment:璁″垝寮�濮嬫椂闂�" json:"startTime"`
 		EndTime        int64  `gorm:"comment:璁″垝缁撴潫鏃堕棿" json:"endTime"`
 		Status         ProcedureStatus
@@ -32,6 +33,7 @@
 		Orm          *gorm.DB
 		Preload      bool
 		StartTimeMax int64
+		EndTimeMin   int64
 		StatusNot    ProcedureStatus
 		ProcedureIds []string
 	}
@@ -96,6 +98,11 @@
 	return slf
 }
 
+func (slf *ProceduresSearch) SetEndTimeMin(ts int64) *ProceduresSearch {
+	slf.EndTimeMin = ts
+	return slf
+}
+
 func (slf *ProceduresSearch) SetId(id int) *ProceduresSearch {
 	slf.ID = id
 	return slf
@@ -151,6 +158,10 @@
 
 	if slf.StartTimeMax != 0 {
 		db = db.Where("start_time <= ?", slf.StartTimeMax)
+	}
+
+	if slf.EndTimeMin != 0 {
+		db = db.Where("end_time > ?", slf.EndTimeMin)
 	}
 
 	if slf.Status != 0 {
@@ -271,6 +282,17 @@
 	return records, total, nil
 }
 
+func (slf *ProceduresSearch) Count() (int64, error) {
+	var (
+		total int64
+		db    = slf.build()
+	)
+	if err := db.Count(&total).Error; err != nil {
+		return total, fmt.Errorf("find count err: %v", err)
+	}
+	return total, nil
+}
+
 func (slf *ProceduresSearch) FindNotTotal() ([]*Procedures, error) {
 	var (
 		records = make([]*Procedures, 0)

--
Gitblit v1.8.0