sys_user.go 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. // ==========================================================================
  2. // Code generated by GoFrame CLI tool. DO NOT EDIT. Created at 2022-03-02 16:48:23
  3. // ==========================================================================
  4. package internal
  5. import (
  6. "context"
  7. "github.com/gogf/gf/v2/database/gdb"
  8. "github.com/gogf/gf/v2/frame/g"
  9. )
  10. // SysUserDao is the data access object for table sys_user.
  11. type SysUserDao struct {
  12. table string // table is the underlying table name of the DAO.
  13. group string // group is the database configuration group name of current DAO.
  14. columns SysUserColumns // columns contains all the column names of Table for convenient usage.
  15. }
  16. // SysUserColumns defines and stores column names for table sys_user.
  17. type SysUserColumns struct {
  18. Id string //
  19. UserName string // 用户名
  20. Mobile string // 中国手机不带国家代码,国际手机号格式为:国家代码-手机号
  21. UserNickname string // 用户昵称
  22. Birthday string // 生日
  23. UserPassword string // 登录密码;cmf_password加密
  24. UserSalt string // 加密盐
  25. UserStatus string // 用户状态;0:禁用,1:正常,2:未验证
  26. UserEmail string // 用户登录邮箱
  27. Sex string // 性别;0:保密,1:男,2:女
  28. Avatar string // 用户头像
  29. DeptId string // 部门id
  30. Remark string // 备注
  31. IsAdmin string // 是否后台管理员 1 是 0 否
  32. Address string // 联系地址
  33. Describe string // 描述信息
  34. LastLoginIp string // 最后登录ip
  35. LastLoginTime string // 最后登录时间
  36. CreatedAt string // 创建时间
  37. UpdatedAt string // 更新时间
  38. DeletedAt string // 删除时间
  39. }
  40. // sysUserColumns holds the columns for table sys_user.
  41. var sysUserColumns = SysUserColumns{
  42. Id: "id",
  43. UserName: "user_name",
  44. Mobile: "mobile",
  45. UserNickname: "user_nickname",
  46. Birthday: "birthday",
  47. UserPassword: "user_password",
  48. UserSalt: "user_salt",
  49. UserStatus: "user_status",
  50. UserEmail: "user_email",
  51. Sex: "sex",
  52. Avatar: "avatar",
  53. DeptId: "dept_id",
  54. Remark: "remark",
  55. IsAdmin: "is_admin",
  56. Address: "address",
  57. Describe: "describe",
  58. LastLoginIp: "last_login_ip",
  59. LastLoginTime: "last_login_time",
  60. CreatedAt: "created_at",
  61. UpdatedAt: "updated_at",
  62. DeletedAt: "deleted_at",
  63. }
  64. // NewSysUserDao creates and returns a new DAO object for table data access.
  65. func NewSysUserDao() *SysUserDao {
  66. return &SysUserDao{
  67. group: "default",
  68. table: "sys_user",
  69. columns: sysUserColumns,
  70. }
  71. }
  72. // DB retrieves and returns the underlying raw database management object of current DAO.
  73. func (dao *SysUserDao) DB() gdb.DB {
  74. return g.DB(dao.group)
  75. }
  76. // Table returns the table name of current dao.
  77. func (dao *SysUserDao) Table() string {
  78. return dao.table
  79. }
  80. // Columns returns all column names of current dao.
  81. func (dao *SysUserDao) Columns() SysUserColumns {
  82. return dao.columns
  83. }
  84. // Group returns the configuration group name of database of current dao.
  85. func (dao *SysUserDao) Group() string {
  86. return dao.group
  87. }
  88. // Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
  89. func (dao *SysUserDao) Ctx(ctx context.Context) *gdb.Model {
  90. return dao.DB().Model(dao.table).Safe().Ctx(ctx)
  91. }
  92. // Transaction wraps the transaction logic using function f.
  93. // It rollbacks the transaction and returns the error from function f if it returns non-nil error.
  94. // It commits the transaction and returns nil if function f returns nil.
  95. //
  96. // Note that, you should not Commit or Rollback the transaction in function f
  97. // as it is automatically handled by this function.
  98. func (dao *SysUserDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
  99. return dao.Ctx(ctx).Transaction(ctx, f)
  100. }