wangpengfei
2023-07-26 e0a433e9c31594527a3bf7766c0bfb2cbbceffdb
model/quotation.go
@@ -28,7 +28,13 @@
   // QuotationSearch 报价单搜索条件
   QuotationSearch struct {
      Quotation
      Orm *gorm.DB
            Orm      *gorm.DB
      Keyword  string
      OrderBy  string
      PageNum  int
      PageSize int
   }
)
@@ -44,6 +50,9 @@
func (slf *QuotationSearch) build() *gorm.DB {
   var db = slf.Orm.Model(&Quotation{})
   if slf.Keyword != "" {
      db = db.Where("name LIKE ?", "%"+slf.Keyword+"%")
   }
   if slf.Id != 0 {
      db = db.Where("id = ?", slf.Id)
   }
@@ -89,3 +98,18 @@
   var db = slf.build()
   return db.Updates(data).Error
}
func (slf *QuotationSearch) SetKeyword(keyword string) *QuotationSearch {
   slf.Keyword = keyword
   return slf
}
func (slf *QuotationSearch) SetPage(page, size int) *QuotationSearch {
   slf.PageNum, slf.PageSize = page, size
   return slf
}
func (slf *QuotationSearch) SetOrder(order string) *QuotationSearch {
   slf.OrderBy = order
   return slf
}