zhangqian
2023-11-13 a8849056eebef42a33353e8652de13822f440632
model/invoice.go
@@ -36,12 +36,13 @@
   // 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
   }
)
@@ -65,6 +66,11 @@
   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 {
@@ -81,6 +87,9 @@
   if slf.Number != "" {
      db.Where("number = ?", slf.Number)
   }
   if len(slf.PrincipalIds) > 0 {
      db = db.Where("principal_id in ?", slf.PrincipalIds)
   }
   return db
}