department

package
v1.0.10 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2024 License: MIT Imports: 8 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 AllDepartmentObjectValueRequest

type AllDepartmentObjectValueRequest struct {
	ObjectId     uint32 `json:"object_id"`
	DepartmentId uint32 `json:"department_id"`
}

type AllDepartmentRequest

type AllDepartmentRequest struct {
	Ids []uint32
}

type DeleteDepartmentObjectRequest

type DeleteDepartmentObjectRequest struct {
	ObjectId uint32 `json:"object_id"`
	Value    string `json:"value"`
}

type Department

type Department struct {
	types.BaseModel
	ParentId    uint32        `json:"parent_id"`
	Keyword     string        `json:"keyword"`
	Name        string        `json:"name"`
	Description string        `json:"description"`
	Children    []*Department `json:"children" gorm:"-"`
}

func (*Department) AppendChildren

func (t *Department) AppendChildren(child any)

func (*Department) ChildrenNode

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

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"`
	Parent   uint32 `json:"parent"`
	Children uint32 `json:"children"`
}

type DepartmentObject

type DepartmentObject struct {
	ID           uint32 `json:"id"`
	DepartmentId uint32 `json:"department_id"`
	ObjectId     uint32 `json:"object_id"`
	Value        string `json:"value"`
}

type Repo

type Repo interface {
	GetDepartment(ctx kratosx.Context, id uint32) (*Department, error)
	AllManagerDepartment(ctx kratosx.Context, uid uint32) ([]*Department, error)
	AllManagerDepartmentIds(ctx kratosx.Context, uid uint32) ([]uint32, error)
	AllDepartment(ctx kratosx.Context, in *AllDepartmentRequest) ([]*Department, error)
	AddDepartment(ctx kratosx.Context, in *Department) (uint32, error)
	UpdateDepartment(ctx kratosx.Context, in *Department) error
	DeleteDepartment(ctx kratosx.Context, id uint32) error
	GetScope(ctx kratosx.Context, uid, oid uint32) ([]string, error)
	AllDepartmentObjectValue(ctx kratosx.Context, did, oid uint32) ([]string, error)
	ImportDepartmentObject(ctx kratosx.Context, in []*DepartmentObject) error
	AddDepartmentObject(ctx kratosx.Context, in *DepartmentObject) (uint32, error)
	DeleteDepartmentObjectValue(ctx kratosx.Context, oid uint32, value string) error
}

type UseCase

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

func NewUseCase

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

func (*UseCase) AddDepartment

func (u *UseCase) AddDepartment(ctx kratosx.Context, in *Department) (uint32, error)

func (*UseCase) AddDepartmentObject

func (u *UseCase) AddDepartmentObject(ctx kratosx.Context, objectKey, value string) (uint32, error)

AddDepartmentObject 添加部门资源对象

func (*UseCase) AllDepartmentObjectValue

func (u *UseCase) AllDepartmentObjectValue(ctx kratosx.Context, in *AllDepartmentObjectValueRequest) ([]string, error)

AllDepartmentObjectValue 获取指定部门的指定资源对象的全部值

func (*UseCase) DeleteDepartment

func (u *UseCase) DeleteDepartment(ctx kratosx.Context, id uint32) error

func (*UseCase) DeleteDepartmentObject

func (u *UseCase) DeleteDepartmentObject(ctx kratosx.Context, objectKey, value string) error

DeleteDepartmentObject 删除部门资源对象

func (*UseCase) DepartmentTree

func (u *UseCase) DepartmentTree(ctx kratosx.Context) ([]tree.Tree, error)

DepartmentTree 查询当前用户的部门树

func (*UseCase) ImportDepartmentObject

func (u *UseCase) ImportDepartmentObject(ctx kratosx.Context, in []*DepartmentObject) error

ImportDepartmentObject 导入部门资源对象

func (*UseCase) UpdateDepartment

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

Jump to

Keyboard shortcuts

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