| | |
| | | // QuotationSearch 报价单搜索条件 |
| | | QuotationSearch struct { |
| | | Quotation |
| | | Orm *gorm.DB |
| | | |
| | | Orm *gorm.DB |
| | | Keyword string |
| | | OrderBy string |
| | | PageNum int |
| | | PageSize int |
| | | |
| | | } |
| | | ) |
| | | |
| | |
| | | |
| | | 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) |
| | | } |
| | |
| | | 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 |
| | | } |