From b45b8ce8051e2ad9c80aafa42d1a5892f6a36bce Mon Sep 17 00:00:00 2001 From: zhangqian <zhangqian@123.com> Date: 星期二, 17 十月 2023 15:27:44 +0800 Subject: [PATCH] 初始化一些表shuju --- model/serviceContract.go | 42 ++++++++++++++++++++++++++++++++++++++---- 1 files changed, 38 insertions(+), 4 deletions(-) diff --git a/model/serviceContract.go b/model/serviceContract.go index 87f2744..8c8db4e 100644 --- a/model/serviceContract.go +++ b/model/serviceContract.go @@ -36,12 +36,13 @@ 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;"` + CodeStandID string `json:"codeStandID" gorm:"column:code_stand_id;type:varchar(255);comment:缂栫爜id"` CrmModel } @@ -111,7 +112,7 @@ } if len(slf.MemberIds) > 0 { - db = db.Where("member_id in ?", slf.MemberIds) + db = db.Where("service_contract.member_id in ?", slf.MemberIds) } if slf.Preload { @@ -131,6 +132,19 @@ Preload("Contact") } + if slf.SalesDetailsId != 0 { + db = db.Where("sales_details_id = ?", slf.SalesDetailsId) + } + + if slf.QuotationId != 0 { + db = db.Where("quotation_id = ?", slf.QuotationId) + } + if slf.SaleChanceId != 0 { + db = db.Where("sale_chance_id = ?", slf.SaleChanceId) + } + if slf.ContactId != 0 { + db = db.Where("contact_id = ?", slf.ContactId) + } return db } @@ -209,6 +223,26 @@ return slf } +func (slf *ServiceContractSearch) SetSalesDetailsId(salesDetailsId int) *ServiceContractSearch { + slf.SalesDetailsId = salesDetailsId + return slf +} + +func (slf *ServiceContractSearch) SetQuotationId(quotationId int) *ServiceContractSearch { + slf.QuotationId = quotationId + return slf +} + +func (slf *ServiceContractSearch) SetSaleChanceId(saleChanceId int) *ServiceContractSearch { + slf.SaleChanceId = saleChanceId + return slf +} + +func (slf *ServiceContractSearch) SetContactId(contactId int) *ServiceContractSearch { + slf.ContactId = contactId + return slf +} + func (slf *ServiceContractSearch) SetPreload(preload bool) *ServiceContractSearch { slf.Preload = preload return slf -- Gitblit v1.8.0