28 lines
2.5 KiB
Go
28 lines
2.5 KiB
Go
package models
|
|
|
|
import (
|
|
"gorm.io/gorm"
|
|
)
|
|
|
|
type User struct {
|
|
ID string `json:"id" gorm:"primaryKey;size:20" comment:"ID" scenarios:"view;export"`
|
|
CreatedAt int64 `json:"created_at,omitempty" gorm:"autoCreateTime" comment:"创建时间" scenarios:"view;export"`
|
|
UpdatedAt int64 `json:"updated_at,omitempty" gorm:"autoUpdateTime" comment:"更新时间" scenarios:"view;export"`
|
|
DeletedAt gorm.DeletedAt `json:"deleted_at,omitempty" gorm:"index" comment:"删除时间"`
|
|
UID string `json:"uid" gorm:"column:uid;index;size:20;not null;default:''" rule:"required;unique;regexp:^[a-zA-Z0-9]{3,8}$;" props:"readonly:update" comment:"账号" scenarios:"search;list;create;view;export"`
|
|
Department string `json:"department,omitempty" gorm:"index;size:20;not null;default:''" rule:"required" comment:"部门" scenarios:"search;list;create;update;view;export" live:"type:dropdown;url:/organize/department-types"`
|
|
Role string `json:"role,omitempty" gorm:"index;size:20;not null;default:''" rule:"required" comment:"角色" scenarios:"search;list;create;update;view;export" live:"type:dropdown;url:/organize/role-types"`
|
|
Username string `json:"username" gorm:"index;size:36;not null;default:''" rule:"required" comment:"用户名" scenarios:"search;list;create;update;view;export"`
|
|
Tag string `json:"tag" gorm:"index;size:60;not null;default:''" comment:"标签" dropdown:"created;filterable;default_first" live:"type:dropdown;url:/organize/user-tags" scenarios:"list;search;create;update;view;export"`
|
|
Password string `json:"password,omitempty" gorm:"size:60;not null;default:''" rule:"required" comment:"密码" scenarios:"create"`
|
|
Avatar string `json:"avatar" gorm:"size:1024;not null;default:''" comment:"头像" scenarios:"view"`
|
|
Email string `json:"email" gorm:"size:120;not null;default:''" comment:"邮箱" scenarios:"search;list;create;update;view;export"`
|
|
Phone string `json:"phone" gorm:"size:36;not null;default:''" comment:"手机" scenarios:"search;list;create;update;view;export"`
|
|
Gender string `json:"gender,omitempty" gorm:"default:man" comment:"性别" scenarios:"list;create;update;view;export" enum:"man:男;woman:女;other:其他"`
|
|
Description string `json:"description,omitempty" gorm:"size:250;not null;default:''" format:"textarea" comment:"备注" scenarios:"create;update;view;export"`
|
|
}
|
|
|
|
func (model *User) TableName() string {
|
|
return "users"
|
|
}
|