| | |
| | | // InvoiceSearch 销售发票搜索条件 |
| | | InvoiceSearch struct { |
| | | Invoice |
| | | Orm *gorm.DB |
| | | QueryClass constvar.InvoiceQueryClass |
| | | KeywordType constvar.InvoiceKeywordType |
| | | Keyword string |
| | | PageNum int |
| | | PageSize int |
| | | Orm *gorm.DB |
| | | QueryClass constvar.InvoiceQueryClass |
| | | KeywordType constvar.InvoiceKeywordType |
| | | Keyword string |
| | | PageNum int |
| | | PageSize int |
| | | PrincipalIds []int |
| | | } |
| | | ) |
| | | |
| | |
| | | return slf |
| | | } |
| | | |
| | | func (slf *InvoiceSearch) SetPrincipalIds(principalIds []int) *InvoiceSearch { |
| | | slf.PrincipalIds = principalIds |
| | | return slf |
| | | } |
| | | |
| | | func (slf *InvoiceSearch) build() *gorm.DB { |
| | | var db = slf.Orm.Model(&Invoice{}) |
| | | if slf.Id != 0 { |
| | |
| | | if slf.Number != "" { |
| | | db.Where("number = ?", slf.Number) |
| | | } |
| | | if len(slf.PrincipalIds) > 0 { |
| | | db = db.Where("principal_id in ?", slf.PrincipalIds) |
| | | } |
| | | |
| | | return db |
| | | } |