Documentation ¶
Index ¶
- type Department
- func (t *Department) All(ctx kratosx.Context, scopes types.Scopes) ([]*Department, error)
- func (t *Department) AppendChildren(child any)
- func (t *Department) ChildrenNode() []tree.Tree
- func (t *Department) Create(ctx kratosx.Context) error
- func (t *Department) DeleteByID(ctx kratosx.Context, id uint32) error
- func (t *Department) FindByID(ctx kratosx.Context, id uint32) error
- func (t *Department) FindByKeyword(ctx kratosx.Context, keyword string) error
- func (t *Department) ID() uint32
- func (t *Department) Parent() uint32
- func (t *Department) Update(ctx kratosx.Context) error
- type DepartmentClosure
- type Dict
- func (u *Dict) Create(ctx kratosx.Context) error
- func (u *Dict) Creates(ctx kratosx.Context, jobs []*Dict) error
- func (u *Dict) DeleteByID(ctx kratosx.Context, id uint32) error
- func (u *Dict) FindByID(ctx kratosx.Context, id uint32) error
- func (u *Dict) FindByKeyword(ctx kratosx.Context, email string) error
- func (u *Dict) Page(ctx kratosx.Context, options *types.PageOptions) ([]*Dict, uint32, error)
- func (u *Dict) Update(ctx kratosx.Context) error
- type DictValue
- func (u *DictValue) AllByDictId(ctx kratosx.Context, id uint32) ([]*DictValue, error)
- func (u *DictValue) Create(ctx kratosx.Context) error
- func (u *DictValue) Creates(ctx kratosx.Context, jobs []*DictValue) error
- func (u *DictValue) DeleteByID(ctx kratosx.Context, id uint32) error
- func (u *DictValue) Page(ctx kratosx.Context, options *types.PageOptions) ([]*DictValue, uint32, error)
- func (u *DictValue) Update(ctx kratosx.Context) error
- type Job
- func (u *Job) Create(ctx kratosx.Context) error
- func (u *Job) Creates(ctx kratosx.Context, jobs []*Job) error
- func (u *Job) DeleteByID(ctx kratosx.Context, id uint32) error
- func (u *Job) FindByID(ctx kratosx.Context, id uint32) error
- func (u *Job) FindByKeyword(ctx kratosx.Context, email string) error
- func (u *Job) Page(ctx kratosx.Context, options *types.PageOptions) ([]*Job, uint32, error)
- func (u *Job) Update(ctx kratosx.Context) error
- type Menu
- func (m *Menu) All(ctx kratosx.Context, scopes types.Scopes) ([]*Menu, error)
- func (m *Menu) AppendChildren(child any)
- func (m *Menu) ChildrenNode() []tree.Tree
- func (m *Menu) Create(ctx kratosx.Context) error
- func (m *Menu) DeleteByIds(ctx kratosx.Context, ids []uint32) error
- func (m *Menu) FindByID(ctx kratosx.Context, id uint32) error
- func (m *Menu) ID() uint32
- func (m *Menu) Parent() uint32
- func (m *Menu) Tree(ctx kratosx.Context, scopes types.Scopes) (tree.Tree, error)
- func (m *Menu) Update(ctx kratosx.Context) error
- func (m *Menu) UseHome(ctx kratosx.Context, srvKey string, menuId uint32) error
- type Role
- func (r *Role) All(ctx kratosx.Context, scopes types.Scopes) ([]*Role, error)
- func (r *Role) AppendChildren(child any)
- func (r *Role) ChildrenNode() []tree.Tree
- func (r *Role) Create(ctx kratosx.Context) error
- func (r *Role) DeleteByID(ctx kratosx.Context, id uint32) error
- func (r *Role) FindByID(ctx kratosx.Context, id uint32) error
- func (r *Role) FindManagerIds(ctx kratosx.Context) ([]uint32, error)
- func (r *Role) ID() uint32
- func (r *Role) Parent() uint32
- func (r *Role) ParentStatus(ctx kratosx.Context) bool
- func (r *Role) Update(ctx kratosx.Context) error
- type RoleClosure
- type RoleMenu
- func (rm *RoleMenu) DeleteByRoleID(ctx kratosx.Context, roleId uint32) error
- func (rm *RoleMenu) MenuRoles(ctx kratosx.Context, menuId uint32) ([]*RoleMenu, error)
- func (rm *RoleMenu) RoleMenus(ctx kratosx.Context, roleId uint32) ([]*RoleMenu, error)
- func (rm *RoleMenu) Update(ctx kratosx.Context, roleId uint32, menuIds []uint32) error
- type User
- func (u *User) Create(ctx kratosx.Context) error
- func (u *User) DeleteByID(ctx kratosx.Context, id uint32) error
- func (u *User) FindByEmail(ctx kratosx.Context, email string) error
- func (u *User) FindByID(ctx kratosx.Context, id uint32) error
- func (u *User) FindByPhone(ctx kratosx.Context, phFind string) error
- func (u *User) HasRoleManagerScope(ctx kratosx.Context, rid uint32) bool
- func (u *User) HasUserManagerScope(ctx kratosx.Context, mid, id uint32) bool
- func (u *User) ManagerDepartment(ctx kratosx.Context, uid uint32) ([]*Department, error)
- func (u *User) ManagerDepartmentIds(ctx kratosx.Context, uid uint32) ([]uint32, error)
- func (u *User) Page(ctx kratosx.Context, options *types.PageOptions) ([]*User, uint32, error)
- func (u *User) Update(ctx kratosx.Context) error
- func (u *User) UpdateLastLogin(ctx kratosx.Context, t uint32) error
- type UserJob
- func (ur *UserJob) Add(ctx kratosx.Context) error
- func (ur *UserJob) DeleteByID(ctx kratosx.Context, id uint32) error
- func (ur *UserJob) FindByUserAndJob(ctx kratosx.Context, userId, jobId uint32) error
- func (ur *UserJob) Update(ctx kratosx.Context, userId uint32, jobIds []uint32) error
- func (ur *UserJob) UserJobs(ctx kratosx.Context, userId uint32) ([]*UserJob, error)
- type UserRole
- func (ur *UserRole) Add(ctx kratosx.Context) error
- func (ur *UserRole) DeleteByID(ctx kratosx.Context, id uint32) error
- func (ur *UserRole) FindByUserAndRole(ctx kratosx.Context, userId, roleId uint32) error
- func (ur *UserRole) Update(ctx kratosx.Context, userId uint32, roleIds []uint32) error
- func (ur *UserRole) UserRoles(ctx kratosx.Context, userId uint32) ([]*UserRole, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Department ¶
type Department struct { types.BaseModel ParentID uint32 `json:"parent_id" gorm:"not null;comment:父id"` Path string `json:"path" gorm:"not null;size:256;comment:层级路径"` Keyword string `json:"keyword" gorm:"not null;size:32;unique;comment:关键字"` Name string `json:"name" gorm:"not null;size:32;unique;comment:名称"` Description string `json:"description" gorm:"not null;size:256;comment:描述"` Children []*Department `json:"children" gorm:"-"` }
func (*Department) All ¶
func (t *Department) All(ctx kratosx.Context, scopes types.Scopes) ([]*Department, error)
All 获取全部部门
func (*Department) AppendChildren ¶
func (t *Department) AppendChildren(child any)
func (*Department) ChildrenNode ¶
func (t *Department) ChildrenNode() []tree.Tree
func (*Department) DeleteByID ¶
func (t *Department) DeleteByID(ctx kratosx.Context, id uint32) error
DeleteByID 通过id删除指定部门 以及部门下的部门
func (*Department) FindByID ¶
func (t *Department) FindByID(ctx kratosx.Context, id uint32) error
FindByID 通过部门id查询
func (*Department) FindByKeyword ¶
func (t *Department) FindByKeyword(ctx kratosx.Context, keyword string) error
FindByKeyword 通过部门keyword查询
func (*Department) ID ¶
func (t *Department) ID() uint32
func (*Department) Parent ¶
func (t *Department) Parent() uint32
type DepartmentClosure ¶
type DepartmentClosure struct { ID uint32 `json:"id" gorm:"primaryKey;autoIncrement;comment:主键ID"` Parent uint32 `json:"parent" gorm:"not null;comment:部门id"` Children uint32 `json:"children" gorm:"not null;comment:部门id"` ParentDepartment *Department `json:"parent_department" gorm:"constraint:onDelete:cascade;foreignKey:parent;references:id"` ChildrenDepartment *Department `json:"children_department" gorm:"constraint:onDelete:cascade;foreignKey:children;references:id"` }
type Dict ¶
type Dict struct { types.BaseModel Keyword string `json:"keyword" gorm:"not null;size:32;unique;comment:关键字"` Name string `json:"name" gorm:"not null;size:32;unique;comment:名称"` Type string `json:"type" gorm:"not null;size:32;comment:类型"` Extra string `json:"extra" gorm:"size:text;comment:类型"` Description string `json:"description" gorm:"not null;size:256;comment:描述"` }
func (*Dict) DeleteByID ¶
DeleteByID 通过id删除职位信息
func (*Dict) FindByKeyword ¶
FindByKeyword 通过keyword查询职位信息
type DictValue ¶
type DictValue struct { types.BaseModel DictID uint32 `json:"dict_id" gorm:"not null;uniqueIndex:dv;comment:字典id"` Label string `json:"label" gorm:"not null;size:128;unique;comment:标签"` Value string `json:"value" gorm:"not null;uniqueIndex:dv;size:128;unique;comment:值"` Status *bool `json:"status" gorm:"default:true;comment:状态"` Weight *uint32 `json:"weight" gorm:"default 0;comment:权重"` Type string `json:"type" gorm:"size:32;comment:字典类型"` Extra string `json:"extra" gorm:"size:256;comment:扩展信息"` Description string `json:"description" gorm:"size:256;comment:描述"` Dict *Dict `json:"dict" gorm:"constraint:onDelete:cascade"` }
func (*DictValue) AllByDictId ¶
AllByDictId 通过dict_id查询所有字典值信息
func (*DictValue) DeleteByID ¶
DeleteByID 通过id删除字典值信息
type Job ¶
type Job struct { types.BaseModel Keyword string `json:"keyword" gorm:"not null;size:32;unique;comment:关键字"` Name string `json:"name" gorm:"not null;size:32;unique;comment:名称"` Weight *uint32 `json:"weight" gorm:"default 0;comment:权重"` Description string `json:"description" gorm:"not null;size:256;comment:描述"` }
func (*Job) DeleteByID ¶
DeleteByID 通过id删除职位信息
func (*Job) FindByKeyword ¶
FindByKeyword 通过keyword查询职位信息
type Menu ¶
type Menu struct { types.BaseModel ParentID uint32 `json:"parent_id" gorm:"not null;comment:父id"` App string `json:"app" gorm:"not null;type:char(32) binary;comment:服务"` Title string `json:"title" gorm:"not null;size:128;comment:标题"` Type string `json:"type" gorm:"not null;type:char(32);comment:类型"` Keyword *string `json:"keyword" gorm:"default null;unique;size:64;comment:关键词"` Icon *string `json:"icon" gorm:"default null;type:char(32);comment:图标"` Api *string `json:"api" gorm:"default null;size:128;comment:接口"` Method *string `json:"method" gorm:"default null;size:12;comment:接口方法"` Path *string `json:"path" gorm:"default null;unique;size:128;comment:路径"` Permission *string `json:"permission" gorm:"default null;size:128;comment:指令"` Component *string `json:"component" gorm:"default null;size:128;comment:组件"` Redirect *string `json:"redirect" gorm:"default null;size:128;comment:重定向地址"` Weight *uint32 `json:"weight" gorm:"default 0;comment:权重"` IsHidden *bool `json:"is_hidden" gorm:"default false;comment:是否隐藏"` IsCache *bool `json:"is_cache" gorm:"default false;comment:是否缓存"` IsHome *bool `json:"is_home" gorm:"default false;comment:是否为首页"` IsAffix *bool `json:"is_affix" gorm:"default false;comment:是否为标签"` Children []*Menu `json:"children" gorm:"-"` }
func (*Menu) DeleteByIds ¶
DeleteByIds 通过条件删除菜单
type Role ¶
type Role struct { types.BaseModel ParentID uint32 `json:"parent_id" gorm:"not null;comment:父id"` Name string `json:"name" gorm:"not null;type:char(64);comment:名称"` Keyword string `json:"keyword" gorm:"not null;type:char(32);comment:关键字"` Path string `json:"path" gorm:"not null;size:256;comment:层级路径"` Status *bool `json:"status" gorm:"not null;default:false;comment:状态"` Description *string `json:"description" gorm:"not null;size:128;comment:描述"` DepartmentIds *string `json:"department_ids" gorm:"size:256;comment:自定义管理部门"` DataScope string `json:"data_scope" gorm:"not null;type:char(32);comment:权限类型"` Children []*Role `json:"children" gorm:"-"` }
func (*Role) DeleteByID ¶
DeleteByID 通过ID删除角色信息
func (*Role) FindManagerIds ¶
FindManagerIds 查询用户管理的id列表
func (*Role) ParentStatus ¶
ParentStatus 获取指定角色的父角色状态
type RoleClosure ¶
type RoleClosure struct { ID uint32 `json:"id" gorm:"primaryKey;autoIncrement;comment:主键ID"` Parent uint32 `json:"parent" gorm:"not null;comment:用户id"` Children uint32 `json:"children" gorm:"not null;comment:用户id"` ParentRole *Role `json:"parent_role" gorm:"constraint:onDelete:cascade;foreignKey:parent;references:id"` ChildrenRole *Role `json:"children_role" gorm:"constraint:onDelete:cascade;foreignKey:children;references:id"` }
type RoleMenu ¶
type RoleMenu struct { types.CreateModel RoleID uint32 `json:"role_id" gorm:"not null;comment:角色id"` MenuID uint32 `json:"menu_id" gorm:"not null;comment:菜单id"` Role Role `json:"role" gorm:"constraint:onDelete:cascade"` Menu Menu `json:"menu" gorm:"constraint:onDelete:cascade"` }
func (*RoleMenu) DeleteByRoleID ¶
DeleteByRoleID 通过角色id删除 角色所属菜单
type User ¶
type User struct { types.BaseModel DepartmentID uint32 `json:"department_id" gorm:"not null;comment:部门id"` RoleID uint32 `json:"role_id" gorm:"not null;comment:角色id"` Name string `json:"name" gorm:"not null;size:32;comment:名称"` Nickname string `json:"nickname" gorm:"not null;size:64;comment:昵称"` Gender string `json:"gender" gorm:"not null;size:12;comment:性别"` Phone string `json:"phone" gorm:"not null;size:11;comment:手机号码"` Password string `json:"password" gorm:"not null;size:256;comment:密码"` Avatar string `json:"avatar" gorm:"size:128;comment:头像"` Email string `json:"email" gorm:"not null;size:64;comment:邮箱"` Status *bool `json:"status" gorm:"default:false;comment:状态"` Disabled *string `json:"disabled" gorm:"size:64;comment:禁用原因"` LastLogin int64 `json:"last_login" gorm:"comment:禁用原因"` Token string `json:"token" gorm:"size:512;comment:禁用原因"` Role *Role `json:"role"` Department *Department `json:"department"` }
func (*User) DeleteByID ¶
DeleteByID 通过id删除用户信息
func (*User) FindByEmail ¶
FindByEmail 通过email查询用户信息
func (*User) FindByPhone ¶
FindByPhone 通过phFind查询用户信息
func (*User) HasRoleManagerScope ¶
HasRoleManagerScope 判断用户是否具有指定用户的管理权限
func (*User) HasUserManagerScope ¶
HasUserManagerScope 判断用户是否具有指定用户的管理权限
func (*User) ManagerDepartment ¶
ManagerDepartment 通过用户id获取用户所管理的部门列表
func (*User) ManagerDepartmentIds ¶
ManagerDepartmentIds 通过用户id获取用户所管理的部门id列表
type UserJob ¶
type UserJob struct { types.CreateModel JobID uint32 `json:"job_id" gorm:"not null;comment:角色id"` UserID uint32 `json:"user_id" gorm:"not null;comment:菜单id"` Job *Job `json:"job" gorm:"constraint:OnDelete:cascade"` }
func (*UserJob) DeleteByID ¶
DeleteByID 通过id删除
func (*UserJob) FindByUserAndJob ¶
type UserRole ¶
type UserRole struct { types.CreateModel RoleID uint32 `json:"role_id" gorm:"not null;comment:角色id"` UserID uint32 `json:"user_id" gorm:"not null;comment:菜单id"` Role *Role `json:"role" gorm:"constraint:OnDelete:cascade"` }
func (*UserRole) DeleteByID ¶
DeleteByID 通过id删除