移除已注释的字段定义,包括 Name、Phone 和 Role 相关字段。 调整字段顺序并保留有效字段:Username、Password、PasswordV、HeadImg、Email、Status、Remark。
40 lines
1.3 KiB
Go
40 lines
1.3 KiB
Go
package model
|
||
|
||
import "blazing/cool"
|
||
|
||
const TableNameBaseSysUser = "base_sys_user"
|
||
|
||
// BaseSysUser mapped from table <base_sys_user>
|
||
type BaseSysUser struct {
|
||
*cool.Model
|
||
DepartmentID uint `gorm:"column:departmentId;type:bigint;index" json:"departmentId"` // 部门ID
|
||
|
||
Username string `gorm:"column:username;type:varchar(100);not null;Index" json:"username"` // 用户名
|
||
Password string `gorm:"column:password;type:varchar(255);not null" json:"password"` // 密码
|
||
PasswordV *int32 `gorm:"column:passwordV;type:int;not null;default:1" json:"passwordV"` // 密码版本, 作用是改完密码,让原来的token失效
|
||
|
||
HeadImg *string `gorm:"column:headImg;type:varchar(255)" json:"headImg"` // 头像
|
||
|
||
Email *string `gorm:"column:email;type:varchar(255)" json:"email"` // 邮箱
|
||
Status *int32 `gorm:"column:status;not null;default:1" json:"status"` // 状态 0:禁用 1:启用
|
||
Remark *string `gorm:"column:remark;type:varchar(255)" json:"remark"` // 备注
|
||
|
||
}
|
||
|
||
// TableName BaseSysUser's table name
|
||
func (*BaseSysUser) TableName() string {
|
||
return TableNameBaseSysUser
|
||
}
|
||
|
||
// NewBaseSysUser 创建一个新的BaseSysUser
|
||
func NewBaseSysUser() *BaseSysUser {
|
||
return &BaseSysUser{
|
||
Model: cool.NewModel(),
|
||
}
|
||
}
|
||
|
||
// init 创建表
|
||
func init() {
|
||
cool.CreateTable(&BaseSysUser{})
|
||
}
|