user.go 582 B

123456789101112131415161718192021
  1. package manager
  2. import (
  3. "context"
  4. "go-common/app/job/main/videoup-report/model/manager"
  5. "go-common/library/log"
  6. )
  7. const (
  8. _userSQL = "SELECT u.id,u.username,d.name as department FROM user u left join user_department d on d.id=u.department_id where u.id=?"
  9. )
  10. // User get manager user profile
  11. func (d *Dao) User(c context.Context, id int64) (user *manager.User, err error) {
  12. user = &manager.User{}
  13. if err = d.db.QueryRow(c, _userSQL, id).Scan(&user.ID, &user.Username, &user.Department); err != nil {
  14. log.Error("User db.row.Scan error(%v) uid(%d)", err, id)
  15. }
  16. return
  17. }