users_controller.go
6.5 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
package web_client
import (
"strconv"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/users/command"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/users/query"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/users/service"
)
type UsersController struct {
baseController
}
func (controller *UsersController) CompanyUserAdd() {
usersService := service.NewUsersService(nil)
companyUserAddCommand := &command.CompanyUserAddCommand{}
controller.Unmarshal(companyUserAddCommand)
companyUserAddCommand.Operator = controller.GetOperator()
data, err := usersService.CompanyUserAdd(companyUserAddCommand)
controller.Response(data, err)
}
func (controller *UsersController) CompanyUserUpdate() {
usersService := service.NewUsersService(nil)
companyUserUpdateCommand := &command.CompanyUserUpdateCommand{}
controller.Unmarshal(companyUserUpdateCommand)
companyUserUpdateCommand.Operator = controller.GetOperator()
data, err := usersService.CompanyUserUpdate(companyUserUpdateCommand)
controller.Response(data, err)
}
func (controller *UsersController) CompanyUserList() {
usersService := service.NewUsersService(nil)
companyUserListQuery := &query.CompanyUserListQuery{}
controller.Unmarshal(companyUserListQuery)
companyUserListQuery.Operator = controller.GetOperator()
cnt, data, err := usersService.CompanyUserList(companyUserListQuery)
controller.returnPageListData(cnt, data, err, companyUserListQuery.PageNumber)
}
func (controller *UsersController) CompanyUserGet() {
usersService := service.NewUsersService(nil)
companyUserGetQuery := &query.CompanyUserGetQuery{}
userId := controller.GetString(":userId")
companyUserGetQuery.UsersId = userId
companyUserGetQuery.Operator = controller.GetOperator()
data, err := usersService.CompanyUserGet(companyUserGetQuery)
controller.Response(data, err)
}
func (controller *UsersController) CompanyUserEnable() {
usersService := service.NewUsersService(nil)
companyUserEnableCommand := &command.CompanyUserEnableCommand{}
controller.Unmarshal(companyUserEnableCommand)
companyUserEnableCommand.Operator = controller.GetOperator()
data, err := usersService.CompanyUserEnable(companyUserEnableCommand)
controller.Response(data, err)
}
func (controller *UsersController) CompanyUserResetPassword() {
usersService := service.NewUsersService(nil)
companyUserResetPasswordCommand := &command.CompanyUserResetPasswordCommand{}
controller.Unmarshal(companyUserResetPasswordCommand)
companyUserResetPasswordCommand.Operator = controller.GetOperator()
data, err := usersService.CompanyUserResetPassword(companyUserResetPasswordCommand)
controller.Response(data, err)
}
func (controller *UsersController) CooperationUserAdd() {
usersService := service.NewUsersService(nil)
cooperationUserAddCommand := &command.CooperationUserAddCommand{}
controller.Unmarshal(cooperationUserAddCommand)
cooperationUserAddCommand.Operator = controller.GetOperator()
data, err := usersService.CooperationUserAdd(cooperationUserAddCommand)
controller.Response(data, err)
}
func (controller *UsersController) CooperationUserUpdate() {
usersService := service.NewUsersService(nil)
cooperationUserUpdateCommand := &command.CooperationUserUpdateCommand{}
controller.Unmarshal(cooperationUserUpdateCommand)
userId := controller.GetString(":userId")
cooperationUserUpdateCommand.UserId, _ = strconv.ParseInt(userId, 10, 64)
cooperationUserUpdateCommand.Operator = controller.GetOperator()
data, err := usersService.CooperationUserUpdate(cooperationUserUpdateCommand)
controller.Response(data, err)
}
func (controller *UsersController) CooperationUserList() {
usersService := service.NewUsersService(nil)
cooperationUserListQuery := &query.CooperationUserListQuery{}
controller.Unmarshal(cooperationUserListQuery)
cooperationUserListQuery.Operator = controller.GetOperator()
cnt, data, err := usersService.CooperationUserList(cooperationUserListQuery)
controller.returnPageListData(cnt, data, err, cooperationUserListQuery.PageNumber)
}
func (controller *UsersController) CooperationUserGet() {
usersService := service.NewUsersService(nil)
cooperationUserGetQuery := &query.CooperationUserGetQuery{}
userId := controller.GetString(":userId")
cooperationUserGetQuery.UserId = userId
cooperationUserGetQuery.Operator = controller.GetOperator()
data, err := usersService.CooperationUserGet(cooperationUserGetQuery)
controller.Response(data, err)
}
func (controller *UsersController) CooperationUserEnable() {
usersService := service.NewUsersService(nil)
cooperationUserEnableCommand := &command.CooperationUserEnableCommand{}
controller.Unmarshal(cooperationUserEnableCommand)
cooperationUserEnableCommand.Operator = controller.GetOperator()
data, err := usersService.CooperationUserEnable(cooperationUserEnableCommand)
controller.Response(data, err)
}
func (controller *UsersController) CooperationUserResetPassword() {
usersService := service.NewUsersService(nil)
cooperationUserResetPasswordCommand := &command.CooperationUserResetPasswordCommand{}
controller.Unmarshal(cooperationUserResetPasswordCommand)
cooperationUserResetPasswordCommand.Operator = controller.GetOperator()
data, err := usersService.CooperationUserResetPassword(cooperationUserResetPasswordCommand)
controller.Response(data, err)
}
//CompanyOrgSelector 组织选择表
func (controller *UsersController) SelectorCompanyOrg() {
usersService := service.NewUsersService(nil)
selectorQuery := &query.CompanyOrgSelectorQuery{}
controller.Unmarshal(selectorQuery)
selectorQuery.Operator = controller.GetOperator()
cnt, data, err := usersService.SelectorCompanyOrg(selectorQuery)
controller.returnPageListData(cnt, data, err, selectorQuery.PageNumber)
}
//SelectorCompanyRole 角色选择表
func (controller *UsersController) SelectorCompanyRole() {
usersService := service.NewUsersService(nil)
selectorQuery := &query.CompanyRoleSelectorQuery{}
controller.Unmarshal(selectorQuery)
selectorQuery.Operator = controller.GetOperator()
cnt, data, err := usersService.SelectorCompanyRole(selectorQuery)
controller.returnPageListData(cnt, data, err, selectorQuery.PageNumber)
}
//CompanyOrgSelector 全组织部门选择表
func (controller *UsersController) SelectorCompanyOrgAll() {
usersService := service.NewUsersService(nil)
selectorQuery := &query.CompanyOrgSelectorQuery{}
controller.Unmarshal(selectorQuery)
selectorQuery.Operator = controller.GetOperator()
_, data, err := usersService.SelectorCompanyOrgAll(selectorQuery)
controller.Response(data, err)
}