feat: 优化web
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
package entity
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
// User 用户 iam_user
|
||||
type User struct {
|
||||
ID string `json:"id" gorm:"primaryKey;type:varchar(36);not null"`
|
||||
TenantID string `json:"tenant_id" gorm:"size:36;not null;index:idx_user_tenant"`
|
||||
DeptID *string `json:"dept_id" gorm:"size:36;index:idx_user_dept"`
|
||||
UserName string `json:"user_name" gorm:"size:64;not null"`
|
||||
RealName string `json:"real_name" gorm:"size:64"`
|
||||
PasswordHash string `json:"-" gorm:"size:255;not null"`
|
||||
Phone string `json:"phone" gorm:"size:20"`
|
||||
Email string `json:"email" gorm:"size:128"`
|
||||
Avatar string `json:"avatar" gorm:"size:512"`
|
||||
Gender int16 `json:"gender" gorm:"default:0"`
|
||||
Status int16 `json:"status" gorm:"default:1"`
|
||||
LoginAttempts int `json:"login_attempts" gorm:"default:0"`
|
||||
LockedUntil *time.Time `json:"locked_until"`
|
||||
LastLoginAt *time.Time `json:"last_login_at"`
|
||||
LastLoginIP string `json:"last_login_ip" gorm:"size:45"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
DeletedAt gorm.DeletedAt `json:"-" gorm:"index"`
|
||||
}
|
||||
|
||||
func (User) TableName() string { return "iam_user" }
|
||||
|
||||
|
||||
// UserDept 用户部门关联 iam_user_dept
|
||||
type UserDept struct {
|
||||
ID string `json:"id" gorm:"primaryKey;type:varchar(36);not null"`
|
||||
UserID string `json:"user_id" gorm:"size:36;not null;uniqueIndex:uk_user_dept"`
|
||||
DeptID string `json:"dept_id" gorm:"size:36;not null;uniqueIndex:uk_user_dept"`
|
||||
IsPrimary bool `json:"is_primary" gorm:"default:false"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
}
|
||||
|
||||
func (UserDept) TableName() string { return "iam_user_dept" }
|
||||
|
||||
// UserRole 用户角色 iam_user_role
|
||||
type UserRole struct {
|
||||
ID string `json:"id" gorm:"primaryKey;type:varchar(36);not null"`
|
||||
UserID string `json:"user_id" gorm:"size:36;not null;uniqueIndex:uk_user_role"`
|
||||
RoleID string `json:"role_id" gorm:"size:36;not null;uniqueIndex:uk_user_role"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
}
|
||||
|
||||
func (UserRole) TableName() string { return "iam_user_role" }
|
||||
Reference in New Issue
Block a user