Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BaseModel ¶
type BaseModel struct {
DelFlag uint `gorm:"type:tinyint;default:0;index;comment:删除标记;column:del_flag;" json:"delFlag"` // 删除标记
CreateAt time.Time `gorm:"type:datetime;autoCreateTime;comment:创建日期" json:"createAt"` // 创建日期
UpdateAt time.Time `gorm:"type:datetime;autoUpdateTime;comment:更新日期" json:"updateAt"` // 更新日期
UpdateBy string `gorm:"type:string;size:32;comment:更新者;" json:"updateBy"` // 更新者
CreateBy string `gorm:"type:string;size:32;comment:创建者;" json:"createBy"` // 创建者
TenantId int64 `gorm:"type:string;size:32;comment:租户id;" json:"tenantId" form:"tenantId"` // 租户id
}
BaseModel 共享属性
type SysApi ¶
type SysApi struct {
ID uint `gorm:"primaryKey;comment:接口ID" json:"id"` // 主键ID
Name string `gorm:"type:varchar(100);unique;not null;comment:API接口名称" json:"name"` // API接口名称
APIPath string `gorm:"type:varchar(255);not null;uniqueIndex:api_unique;comment:接口路径(支持通配符)" json:"api_path"` // API路径(支持通配符)
Method string `` // 请求方法(GET|POST|PUT|DELETE...)
/* 128-byte string literal not displayed */
Description string `gorm:"type:varchar(255);comment:接口描述" json:"description"` // 接口描述
APIGroup string `gorm:"type:varchar(50);index;comment:接口分组(模块名称)" json:"api_group"` // 接口分组(模块名称)
Enabled uint8 `gorm:"type:tinyint;default:1;index;comment:启用状态(1启用 0禁用)" json:"enabled"` // 启用状态(1启用 0禁用)
NeedAuth uint8 `gorm:"type:tinyint;comment:是否需要认证(1是 0否);column:need_auth" json:"need_auth"` // 是否需要JWT认证(1是 0否)
NeedLog uint8 `gorm:"type:tinyint;default:1;comment:是否需要记录日志" json:"need_log"` // 是否需要记录日志
BaseModel
}
SysApi 系统接口表 记录后端所有API接口的权限信息
type SysConfig ¶
type SysConfig struct {
ID int64 `gorm:"primaryKey;autoIncrement;comment:主键ID" json:"id"` // 主键ID
Module string `gorm:"type:varchar(100);comment:所属功能模块;index" json:"module" binding:"required"` // 所属功能模块
Name string `gorm:"type:varchar(50);not null;index;comment:配置名" json:"name" binding:"required"` // 配置名
Key string `` // 配置项名称,即配置变量名,唯一
/* 129-byte string literal not displayed */
Value string `gorm:"type:text;comment:该配置保存值" json:"value" binding:"required"` // 该配置保存值
Description string `gorm:"type:varchar(255);comment:配置项描述" json:"description"` // 配置项描述
}
SysConfig 系统配置表,相当于动态INI配置文件 该表用于存储系统的配置信息,包括模块、名称、键名、值和描述等字段。 可以根据需要添加更多字段,例如配置类型、配置范围等。 该表可以通过模块和键名进行查询和更新操作,方便管理系统的配置信息。 注意:该表中的配置项名称是唯一的,不允许重复。
type SysDept ¶
type SysDept struct {
ID uint `gorm:"type:uint;primary_key;auto_increment;部门id;" json:"id"` // 主键ID
ParentId uint `gorm:"type:uint;index;comment:父部门id;" json:"parentId"` // 父部门id
Ancestors string `gorm:"type:varchar(100);comment:祖级列表;index:idx_ancestors" json:"ancestors"` // 祖级列表,以逗号分割
Name string `gorm:"type:varchar(30);unique;not null;comment:部门名称;" json:"name"` // 部门名称
Sort int `gorm:"type:int(10);comment:显示顺序;" json:"sort"` // 显示顺序
Leader string `gorm:"type:varchar(20);comment:负责人;" json:"leader"` // 负责人
Mobile string `gorm:"type:varchar(11);comment:联系电话;" json:"mobile"` // 联系电话
DeptType string `gorm:"type:varchar(50);index;default:0;comment:组织类型;" json:"deptType"` // 组织类型(0:公司 1:部门)
Status uint8 `gorm:"type:tinyint;default:1;comment:部门状态(1正常 0停用);" json:"status"` // 部门状态(1:正常 0:停用)
ParentName string `gorm:"-" json:"parentName"` // 父部门名称
BaseModel
Children []*SysDept `gorm:"-" json:"children"` // 子部门列表
}
SysDept 系统部门表
type SysDict ¶
type SysDict struct {
ID int `json:"id" gorm:"primaryKey;autoIncrement;type:int;comment:主键ID"` // 主键ID
Type string `json:"type" gorm:"type:varchar(50);not null;index:idx_type;comment:字典类型"` // 字典类型
ParentId int `json:"parent_id" gorm:"type:int;default:0;comment:父级ID"` // 父级ID
Name string `json:"name" gorm:"type:varchar(100);not null;index;comment:字典中文名称"` // 字典中文名称
Key string `json:"key" gorm:"type:varchar(50);not null;index:idx_key;comment:字典键名"` // 字典键名
Value string `json:"value" gorm:"type:varchar(100);not null;comment:字典值"` // 字典值
Sort int `json:"sort" gorm:"type:int;default:0;comment:排序"` // 排序
Remark string `json:"remark" gorm:"type:varchar(255);comment:备注"` // 备注
BaseModel
}
SysDict 字典数据
type SysPost ¶
type SysPost struct {
ID int64 `gorm:"type:bigint(20);primary_key;auto_increment;岗位ID;" json:"id" form:"id"` // 主键ID
PostCode string `gorm:"type:varchar(64);uniqueIndex;comment:岗位编码;" json:"post_code" form:"post_code"` // 岗位编码(全局唯一)
PostName string `gorm:"type:varchar(50);uniqueIndex;comment:岗位名称;" json:"post_name" form:"post_name"` // 岗位名称(全局唯一)
DeptId int64 `gorm:"type:bigint(20);index;comment:所属部门ID;" json:"dept_id" form:"dept_id"` // 所属部门ID
Sort int `gorm:"type:int(11);comment:显示顺序;" json:"sort" form:"sort"` // 显示顺序
Status uint8 `gorm:"type:tinyint;comment:状态(1正常 0停用);" json:"status" form:"status"` // 状态(1:正常 0:停用)
Remark string `gorm:"type:varchar(500);comment:备注;" json:"remark" form:"remark"` // 备注
BaseModel
}
SysPost 岗位信息
type SysResource ¶ added in v1.21.2
type SysResource struct {
ID uint `gorm:"primaryKey;comment:菜单ID" json:"id"` // 菜单ID
Type int `gorm:"type:tinyint;default:1;comment:资源类型(1菜单 2按钮)" json:"type"` // 资源类型(1菜单 2按钮)
MenuLevel int `gorm:"type:tinyint;default:1;comment:菜单等级(1主菜单 2子菜单)" json:"menu_level"` // 菜单等级(1主菜单 2子菜单)
ParentId uint `gorm:"index;comment:父菜单ID(0表示根菜单)" json:"parent_id"` // 父菜单ID(0表示根菜单)
Path string `gorm:"type:varchar(255);index;comment:路由路径(需符合Vue Router规范)" json:"path"` // 路由路径(需符合Vue Router规范)
Name string `gorm:"type:varchar(50);index;comment:路由名称" json:"name"` // 路由名称
Component string `gorm:"type:varchar(255);comment:组件路径(views目录下的路径)" json:"component"` // 组件路径(views目录下的路径)
Redirect string `gorm:"type:varchar(255);comment:重定向路径" json:"redirect"` // 重定向路径
Icon string `gorm:"type:varchar(50);comment:菜单图标(组件名称)" json:"icon"` // 菜单图标(组件名称)
Title string `gorm:"type:varchar(50);not null;comment:菜单标题(显示名称)" json:"title"` // 菜单标题(显示名称)
Sort int `gorm:"type:int;default:0;index;comment:排序序号(越小越靠前)" json:"sort"` // 排序序号(越小越靠前)
Hidden uint8 `gorm:"type:tinyint;default:0;comment:是否隐藏(0显示 1隐藏)" json:"hidden"` // 是否隐藏(0显示 1隐藏)
KeepAlive uint8 `gorm:"type:tinyint;default:1;comment:是否缓存(0否 1是)" json:"keep_alive"` // 是否缓存(0否 1是)
AlwaysShow uint8 `gorm:"type:tinyint;default:0;comment:是否总是显示(即使只有一个子菜单)" json:"always_show"` // 是否总是显示(即使只有一个子菜单)
Breadcrumb uint8 `gorm:"type:tinyint;default:1;comment:是否显示面包屑" json:"breadcrumb"` // 是否显示面包屑
Affix uint8 `gorm:"type:tinyint;default:0;comment:是否固定到标签页" json:"affix"` // 是否固定到标签页
ActiveResource string `gorm:"type:varchar(255);comment:激活菜单的路径" json:"active_resource"` // 激活菜单的路径
Status int `gorm:"type:tinyint;default:1;index;comment:菜单状态(1正常 0停用)" json:"status"` // 菜单状态(1正常 0停用)
ApiId *uint `gorm:"type:uint;index;comment:关联的API接口ID" json:"api_id"` // 点击资源调用的后端API接口ID
BaseModel
// 关联关系
Children []SysResource `gorm:"-;comment:子菜单列表" json:"children"` // 不作为数据库字段
Roles []SysRole `gorm:"-" json:"roles"` // 多对多关联
Parent *SysResource `gorm:"-" json:"parent"` // 自关联
}
SysResource 系统前端资源表 用于存储前端路由和后端权限的菜单结构
func (SysResource) TableName ¶ added in v1.21.2
func (SysResource) TableName() string
type SysRole ¶
type SysRole struct {
ID uint `gorm:"primaryKey;comment:角色ID"` // 角色ID
RoleName string `gorm:"type:varchar(50);not null;uniqueIndex;comment:角色名称"` // 角色名称
RoleIdent string `gorm:"type:varchar(50);not null;uniqueIndex;comment:角色标识符(英文)"` // 角色标识符(英文)
IsEnable uint8 `gorm:"type:tinyint;default:1;index;comment:启用状态(1启用 0禁用)"` // 启用状态(1启用 0禁用)
Description string `gorm:"type:varchar(255);comment:角色描述"` // 角色描述
BaseModel
}
SysRole 角色表结构
type SysRoleApi ¶
type SysRoleApi struct {
ID uint `gorm:"primaryKey;type:uint;comment:权限ID" json:"id"` // 权限ID
RoleId uint `gorm:"type:uint;not null;index;comment:角色ID" json:"role_id"` // 角色ID
ApiId uint `gorm:"type:uint;not null;comment:API接口ID" json:"api_id"` // API接口ID
Role *SysRole `gorm:"-" json:"role"` // 关联的角色信息
Api *SysApi `gorm:"-" json:"api"` // 关联的API接口信息
BaseModel
}
SysRoleApi 角色API权限信息模型
func (SysRoleApi) TableName ¶
func (SysRoleApi) TableName() string
type SysRoleResource ¶ added in v1.21.2
type SysRoleResource struct {
ID uint `gorm:"primaryKey;type:uint;comment:权限ID" json:"id"` // 权限ID,主键
RoleId uint `gorm:"type:uint;not null;index;comment:角色ID" json:"role_id"` // 角色ID,不能为空
ResourceId uint `gorm:"type:uint;not null;comment:资源ID" json:"resource_id"` // 资源ID,不能为空
Role *SysRole `gorm:"-" json:"role"` // 关联的角色信息
Resource *SysResource `gorm:"-" json:"resource"` // 关联的资源信息
BaseModel
}
SysRoleResource 角色资源权限信息模型
func (SysRoleResource) TableName ¶ added in v1.21.2
func (SysRoleResource) TableName() string
type SysSocial ¶ added in v1.21.2
type SysSocial struct {
ID uint64 `gorm:"column:id;type:bigint unsigned;primaryKey;autoIncrement;comment:主键" json:"id"` // 主键
UserID uint64 `gorm:"column:user_id;type:bigint unsigned;index;comment:用户ID" json:"userId"` // 用户ID
AuthID string `gorm:"column:auth_id;type:varchar(255);not null;index:idx_auth;comment:第三方唯一ID" json:"authId"` // 第三方唯一ID
Source string `gorm:"column:source;type:varchar(50);not null;index:idx_auth;comment:用户来源平台" json:"source"` // 用户来源平台
AccessToken string `gorm:"column:access_token;type:varchar(1024);not null;comment:访问令牌" json:"accessToken"` // 访问令牌
ExpireIn int `gorm:"column:expire_in;type:int;default:0;comment:令牌有效期(秒,部分平台可能没有)" json:"expireIn"` // 令牌有效期(秒,部分平台可能没有)
RefreshToken string `gorm:"column:refresh_token;type:varchar(1024);comment:刷新令牌(部分平台可能没有)" json:"refreshToken"` // 刷新令牌(部分平台可能没有)
OpenID string `gorm:"column:open_id;type:varchar(255);comment:开放ID" json:"openId"` // 开放ID
UserName string `gorm:"column:user_name;type:varchar(255);comment:第三方账号" json:"userName"` // 第三方账号
NickName string `gorm:"column:nick_name;type:varchar(255);comment:第三方昵称" json:"nickName"` // 第三方昵称
Email string `gorm:"column:email;type:varchar(255);comment:第三方邮箱" json:"email"` // 第三方邮箱
Avatar string `gorm:"column:avatar;type:varchar(1024);comment:第三方头像" json:"avatar"` // 第三方头像
AccessCode string `gorm:"column:access_code;type:varchar(512);comment:授权码(部分平台可能没有)" json:"accessCode"` // 授权码(部分平台可能没有)
UnionID string `gorm:"column:union_id;type:varchar(255);comment:联合ID" json:"unionId"` // 联合ID
Scope string `gorm:"column:scope;type:varchar(255);comment:授权范围(部分平台可能没有)" json:"scope"` // 授权范围(部分平台可能没有)
TokenType string `gorm:"column:token_type;type:varchar(50);comment:令牌类型(部分平台可能没有)" json:"tokenType"` // 令牌类型(部分平台可能没有)
IDToken string `gorm:"column:id_token;type:varchar(1024);comment:ID令牌(部分平台可能没有)" json:"idToken"` // ID令牌(部分平台可能没有)
BaseModel
}
SysSocial 社会化关系模型
type SysUser ¶
type SysUser struct {
ID int64 `gorm:"type:bigint(20);primary_key;auto_increment;用户ID;" json:"id" form:"id"` // 主键ID
LoginName string `gorm:"type:varchar(30);not null;uniqueIndex;comment:登录账号;" json:"loginName" form:"loginName"` // 登录账号(全局唯一)
NickName string `gorm:"type:varchar(30);comment:用户昵称;" json:"nickName" form:"nickName"` // 用户昵称或姓名
UserType string `gorm:"type:varchar(10);index;comment:用户类型(根据业务自由定义);" json:"userType" form:"userType"` // 用户类型(根据业务自由定义)
Email string `gorm:"type:varchar(50);index;comment:用户邮箱;" json:"email" form:"email"` // 用户邮箱(全局唯一)
Mobile string `gorm:"type:varchar(11);index;comment:手机号码;" json:"mobile" form:"mobile"` // 手机号码(全局唯一)
Sex uint8 `gorm:"type:tinyint;comment:用户性别(1男 2女 3未知);" json:"sex" form:"sex"` // 用户性别(1:男 2:女 3:未知)
Avatar string `gorm:"type:varchar(100);comment:头像路径;" json:"avatar" form:"avatar"` // 头像路径
Password string `gorm:"type:varchar(50);comment:密码;" json:"password" form:"password"` // 密码
Status uint8 `gorm:"type:tinyint;index;default:1;comment:帐号状态(1正常 2停用);" json:"status" form:"status"` // 状态(1:正常 2:停用)
LoginIp string `gorm:"type:varchar(50);comment:最后登陆IP;" json:"loginIp" form:"loginIp"` // 最后登陆IP
LoginDate *time.Time `gorm:"type:datetime;comment:最后登陆时间;" json:"loginDate" form:"loginDate"` // 最后登陆时间
Remark string `gorm:"type:varchar(500);comment:备注;" json:"remark" form:"remark"` // 备注
BaseModel
}
SysUser 用户信息
type SysUserExt ¶
type SysUserExt struct {
ID int64 `gorm:"type:bigint(20);primary_key;auto_increment;ID;" json:"id" form:"id"` // 主键ID
UserId int64 `gorm:"type:bigint(20);unique;not null;comment:用户ID;" json:"userId" form:"userId"` // 用户ID
DepartmentId int64 `gorm:"type:bigint(20);index;comment:所属部门ID;" json:"departmentId" form:"departmentId"` // 所属部门ID
PositionId int64 `gorm:"type:bigint(20);index;comment:所属岗位ID;" json:"positionId" form:"positionId"` // 所属岗位ID
RoleId int64 `gorm:"type:bigint(20);index;comment:所属角色ID;" json:"roleId" form:"roleId"` // 所属角色ID
}
SysUserExt 扩展的SysUser模型
func (SysUserExt) TableName ¶
func (e SysUserExt) TableName() string
type SysUserOnline ¶ added in v1.21.2
type SysUserOnline struct {
ID int64 `gorm:"column:id;type:bigint(20);primary_key;auto_increment;ID;" json:"id" form:"id"` // 主键ID
TokenID string `gorm:"column:token_id;type:varchar(255);primaryKey;comment:会话编号" json:"tokenId"` // 会话编号, md5(jwtToken)
UserID uint64 `gorm:"column:user_id;type:bigint unsigned;index;comment:用户ID" json:"userId"` // 用户ID
UserName string `gorm:"column:user_name;type:varchar(255);index;comment:用户名称" json:"userName"` // 用户名称
ClientKey string `gorm:"column:client_key;type:varchar(255);index;comment:客户端标识" json:"clientKey"` // 客户端标识
DeviceType string `gorm:"column:device_type;type:varchar(50);comment:设备类型" json:"deviceType"` // 设备类型
IpAddr string `gorm:"column:ip_addr;type:varchar(50);comment:登录IP地址" json:"ipAddr"` // 登录IP地址
LoginLocation string `gorm:"column:login_location;type:varchar(255);comment:登录地址" json:"loginLocation"` // 登录地址
Browser string `gorm:"column:browser;type:varchar(50);comment:浏览器类型" json:"browser"` // 浏览器类型
Os string `gorm:"column:os;type:varchar(50);comment:操作系统" json:"os"` // 操作系统
LoginTime int64 `gorm:"column:login_time;type:bigint;comment:登录时间" json:"loginTime"` // 登录时间
}
SysUserOnline 当前在线会话
func (SysUserOnline) TableName ¶ added in v1.21.2
func (SysUserOnline) TableName() string
TableName 指定表名
Source Files
¶
Click to show internal directories.
Click to hide internal directories.