-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdept.go
54 lines (41 loc) · 1.29 KB
/
dept.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
// Package syncspecv1 定义了通用的数据结构, 包括"部门"和"用户"等
package syncspecv1
import "fmt"
// Department 定义"部门"的数据结构
type Department struct {
_ struct{}
// 唯一标识: 必须, 唯一, 长度<=64
ID string `json:"id"`
// 父部门唯一标识: 必须, 长度<=64.
// 注: Parent为空代表是根部门
Parent string `json:"parent"`
// 部门名称: 必须, 非空, 长度<=128
Name string `json:"name"`
// 部门在其同级部门的展示顺序, 可选
Order int `json:"order"`
}
type (
// PagingDepartments 分页查询返回的部门
PagingDepartments = PagingResult[*Department]
// SearchDepartmentRequest 部门搜索请求
SearchDepartmentRequest struct {
Keyword string `query:"keyword"`
}
// SearchDepartmentResponse 部门搜索响应
SearchDepartmentResponse struct {
Data []*Department `json:"data"`
ErrResponse `json:",inline"`
}
// ListDepatmentRequest 拉取部门列表请求
ListDepatmentRequest = PagingParam
// ListDepartmentResponse 拉取部门列表响应
ListDepartmentResponse struct {
PagingDepartments `json:",inline"`
ErrResponse `json:",inline"`
}
)
func (d Department) String() string {
return fmt.Sprintf("id=%q, name=%q, parent=%q, order=%d",
d.ID, d.Name, d.Parent, d.Order,
)
}