| | |
| | | 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:销售机会id"` |
| | | SaleChance SaleChance `json:"saleChance" gorm:"foreignKey:SaleChanceId"` |
| | | SaleType int `json:"saleType" gorm:"column:sale_type;type:int;comment:销售类型"` |
| | |
| | | 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:报价单id"` |
| | | Quotation Quotation `json:"quotation" gorm:"foreignKey:QuotationId"` |
| | | CrmModel |
| | | } |
| | | |
| | |
| | | Preload("Member"). |
| | | Preload("SaleChance"). |
| | | Preload("WechatOrderStatus"). |
| | | Preload("Client") |
| | | Preload("Client"). |
| | | Preload("Quotation") |
| | | } |
| | | |
| | | return db |
| | |
| | | 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 |