From b90a31431164b4b0756e4ef76f08b08953b8b04d Mon Sep 17 00:00:00 2001
From: zhangqian <zhangqian@123.com>
Date: 星期五, 13 十月 2023 14:56:23 +0800
Subject: [PATCH] 服务合同简单数据权限

---
 model/serviceContract.go |   17 ++++++++++++++---
 1 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/model/serviceContract.go b/model/serviceContract.go
index d4b8744..87f2744 100644
--- a/model/serviceContract.go
+++ b/model/serviceContract.go
@@ -36,11 +36,11 @@
 		ServiceTimes            int                   `json:"serviceTimes" gorm:"column:service_times;type:int;comment:鏈嶅姟娆℃暟"`
 		Terms                   string                `json:"terms" gorm:"column:terms;type:text;comment:鏉℃"`
 		Remark                  string                `json:"remark" gorm:"column:remark;type:text;comment:澶囨敞"`
-		AmountReceivable        decimal.Decimal       `gorm:"column:amount_receivable;type:decimal(12,2);comment:搴旀敹閲戦" json:"amountReceivable"`    // 搴旀敹閲戦
-		AmountReceived          decimal.Decimal       `gorm:"column:amount_received;type:decimal(12,2);comment:宸叉敹閲戦" json:"amountReceived"`        // 宸叉敹閲戦
+		AmountReceivable        decimal.Decimal       `gorm:"column:amount_receivable;type:decimal(12,2);comment:搴旀敹閲戦" json:"amountReceivable"`     // 搴旀敹閲戦
+		AmountReceived          decimal.Decimal       `gorm:"column:amount_received;type:decimal(12,2);comment:宸叉敹閲戦" json:"amountReceived"`         // 宸叉敹閲戦
 		AmountInvoiced          decimal.Decimal       `gorm:"column:amount_invoiced;type:decimal(12,2);comment:宸插紑绁ㄩ噾棰�" json:"amountInvoiced"`       // 宸插紑绁ㄩ噾棰�
 		AmountUnInvoiced        decimal.Decimal       `gorm:"column:amount_not_invoiced;type:decimal(12,2);comment:鏈紑绁ㄩ噾棰�" json:"amountUnInvoiced"` // 鏈紑绁ㄩ噾棰�
-		AmountTotal             decimal.Decimal       `gorm:"column:amount_total;type:decimal(12,2);comment:浠风◣鍚堣" json:"amountTotal"`              // 浠风◣鍚堣
+		AmountTotal             decimal.Decimal       `gorm:"column:amount_total;type:decimal(12,2);comment:浠风◣鍚堣" json:"amountTotal"`               // 浠风◣鍚堣
 		Products                []*Product            `json:"products" gorm:"many2many:service_contract_product;"`
 		CrmModel
 	}
@@ -55,6 +55,7 @@
 		PageNum     int
 		PageSize    int
 		Preload     bool
+		MemberIds   []int
 	}
 )
 
@@ -108,6 +109,11 @@
 		db = db.Where("amount_receivable = ?", slf.Keyword)
 
 	}
+
+	if len(slf.MemberIds) > 0 {
+		db = db.Where("member_id in ?", slf.MemberIds)
+	}
+
 	if slf.Preload {
 		db = db.
 			Preload("Client").
@@ -198,6 +204,11 @@
 	return slf
 }
 
+func (slf *ServiceContractSearch) SetMemberIds(memberIds []int) *ServiceContractSearch {
+	slf.MemberIds = memberIds
+	return slf
+}
+
 func (slf *ServiceContractSearch) SetPreload(preload bool) *ServiceContractSearch {
 	slf.Preload = preload
 	return slf

--
Gitblit v1.8.0