From 530fed8ec225453572d57b15c200ab062c335457 Mon Sep 17 00:00:00 2001
From: zhangqian <zhangqian@123.com>
Date: 星期三, 01 十一月 2023 19:20:21 +0800
Subject: [PATCH] 公海member_id使用0

---
 model/salesDetails.go |   32 ++++++++++++++++++++++++++++++--
 1 files changed, 30 insertions(+), 2 deletions(-)

diff --git a/model/salesDetails.go b/model/salesDetails.go
index b82e761..10e89b5 100644
--- a/model/salesDetails.go
+++ b/model/salesDetails.go
@@ -14,7 +14,7 @@
 		Id                  int               `json:"id" gorm:"column:id;primary_key;AUTO_INCREMENT"`
 		ClientId            int               `json:"clientId" gorm:"column:client_id;type:int;comment:瀹㈡埛id"`
 		Client              Client            `json:"client" gorm:"foreignKey:ClientId"`
-		Number              string            `json:"number" gorm:"column:number;type:varchar(255);comment:閿�鍞瓙鍗曞彿"`
+		Number              string            `json:"number" gorm:"column:number;type:varchar(255);comment:閿�鍞槑缁嗗崟鍙�"`
 		SaleChanceId        int               `json:"saleChanceId" gorm:"column:sale_chance_id;type:int;comment:閿�鍞満浼歩d"`
 		SaleChance          SaleChance        `json:"saleChance" gorm:"foreignKey:SaleChanceId"`
 		SaleType            int               `json:"saleType" gorm:"column:sale_type;type:int;comment:閿�鍞被鍨�"`
@@ -40,6 +40,9 @@
 		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"`              // 浠风◣鍚堣
 		CodeStandID         string            `json:"codeStandID" gorm:"column:code_stand_id;type:varchar(255);comment:缂栫爜id"`
+		DeliverType         int               `json:"deliverType" gorm:"column:deliver_type;type:int;comment:浜や粯绫诲瀷(1.涓�娆″彂璐�,2.澶氭鍙戣揣)"`
+		QuotationId         int               `json:"quotationId" gorm:"column:quotation_id;type:int;comment:鎶ヤ环鍗昳d"`
+		Quotation           Quotation         `json:"quotation" gorm:"foreignKey:QuotationId"`
 		CrmModel
 	}
 
@@ -106,7 +109,8 @@
 			Preload("Member").
 			Preload("SaleChance").
 			Preload("WechatOrderStatus").
-			Preload("Client")
+			Preload("Client").
+			Preload("Quotation")
 	}
 
 	return db
@@ -133,6 +137,30 @@
 	return db.Updates(record).Error
 }
 
+func (slf *SalesDetailsSearch) Count() (int64, error) {
+	var db = slf.build()
+	var total int64
+	err := db.Count(&total).Error
+	return total, err
+}
+
+func (slf *SalesDetailsSearch) MaxAutoIncr() (int, error) {
+	type Result struct {
+		Max int
+	}
+
+	var (
+		result Result
+		db     = slf.build()
+	)
+
+	err := db.Select("MAX(id) as max").Scan(&result).Error
+	if err != nil {
+		return result.Max, fmt.Errorf("max err: %v", err)
+	}
+	return result.Max, nil
+}
+
 func (slf *SalesDetailsSearch) SetId(id int) *SalesDetailsSearch {
 	slf.Id = id
 	return slf

--
Gitblit v1.8.0