company.go
4.7 KB
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
package protocol
//RequestDepartmentAdd 部门设置
type RequestDepartmentAdd struct {
CompanyID int64 `json:"company_id"` //公司
Name string `json:"name"` //部门名字
ParentID int64 `json:"parent_id"` //父级部门Id
}
type ResponseDepartmenrAdd struct {
DepartmentId int64 `json:"id"` // 部门id
}
type DepartmentManager struct {
Id int64 `json:"id"` //user_company表的id
Name string `json:"name"`
}
//RequestDepartmentEdit 编辑
type RequestDepartmentEdit struct {
ID int64 `json:"id"`
Managers []int64 `json:"manages"` //主管user_company_id
RequestDepartmentAdd
}
//RequestDepartmentDelete ...
type RequestDepartmentDelete struct {
IDs []int64 `json:"ids"`
CompanyID int64 `json:"company_id"` //公司
}
type DepartmentMember struct {
Id int64 `json:"id"`
Name string `json:"name"`
}
//ResponseDepartmentInfo ...
type ResponseDepartmentInfo struct {
ID int64 `json:"id"`
CompanyID int64 `json:"company_id"` //公司
Name string `json:"name"` //部门名字
ParantID int64 `json:"parentId"` //父级部门Id
Manages []DepartmentManager `json:"manages"` //部门管理员
Member int64 `json:"member"` //成员数
}
//ResponseDepartmentList ....
type ResponseDepartmentList struct {
List []ResponseDepartmentInfo `json:"lists"`
}
// 部门详情
type ResponseDepartmentDetail struct {
ID int64 `json:"id"`
Name string `json:"name"` //部门名字
ParantID int64 `json:"parentId"` //父级部门Id
ParentName string `json:"parentName"`
Manages []DepartmentManager `json:"manages"` //部门管理员
}
//RequestPositionAdd 添加职位
type RequestPositionAdd struct {
CompanyID int64 `json:"company_id"`
Name string `json:"name"`
ParentID int64 `json:"parent_id"`
}
//RequestPositionEdit 编辑职位
type RequestPositionEdit struct {
ID int64 `json:"id"`
RequestPositionAdd
}
//ResponsePositionInfo ...
type ResponsePositionInfo struct {
Id int64 `json:"id" orm:"column(id)"`
Name string `json:"name" orm:"column(name)"`
ParentId int64 `json:"parent_id" orm:"column(parent_id)"`
ParemtName string `json:"parent_name,omitempty" orm:"-"`
}
type RequestPositionDelete struct {
CompanyID int64 `json:"company_id"`
IDs []int64 `json:"ids"`
}
//RequestUserAdd 添加用户
type RequestUserAdd struct {
//Name string `json:"name"`
CompanyId int64 `json:"company_id"`
// Phone string `json:"phone"`
// Departments []int64 `json:"departments"`
// Positions []int64 `json:"positions"`
Roles []int64 `json:"roles"`
}
//RequestUserEdit 编辑用户
type RequestUserEdit struct {
UserCompanyID int64 `json:"user_company_id"`
RequestUserAdd
}
//RequestUserList 获取用户列表
type RequestUserList struct {
RequestPageInfo
NickName string `json:"nick_name"`
Companyid int64 `json:"company_id"`
}
//ResponseUserList 响应的用户列表
type ResponseUserList struct {
ResponsePageInfo
List []UserListItem `json:"lists"`
}
type UserListItem struct {
UserCompanydId int64 `json:"user_company_id" orm:"column(user_company_id)"`
NickName string `json:"nick_name" orm:"column(nick_name)"`
Positions string `json:"positions" orm:"-"`
Roles string `json:"roles" orm:"-"`
Departments string `json:"departments" orm:"-"`
Phone string `json:"phone" orm:"column(phone)"`
Enable int8 `json:"enable" orm:"column(enable)"`
}
type ResponseCompanyBase struct {
CompanyId int64 `json:"id"`
Name string `json:"name"`
Logo string `json:"logo"`
}
//CenterCompanyInfo 统一用户中心调用的公司数据
type CenterCompanyInfo struct {
CompanyId int64 `json:"company_id"` //总后台的公司id
CompanyName string `json:"company_name"` //
AdminAccount string `json:"admin_account"`
AdminName string `json:"admin_name"`
Status int8 `json:"status"` //公司的状态 【1:启用】【2:禁用】
}
func (c CenterCompanyInfo) IsEnable() bool {
if c.Status == 1 {
return true
}
return false
}
func (c CenterCompanyInfo) IsForbid() bool {
if c.Status == 2 {
return true
}
return false
}
type ResponseCenterCompany struct {
UCenterCompanyId int64 `json:"comopany_id"` //总
Exist int8 `json:"exist"` //公司【1:存在;【-1:不存在】
Status int8 `json:"status"` //公司的启用状态【1:启用,-1:禁用】
}
func (r *ResponseCenterCompany) ExistYes() {
r.Exist = 1
}
func (r *ResponseCenterCompany) ExistNo() {
r.Exist = -1
}
func (r *ResponseCenterCompany) StatusYes() {
r.Status = 1
}
func (r *ResponseCenterCompany) StatusNo() {
r.Status = -1
}