staff.go 759 B

123456789101112131415161718192021222324252627282930
  1. package archive
  2. import (
  3. "context"
  4. "go-common/app/job/main/videoup/model/archive"
  5. "go-common/library/log"
  6. )
  7. const (
  8. _staffsSQL = "SELECT id,aid,mid,staff_mid,staff_title,staff_title_id,state FROM archive_staff WHERE aid=? AND state=?"
  9. )
  10. // Staffs get .
  11. func (d *Dao) Staffs(c context.Context, AID int64) (fs []*archive.Staff, err error) {
  12. rows, err := d.db.Query(c, _staffsSQL, AID, archive.STATESTAFFON)
  13. if err != nil {
  14. log.Error("d.db.Staffs(%d) error(%v)", AID, err)
  15. return
  16. }
  17. defer rows.Close()
  18. for rows.Next() {
  19. f := &archive.Staff{}
  20. if err = rows.Scan(&f.ID, &f.AID, &f.MID, &f.StaffMID, &f.StaffTitle, &f.StaffTitleID, &f.State); err != nil {
  21. log.Error("rows.Scan error(%v)", err)
  22. return
  23. }
  24. fs = append(fs, f)
  25. }
  26. return
  27. }