From d4bf53dd19a45ef09a367babcf7a2ac04ae1d08f Mon Sep 17 00:00:00 2001
From: liujiandao <274878379@qq.com>
Date: 星期二, 17 十月 2023 14:31:31 +0800
Subject: [PATCH] bug修改

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

diff --git a/model/salesRefund.go b/model/salesRefund.go
index 02582a0..380aa9a 100644
--- a/model/salesRefund.go
+++ b/model/salesRefund.go
@@ -17,6 +17,7 @@
 		Number        string                    `json:"number" gorm:"column:number;type:varchar(255);comment:閫�娆惧崟鍙�"`
 		SourceType    constvar.RefundSourceType `gorm:"column:source_type;type:int;not null;default 0;comment:鏉ユ簮绫诲瀷锛�1閿�鍞��璐э級" json:"sourceType"` // 鏉ユ簮绫诲瀷锛�1閿�鍞��璐э級
 		SourceId      int                       `gorm:"column:source_id;type:int;not null;default 0;comment:婧愬崟id " json:"sourceId"`           // 婧愬崟id
+		Source        SalesReturn               `gorm:"foreignKey:SourceId" json:"Source"`
 		MemberId      int                       `json:"memberId" gorm:"column:member_id;type:int;comment:璐熻矗浜篿d"`
 		Member        User                      `json:"member" gorm:"foreignKey:MemberId"`
 		RefundDate    string                    `json:"refundDate" gorm:"column:refund_date;type:varchar(255);comment:閫�娆炬棩鏈�"`
@@ -28,6 +29,7 @@
 		Reason        string                    `json:"reason" gorm:"column:reason;type:varchar(255);comment:閫�娆惧師鍥�"`
 		Products      []*Product                `json:"products" gorm:"many2many:salesRefund_product;"`
 		AmountTotal   decimal.Decimal           `gorm:"column:amount_total;type:decimal(12,2);comment:浠风◣鍚堣" json:"amountTotal"` // 浠风◣鍚堣
+		CodeStandID   string                    `json:"codeStandID" gorm:"column:code_stand_id;type:varchar(255);comment:缂栫爜id"`
 		CrmModel
 	}
 
@@ -41,6 +43,7 @@
 		PageSize    int
 		Preload     bool
 		Ids         []int
+		MemberIds   []int
 	}
 )
 
@@ -81,6 +84,7 @@
 		db = db.Preload("Client").
 			Preload("PaymentType").
 			Preload("BankAccount").
+			Preload("Source").
 			Preload("Products")
 	}
 	if slf.KeywordType != "" {
@@ -105,6 +109,10 @@
 			db = db.Where("amount_total like ?", fmt.Sprintf("%%%s%%", slf.Keyword))
 
 		}
+	}
+
+	if len(slf.MemberIds) > 0 {
+		db = db.Where("sales_refund.member_id in ?", slf.MemberIds)
 	}
 
 	return db
@@ -203,3 +211,13 @@
 	slf.OrderBy = order
 	return slf
 }
+
+func (slf *SalesRefundSearch) UpdateByMap(data map[string]interface{}) error {
+	var db = slf.build()
+	return db.Updates(data).Error
+}
+
+func (slf *SalesRefundSearch) SetMemberIds(memberIds []int) *SalesRefundSearch {
+	slf.MemberIds = memberIds
+	return slf
+}

--
Gitblit v1.8.0