-
Notifications
You must be signed in to change notification settings - Fork 75
/
dept.go
41 lines (35 loc) · 1.38 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
package model
type SysDept struct {
GqaModelWithCreatedByAndUpdatedBy
//ParentCode <==> DeptCode
ParentCode string `json:"parent_code" gorm:"comment:父部门DeptCode;index;"`
DeptCode string `json:"dept_code" gorm:"comment:部门编码;not null;uniqueIndex;"`
DeptName string `json:"dept_name" gorm:"comment:部门名称;not null;"`
Leader string `json:"leader" gorm:"comment:部门负责人username;"`
LeaderUser SysUser `json:"leader_user" gorm:"comment:部门负责人;foreignKey:Leader;references:Username"`
Staff []SysUser `json:"staff" gorm:"many2many:sys_dept_user;foreignKey:DeptCode;joinForeignKey:SysDeptDeptCode;references:Username;joinReferences:SysUserUsername;"`
Children []SysDept `json:"children" gorm:"foreignKey:ParentCode;references:DeptCode"`
}
type RequestGetDeptList struct {
RequestPageAndSort
DeptCode string `json:"dept_code"`
DeptName string `json:"dept_name"`
}
type RequestAddDept struct {
RequestAdd
ParentCode string `json:"parent_code"`
DeptCode string `json:"dept_code"`
DeptName string `json:"dept_name"`
Leader string `json:"leader"`
}
type RequestDeptCode struct {
DeptCode string `json:"dept_code"`
}
type RequestDeptUser struct {
DeptCode string `json:"dept_code"`
Username string `json:"username"`
}
type RequestDeptUserAdd struct {
DeptCode string `json:"dept_code"`
Username []string `json:"username"`
}