package oa import ( "context" "git.kumo.work/shama/service/client" "time" ) type department struct { } type DepartmentItem struct { Id int64 `json:"id"` Name string `json:"name"` ParentId int64 `json:"parentId"` CreatedAt time.Time `json:"createdAt"` Children []*DepartmentItem `json:"children"` } // All @TITLE 获取部门 func (d *department) All(ctx context.Context) (reply []DepartmentItem, err error) { xClient, err := client.GetClient(d) if err != nil { return } err = xClient.Call(ctx, "All", 0, &reply) return } type ArgsDepartmentAdd struct { Name string // 部门名称 ParentId int64 // 上级部门id } // Add @TITLE 添加部门 func (d *department) Add(ctx context.Context, args ArgsDepartmentAdd) (err error) { xClient, err := client.GetClient(d) if err != nil { return } var reply int return xClient.Call(ctx, "Add", args, &reply) } type ArgsDepartmentEdit struct { DepartmentId int64 // 部门id ArgsDepartmentAdd } // Edit @TITLE 编辑部门 func (d *department) Edit(ctx context.Context, args ArgsDepartmentEdit) (err error) { xClient, err := client.GetClient(d) if err != nil { return } var reply int return xClient.Call(ctx, "Edit", args, &reply) } // Delete @TITLE 删除部门 func (d *department) Delete(ctx context.Context, departmentIds []int64) (err error) { xClient, err := client.GetClient(d) if err != nil { return } var reply int return xClient.Call(ctx, "Delete", departmentIds, &reply) } type ArgsDepartmentSetStaff struct { DepartmentId int64 StaffIds []int64 } // SetStaff @TITLE 配置部门员工 func (d *department) SetStaff(ctx context.Context, args ArgsDepartmentSetStaff) (err error) { xClient, err := client.GetClient(d) if err != nil { return } var reply int return xClient.Call(ctx, "SetStaff", args, &reply) }