package model import ( "gorm.io/gorm" ) // RolePermission 角色-权限关联模型 type RolePermission struct { gorm.Model BaseModel `gorm:"embedded"` RoleID uint `gorm:"column:role_id;not null;index;uniqueIndex:idx_role_permission_unique,where:deleted_at IS NULL;comment:角色ID" json:"role_id"` PermID uint `gorm:"column:perm_id;not null;index;uniqueIndex:idx_role_permission_unique,where:deleted_at IS NULL;comment:权限ID" json:"perm_id"` Status int `gorm:"column:status;not null;default:1;comment:状态 0=禁用 1=启用" json:"status"` } // TableName 指定表名 func (RolePermission) TableName() string { return "tb_role_permission" }