admin.go 5.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. package admin
  2. import "time"
  3. // Admin [...]
  4. type Admin struct {
  5. AdminID int64 `gorm:"primaryKey;column:admin_id;type:bigint(20);not null" json:"adminId"`
  6. AdminName string `gorm:"uniqueIndex:un;index:name;index:admin_pass;column:admin_name;type:varchar(60);not null" json:"adminName"`
  7. AdminAvatar string `gorm:"column:admin_avatar;type:varchar(255)" json:"adminAvatar"`
  8. RealName string `gorm:"column:real_name;type:varchar(60)" json:"realName"`
  9. Password string `gorm:"index:password;index:admin_pass;column:password;type:varchar(60);not null" json:"password"`
  10. LastUpdatedPasswordTime time.Time `gorm:"column:last_updated_password_time;type:datetime" json:"lastUpdatedPasswordTime"`
  11. Enabled int8 `gorm:"uniqueIndex:un;column:enabled;type:tinyint(1);not null;default:1" json:"enabled"` // 1:有效,0:禁用
  12. Email string `gorm:"column:email;type:varchar(60)" json:"email"`
  13. LastLoginTime time.Time `gorm:"column:last_login_time;type:datetime" json:"lastLoginTime"` // 最近登陆时间
  14. CreatedTime time.Time `gorm:"index:created_time;column:created_time;type:datetime;default:CURRENT_TIMESTAMP" json:"createdTime"` // 创建时间
  15. LastUpdatedTime time.Time `gorm:"index:last_updated_time;column:last_updated_time;type:timestamp;not null;default:CURRENT_TIMESTAMP" json:"lastUpdatedTime"`
  16. Role string `gorm:"column:role;type:varchar(30);default:saller" json:"role"` // 用户角色
  17. Mobile string `gorm:"column:mobile;type:varchar(20)" json:"mobile"` // 手机号
  18. RoleType int8 `gorm:"column:role_type;type:tinyint(4);default:0" json:"roleType"` // 角色类型:1需要录入指标,0:不需要
  19. RoleID int `gorm:"column:role_id;type:int(11);default:0" json:"roleId"` // 角色id
  20. RoleName string `gorm:"column:role_name;type:varchar(100)" json:"roleName"` // 角色名称
  21. RoleTypeCode string `gorm:"column:role_type_code;type:varchar(20);default:''" json:"roleTypeCode"` // 角色编码
  22. DepartmentID int `gorm:"column:department_id;type:int(11);default:0" json:"departmentId"` // 部门id
  23. DepartmentName string `gorm:"column:department_name;type:varchar(100)" json:"departmentName"` // 部门名称
  24. GroupID int `gorm:"column:group_id;type:int(11);default:0" json:"groupId"` // 分组id
  25. GroupName string `gorm:"column:group_name;type:varchar(100)" json:"groupName"` // 分组名称
  26. Authority int8 `gorm:"column:authority;type:tinyint(4);default:0" json:"authority"` // 管理权限,0:无,1:部门负责人,2:小组负责人,3:超级管理员
  27. Position string `gorm:"column:position;type:varchar(100)" json:"position"` // 职位
  28. OpenId string `gorm:"column:open_id;type:varchar(100)" json:"open_id"` // 弘则部门openid
  29. }
  30. // TableName get sql table name.获取数据库表名
  31. func (m *Admin) TableName() string {
  32. return "admin"
  33. }
  34. // AdminColumns get sql column name.获取数据库列名
  35. var AdminColumns = struct {
  36. AdminID string
  37. AdminName string
  38. RealName string
  39. Password string
  40. LastUpdatedPasswordTime string
  41. Enabled string
  42. Email string
  43. LastLoginTime string
  44. CreatedTime string
  45. LastUpdatedTime string
  46. Role string
  47. Mobile string
  48. RoleType string
  49. RoleID string
  50. RoleName string
  51. RoleTypeCode string
  52. DepartmentID string
  53. DepartmentName string
  54. GroupID string
  55. GroupName string
  56. Authority string
  57. Position string
  58. }{
  59. AdminID: "admin_id",
  60. AdminName: "admin_name",
  61. RealName: "real_name",
  62. Password: "password",
  63. LastUpdatedPasswordTime: "last_updated_password_time",
  64. Enabled: "enabled",
  65. Email: "email",
  66. LastLoginTime: "last_login_time",
  67. CreatedTime: "created_time",
  68. LastUpdatedTime: "last_updated_time",
  69. Role: "role",
  70. Mobile: "mobile",
  71. RoleType: "role_type",
  72. RoleID: "role_id",
  73. RoleName: "role_name",
  74. RoleTypeCode: "role_type_code",
  75. DepartmentID: "department_id",
  76. DepartmentName: "department_name",
  77. GroupID: "group_id",
  78. GroupName: "group_name",
  79. Authority: "authority",
  80. Position: "position",
  81. }