department

package
v1.0.21 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DataScopeAll         = "ALL"      // 所有部门
	DataScopeCurrent     = "CUR"      // 当前部门
	DataScopeCurrentDown = "CUR_DOWN" // 当前部门以及下级部门
	DataScopeDown        = "DOWN"     // 下级部门
	DataScopeCustom      = "CUSTOM"   // 自定义权限
)

Variables

This section is empty.

Functions

This section is empty.

Types

type DataScope added in v1.0.15

type DataScope struct {
	All    bool
	Scopes []uint32
}

type Department

type Department struct {
	Id          uint32        `json:"id"`
	ParentId    uint32        `json:"parentId"`
	Name        string        `json:"name"`
	Keyword     string        `json:"keyword"`
	Description *string       `json:"description"`
	CreatedAt   int64         `json:"createdAt"`
	UpdatedAt   int64         `json:"updatedAt"`
	Children    []*Department `json:"Children"`
}

func (*Department) AppendChildren

func (m *Department) AppendChildren(child any)

AppendChildren 添加子节点

func (*Department) ChildrenNode

func (m *Department) ChildrenNode() []tree.Tree

ChildrenNode 获取子节点

func (*Department) ID

func (m *Department) ID() uint32

ID 获取菜单树ID

func (*Department) Parent

func (m *Department) Parent() uint32

Parent 获取父ID

type GetDepartmentRequest added in v1.0.15

type GetDepartmentRequest struct {
	Id      *uint32 `json:"id"`
	Keyword *string `json:"keyword"`
}

type ListDepartmentRequest added in v1.0.15

type ListDepartmentRequest struct {
	Order   *string  `json:"order"`
	OrderBy *string  `json:"orderBy"`
	Name    *string  `json:"name"`
	Keyword *string  `json:"keyword"`
	Ids     []uint32 `json:"ids"`
}

ListDepartmentRequest fixed code

type Repo

type Repo interface {
	// ListDepartment 获取部门信息列表
	ListDepartment(ctx kratosx.Context, req *ListDepartmentRequest) ([]*Department, uint32, error)

	// CreateDepartment 创建部门信息
	CreateDepartment(ctx kratosx.Context, req *Department) (uint32, error)

	// UpdateDepartment 更新部门信息
	UpdateDepartment(ctx kratosx.Context, req *Department) error

	// DeleteDepartment 删除部门信息
	DeleteDepartment(ctx kratosx.Context, ids []uint32) (uint32, error)

	// GetDepartmentParentIds 获取父部门信息ID列表
	GetDepartmentParentIds(ctx kratosx.Context, id uint32) ([]uint32, error)

	// GetDepartmentChildrenIds 获取子部门信息ID列表
	GetDepartmentChildrenIds(ctx kratosx.Context, id uint32) ([]uint32, error)

	// GetDepartment 获取指定的部门信息
	GetDepartment(ctx kratosx.Context, id uint32) (*Department, error)

	// GetDepartmentByKeyword 获取指定的部门信息
	GetDepartmentByKeyword(ctx kratosx.Context, keyword string) (*Department, error)

	// GetDepartmentDataScope 获取指定用户的部门权限
	GetDepartmentDataScope(ctx kratosx.Context, uid uint32) (bool, []uint32, error)
}

type UseCase

type UseCase struct {
	// contains filtered or unexported fields
}

func NewUseCase

func NewUseCase(config *conf.Config, repo Repo) *UseCase

func (*UseCase) CreateDepartment added in v1.0.15

func (u *UseCase) CreateDepartment(ctx kratosx.Context, req *Department) (uint32, error)

CreateDepartment 创建部门信息 fixed code

func (*UseCase) DeleteDepartment

func (u *UseCase) DeleteDepartment(ctx kratosx.Context, ids []uint32) (uint32, error)

DeleteDepartment 删除部门信息 fixed code

func (*UseCase) GetDepartment added in v1.0.15

func (u *UseCase) GetDepartment(ctx kratosx.Context, req *GetDepartmentRequest) (*Department, error)

GetDepartment 获取指定的部门信息

func (*UseCase) ListDepartment added in v1.0.15

func (u *UseCase) ListDepartment(ctx kratosx.Context, req *ListDepartmentRequest) ([]tree.Tree, uint32, error)

ListDepartment 获取部门信息列表树 fixed code

func (*UseCase) UpdateDepartment

func (u *UseCase) UpdateDepartment(ctx kratosx.Context, req *Department) error

UpdateDepartment 更新部门信息 fixed code

Jump to

Keyboard shortcuts

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