sys

package
v1.21.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 23, 2025 License: MIT Imports: 1 Imported by: 0

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"`
}

BaseModel 共享属性

type SysApi

type SysApi struct {
	ID          uint   `gorm:"primaryKey;comment:接口ID" json:"id"`
	Name        string `gorm:"type:varchar(100);unique;not null;comment:API接口名称" json:"name"`
	APIPath     string `gorm:"type:varchar(255);not null;uniqueIndex:api_unique;comment:接口路径(支持通配符)" json:"api_path"`
	Method      string `` /* 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"`
	NeedAuth    uint8  `gorm:"type:tinyint;comment:是否需要认证(1是 0否);column:need_auth" json:"need_auth"`
	NeedLog     uint8  `gorm:"type:tinyint;default:1;comment:是否需要记录日志" json:"need_log"`
	BaseModel
}

SysApi 系统接口表 记录后端所有API接口的权限信息

func (SysApi) TableName

func (SysApi) TableName() string

type SysConfig

type SysConfig struct {
	ID          int64  `gorm:"primaryKey;autoIncrement;comment:主键ID" json:"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配置文件 该表用于存储系统的配置信息,包括模块、名称、键名、值和描述等字段。 可以根据需要添加更多字段,例如配置类型、配置范围等。 该表可以通过模块和键名进行查询和更新操作,方便管理系统的配置信息。 注意:该表中的配置项名称是唯一的,不允许重复。

func (SysConfig) TableName

func (SysConfig) TableName() string

type SysDept

type SysDept struct {
	Id        uint   `gorm:"type:uint;primary_key;auto_increment;部门id;" json:"id"`
	ParentId  uint   `gorm:"type:uint;index;comment:父部门id;" json:"parentId"`
	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"`
	Status    uint8  `gorm:"type:tinyint;default:1;comment:部门状态(1正常 0停用);" json:"status"`
	BaseModel
	ParentName string     `gorm:"-" json:"parentName"`
	Children   []*SysDept `gorm:"-" json:"children"`
}

SysDept 系统部门表

func (SysDept) TableName

func (e SysDept) TableName() string

type SysDict

type SysDict struct {
	// 主键ID
	ID int `json:"id" gorm:"primaryKey;autoIncrement;type:int;comment:主键ID"`
	// 字典类型
	Type string `json:"type" gorm:"type:varchar(50);not null;index:idx_type;comment:字典类型"`
	// 父级ID
	ParentID int `json:"parent_id" gorm:"type:int;default:0;comment:父级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 字典数据

func (SysDict) TableName

func (e SysDict) TableName() string

type SysMenu

type SysMenu struct {
	ID         uint   `gorm:"primaryKey;comment:菜单ID" json:"id"`
	ParentID   uint   `gorm:"index;comment:父菜单ID(0表示根菜单)" json:"parent_id"`
	Path       string `gorm:"type:varchar(255);index;comment:路由路径(需符合Vue Router规范)" json:"path"`
	Name       string `gorm:"type:varchar(50);index;comment:路由名称" json:"name"`
	Component  string `gorm:"type:varchar(255);comment:组件路径(views目录下的路径)" json:"component"`
	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"`
	KeepAlive  uint8  `gorm:"type:tinyint;default:1;comment:是否缓存(0否 1是)" json:"keep_alive"`
	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"`
	ActiveMenu string `gorm:"type:varchar(255);comment:激活菜单的路径" json:"active_menu"`
	Status     int    `gorm:"type:tinyint;default:1;index;comment:菜单状态(1正常 0停用)" json:"status"`
	BaseModel
	// 关联关系
	Children []SysMenu `gorm:"-;comment:子菜单列表" json:"children;omitempty"` // 不作为数据库字段
	Roles    []SysRole `gorm:"-" json:"roles;omitempty"`                  // 多对多关联
	Parent   *SysMenu  `gorm:"-" json:"parent;omitempty"`                 // 自关联
}

SysMenu 系统菜单表 用于存储前端路由和后端权限的菜单结构

func (SysMenu) TableName

func (SysMenu) TableName() string

type SysPost

type SysPost struct {
	Id       int64  `gorm:"type:bigint(20);primary_key;auto_increment;岗位ID;"     json:"id"  form:"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"`
	Sort     int    `gorm:"type:int(11);comment:显示顺序;" json:"sort" form:"sort"`
	Status   uint8  `gorm:"type:tinyint;comment:状态(1正常 0停用);" json:"status" form:"status"`
	Remark   string `gorm:"type:varchar(500);comment:备注;" json:"remark" form:"remark"`
	BaseModel
}

SysPost 岗位信息

func (SysPost) TableName

func (e SysPost) TableName() string

type SysRole

type SysRole struct {
	ID          uint   `gorm:"primaryKey;comment:角色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禁用)"`
	Description string `gorm:"type:varchar(255);comment:角色描述"`

	BaseModel
	// 关联关系
	Employees []SysUser `gorm:"-" json:"users;omitempty"`
	Menus     []SysMenu `gorm:"-" json:"menus;omitempty"`
	APIs      []SysApi  `gorm:"-" json:"apis;omitempty"`
}

SysRole 角色表结构

func (SysRole) TableName

func (SysRole) TableName() string

type SysRoleApi

type SysRoleApi struct {
	// 权限ID,主键
	ID uint `gorm:"primaryKey;type:uint;comment:权限ID" json:"id"`
	// 角色ID,不能为空
	RoleId uint `gorm:"type:uint;not null;index;comment:角色ID" json:"role_id"`
	// 关联的角色信息
	Role *SysRole `gorm:"-" json:"role,omitempty"`
	// 菜单代码,不能为空
	ApiId uint `gorm:"type:uint;not null;comment:API ID" json:"api_id"`
	// 关联的API接口信息
	Api *SysApi `gorm:"-" json:"api,omitempty"`
	// 创建时间,自动记录创建时的时间
	BaseModel
}

SysRoleApi 角色API权限信息模型

func (SysRoleApi) TableName

func (SysRoleApi) TableName() string

type SysRoleMenu

type SysRoleMenu struct {
	// 权限ID,主键
	ID uint `gorm:"primaryKey;type:uint;comment:权限ID" json:"id"`
	// 角色ID,不能为空
	RoleId uint `gorm:"type:uint;not null;index;comment:角色ID" json:"role_id"`
	// 关联的角色信息
	Role *SysRole `gorm:"-" json:"role,omitempty"`
	// 菜单代码,不能为空
	MenuId uint `gorm:"type:uint;not null;comment:菜单ID" json:"menu_id"`
	// 关联的API接口信息
	Menu *SysMenu `gorm:"-" json:"menu,omitempty"`
	// 创建时间,自动记录创建时的时间
	BaseModel
}

SysRoleMenu 角色菜单权限信息模型

func (SysRoleMenu) TableName

func (SysRoleMenu) TableName() string

type SysUser

type SysUser struct {
	Id        int64      `gorm:"type:bigint(20);primary_key;auto_increment;用户ID;"     json:"id"  form:"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"`
	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;comment:帐号状态(0正常 1停用);" json:"status" form:"status"`
	LoginIp   string     `gorm:"type:varchar(50);comment:最后登陆IP;" json:"loginIp" form:"loginIp"`
	LoginDate *time.Time `gorm:"type:datetime;comment:最后登陆时间;" json:"loginDate" form:"loginDate"`
	Remark    string     `gorm:"type:varchar(500);comment:备注;" json:"remark"   form:"remark"`
	BaseModel
}

SysUser 用户信息

func (SysUser) TableName

func (e SysUser) TableName() string

映射数据表

type SysUserExt

type SysUserExt struct {
	Id           int64 `gorm:"type:bigint(20);primary_key;auto_increment;ID;" json:"id" form:"id"`
	UserId       int64 `gorm:"type:bigint(20);unique;not null;comment:用户ID;" json:"userId" form:"userId"`
	DepartmentId int64 `gorm:"type:bigint(20);index;comment:所属部门ID;" json:"departmentId" form:"departmentId"`
	PositionId   int64 `gorm:"type:bigint(20);index;comment:所属岗位ID;" json:"positionId" form:"positionId"`
	RoleId       int64 `gorm:"type:bigint(20);index;comment:所属角色ID;" json:"roleId" form:"roleId"`
}

SysUserExt 扩展的SysUser模型

func (SysUserExt) TableName

func (e SysUserExt) TableName() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL