zhangqian
2023-11-13 a8849056eebef42a33353e8652de13822f440632
model/invoice.go
@@ -42,6 +42,7 @@
      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
}