sys_user.go 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. // ============================================================================
  2. // This is auto-generated by gf cli tool only once. Fill this file as you wish.
  3. // ============================================================================
  4. package dao
  5. import (
  6. "context"
  7. "dashoo.cn/micro/app/dao/internal"
  8. "dashoo.cn/micro/app/model"
  9. "github.com/gogf/gf/errors/gerror"
  10. "github.com/gogf/gf/frame/g"
  11. )
  12. // sysUserDao is the manager for logic model data accessing
  13. // and custom defined data operations functions management. You can define
  14. // methods on it to extend its functionality as you wish.
  15. type sysUserDao struct {
  16. internal.SysUserDao
  17. }
  18. var (
  19. // SysUser is globally public accessible object for table sys_user operations.
  20. SysUser = sysUserDao{
  21. internal.SysUser,
  22. }
  23. )
  24. type SysUserDao struct {
  25. internal.SysUserDao
  26. }
  27. func NewSysUserDao(tenant string) *SysUserDao {
  28. dao := internal.NewSysUserDao(tenant)
  29. return &SysUserDao{
  30. dao,
  31. }
  32. }
  33. // Fill with you ideas below.
  34. // FindByUsername 通过用户名获取用户信息
  35. func (d *sysUserDao) FindByUsername(ctx context.Context, username string) (user *model.LoginUserRes, err error) {
  36. user = &model.LoginUserRes{}
  37. err = d.Ctx(ctx).Fields(user).Where(d.Columns.UserName, username).Scan(user)
  38. if err != nil {
  39. g.Log().Error(err)
  40. err = gerror.New("获取用户信息失败")
  41. }
  42. return
  43. }