department

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2020 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CreateDepartmentRequest

type CreateDepartmentRequest struct {
	*token.Session `bson:"-" json:"-"`
	Name           string `bson:"name" json:"name,omitempty" validate:"required,lte=60"`     // 部门名称
	ParentID       string `bson:"parent_id" json:"parent_id,omitempty" validate:"lte=200"`   // 上级部门ID
	ManagerID      string `bson:"manager_id" json:"manager_id,omitempty" validate:"lte=200"` // 部门管理者ID
}

CreateDepartmentRequest 创建部门请求

func NewCreateDepartmentRequest

func NewCreateDepartmentRequest() *CreateDepartmentRequest

NewCreateDepartmentRequest todo

func (*CreateDepartmentRequest) Validate

func (req *CreateDepartmentRequest) Validate() error

Validate 校验参数的合法性

type Department

type Department struct {
	ID                       string     `bson:"_id" json:"id"`                          // 部门ID
	Number                   string     `bson:"number" json:"number,omitempty"`         // 部门编号
	Path                     string     `bson:"-" json:"path,omitempty"`                // 部门访问路径
	CreateAt                 ftime.Time `bson:"create_at" json:"create_at,omitempty"`   // 部门创建时间
	UpdateAt                 ftime.Time `bson:"update_at" json:"update_at,omitempty"`   // 更新时间
	CreaterID                string     `bson:"creater_id" json:"creater_id,omitempty"` // 创建人
	DomainID                 string     `bson:"domain_id" json:"domain_id,omitempty"`   // 部门所属域
	Grade                    uint       `bson:"grade" json:"grade,omitempty"`           // 第几级部门, 由层数决定
	*CreateDepartmentRequest `bson:",inline"`
}

Department user's department

func NewDefaultDepartment

func NewDefaultDepartment() *Department

NewDefaultDepartment todo

func NewDepartment

func NewDepartment(req *CreateDepartmentRequest) (*Department, error)

NewDepartment 新建实例

type DescribeDeparmentRequest

type DescribeDeparmentRequest struct {
	ID   string
	Name string
}

DescribeDeparmentRequest 详情查询

func NewDescriptDepartmentRequest

func NewDescriptDepartmentRequest() *DescribeDeparmentRequest

NewDescriptDepartmentRequest new实例

func (*DescribeDeparmentRequest) Validate

func (req *DescribeDeparmentRequest) Validate() error

Validate 参数校验

type QueryDepartmentRequest

type QueryDepartmentRequest struct {
	*token.Session
	*request.PageRequest
	ParentID string
}

QueryDepartmentRequest todo

func NewQueryDepartmentRequest

func NewQueryDepartmentRequest(req *request.PageRequest) *QueryDepartmentRequest

NewQueryDepartmentRequest 列表查询请求

type Service

type Service interface {
	QueryDepartment(*QueryDepartmentRequest) (*Set, error)
	DescribeDepartment(*DescribeDeparmentRequest) (*Department, error)
	CreateDepartment(*CreateDepartmentRequest) (*Department, error)
	DeleteDepartment(id string) error
}

Service 服务

type Set

type Set struct {
	*request.PageRequest

	Total int64         `json:"total"`
	Items []*Department `json:"items"`
}

Set 集合

func NewDepartmentSet

func NewDepartmentSet(req *request.PageRequest) *Set

NewDepartmentSet 实例化

func (*Set) Add

func (s *Set) Add(item *Department)

Add 添加应用

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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