zhangqian
2024-01-08 f1842bf9b5bb69b5078a215c02cb16b7e33f893a
model/salesDetails.go
@@ -45,6 +45,7 @@
      Quotation           Quotation                   `json:"quotation" gorm:"foreignKey:QuotationId"`
      Status              constvar.SalesDetailsStatus `json:"status" gorm:"column:status;type:int;comment:状态"`
      Source              string                      `json:"source" gorm:"column:source;type:varchar(255);comment:订单来源"`
      ProjectId           string                      `json:"projectId" gorm:"column:project_id;type:varchar(255);comment:aps项目id"`
      CrmModel
   }
@@ -58,6 +59,7 @@
      PageSize    int
      Preload     bool
      MemberIds   []int
      Numbers     []string
   }
)
@@ -86,6 +88,9 @@
   }
   if slf.Number != "" {
      db = db.Where("number = ?", slf.Number)
   }
   if len(slf.Numbers) > 0 {
      db = db.Where("number in (?)", slf.Numbers)
   }
   switch slf.KeywordType {
@@ -163,21 +168,6 @@
   return result.Max, nil
}
func (slf *SalesDetailsSearch) SetId(id int) *SalesDetailsSearch {
   slf.Id = id
   return slf
}
func (slf *SalesDetailsSearch) SetClientId(clientId int) *SalesDetailsSearch {
   slf.ClientId = clientId
   return slf
}
func (slf *SalesDetailsSearch) SetSaleChanceId(saleChanceId int) *SalesDetailsSearch {
   slf.SaleChanceId = saleChanceId
   return slf
}
func (slf *SalesDetailsSearch) First() (*SalesDetails, error) {
   var db = slf.build()
   var record = new(SalesDetails)
@@ -196,12 +186,31 @@
      db = db.Limit(slf.PageSize).Offset((slf.PageNum - 1) * slf.PageSize)
   }
   if slf.PageNum > 0 && slf.PageSize > 0 {
      db = db.Limit(slf.PageSize).Offset((slf.PageNum - 1) * slf.PageSize)
   }
   err := db.Order("id desc").Find(&records).Error
   return records, total, err
}
func (slf *SalesDetailsSearch) FindNotTotal() ([]*SalesDetails, error) {
   var db = slf.build()
   var records = make([]*SalesDetails, 0)
   err := db.Order("id desc").Find(&records).Error
   return records, err
}
func (slf *SalesDetailsSearch) SetId(id int) *SalesDetailsSearch {
   slf.Id = id
   return slf
}
func (slf *SalesDetailsSearch) SetClientId(clientId int) *SalesDetailsSearch {
   slf.ClientId = clientId
   return slf
}
func (slf *SalesDetailsSearch) SetSaleChanceId(saleChanceId int) *SalesDetailsSearch {
   slf.SaleChanceId = saleChanceId
   return slf
}
func (slf *SalesDetailsSearch) SetKeyword(keyword string) *SalesDetailsSearch {
@@ -239,6 +248,11 @@
   return slf
}
func (slf *SalesDetailsSearch) SetNumbers(numbers []string) *SalesDetailsSearch {
   slf.Numbers = numbers
   return slf
}
func (slf *SalesDetailsSearch) UpdateByMap(upMap map[string]interface{}) error {
   var (
      db = slf.build()