business_order.go 692 B

1234567891011121314151617181920212223242526272829303132
  1. package income
  2. import (
  3. "context"
  4. "go-common/library/log"
  5. )
  6. const (
  7. _businessOrderSQL = "SELECT id,av_id FROM business_order_sheet WHERE id > ? ORDER BY id LIMIT ?"
  8. )
  9. // BusinessOrders get business order
  10. func (d *Dao) BusinessOrders(c context.Context, offset, limit int64) (last int64, m map[int64]bool, err error) {
  11. rows, err := d.rddb.Query(c, _businessOrderSQL, offset, limit)
  12. if err != nil {
  13. log.Error("d.rddb.Query BusinessOrders error(%v)", err)
  14. return
  15. }
  16. defer rows.Close()
  17. m = make(map[int64]bool)
  18. for rows.Next() {
  19. var avID int64
  20. err = rows.Scan(&last, &avID)
  21. if err != nil {
  22. log.Error("rows scan error(%v)", err)
  23. return
  24. }
  25. m[avID] = true
  26. }
  27. return
  28. }