cooperation_mode_controller.go
7.0 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
package controllers
import (
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/application/cooperationMode/command"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/application/cooperationMode/query"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/application/cooperationMode/service"
)
type CooperationModeController struct {
BaseController
}
func (controller *CooperationModeController) CreateCooperationMode() {
cooperationModeService := service.NewCooperationModeService(nil)
createCooperationModeCommand := &command.CreateCooperationModeCommand{}
_ = controller.Unmarshal(createCooperationModeCommand)
// 解析头部信息
header := controller.GetRequestHeader(controller.Ctx)
createCooperationModeCommand.CompanyId = header.CompanyId
createCooperationModeCommand.OrgId = header.OrgId
createCooperationModeCommand.UserId = header.UserId
createCooperationModeCommand.UserBaseId = header.UserBaseId
data, err := cooperationModeService.CreateCooperationMode(createCooperationModeCommand)
controller.Response(data, err)
}
func (controller *CooperationModeController) UpdateCooperationMode() {
cooperationModeService := service.NewCooperationModeService(nil)
updateCooperationModeCommand := &command.UpdateCooperationModeCommand{}
_ = controller.Unmarshal(updateCooperationModeCommand)
// 解析头部信息
header := controller.GetRequestHeader(controller.Ctx)
updateCooperationModeCommand.CompanyId = header.CompanyId
updateCooperationModeCommand.OrgId = header.OrgId
updateCooperationModeCommand.UserId = header.UserId
updateCooperationModeCommand.UserBaseId = header.UserBaseId
cooperationModeId, _ := controller.GetInt64(":cooperationModeId")
updateCooperationModeCommand.CooperationModeId = cooperationModeId
data, err := cooperationModeService.UpdateCooperationMode(updateCooperationModeCommand)
controller.Response(data, err)
}
func (controller *CooperationModeController) GetCooperationMode() {
cooperationModeService := service.NewCooperationModeService(nil)
getCooperationModeQuery := &query.GetCooperationModeQuery{}
// 解析头部信息
header := controller.GetRequestHeader(controller.Ctx)
getCooperationModeQuery.CompanyId = header.CompanyId
getCooperationModeQuery.OrgId = header.OrgId
getCooperationModeQuery.UserId = header.UserId
getCooperationModeQuery.UserBaseId = header.UserBaseId
cooperationModeId, _ := controller.GetInt64(":cooperationModeId")
getCooperationModeQuery.CooperationModeId = cooperationModeId
data, err := cooperationModeService.GetCooperationMode(getCooperationModeQuery)
controller.Response(data, err)
}
func (controller *CooperationModeController) RemoveCooperationMode() {
cooperationModeService := service.NewCooperationModeService(nil)
removeCooperationModeCommand := &command.RemoveCooperationModeCommand{}
_ = controller.Unmarshal(removeCooperationModeCommand)
// 解析头部信息
header := controller.GetRequestHeader(controller.Ctx)
removeCooperationModeCommand.CompanyId = header.CompanyId
removeCooperationModeCommand.OrgId = header.OrgId
removeCooperationModeCommand.UserId = header.UserId
removeCooperationModeCommand.UserBaseId = header.UserBaseId
cooperationModeId, _ := controller.GetInt64(":cooperationModeId")
removeCooperationModeCommand.CooperationModeId = cooperationModeId
data, err := cooperationModeService.RemoveCooperationMode(removeCooperationModeCommand)
controller.Response(data, err)
}
func (controller *CooperationModeController) BatchRemoveCooperationMode() {
cooperationModeService := service.NewCooperationModeService(nil)
batchRemoveCooperationModeCommand := &command.BatchRemoveCooperationModeCommand{}
_ = controller.Unmarshal(batchRemoveCooperationModeCommand)
// 解析头部信息
header := controller.GetRequestHeader(controller.Ctx)
batchRemoveCooperationModeCommand.CompanyId = header.CompanyId
batchRemoveCooperationModeCommand.OrgId = header.OrgId
batchRemoveCooperationModeCommand.UserId = header.UserId
batchRemoveCooperationModeCommand.UserBaseId = header.UserBaseId
data, err := cooperationModeService.BatchRemoveCooperationMode(batchRemoveCooperationModeCommand)
controller.Response(data, err)
}
func (controller *CooperationModeController) SearchCooperationMode() {
cooperationModeService := service.NewCooperationModeService(nil)
searchCooperationModeQuery := &query.SearchCooperationModeQuery{}
_ = controller.Unmarshal(searchCooperationModeQuery)
// 解析头部信息
header := controller.GetRequestHeader(controller.Ctx)
searchCooperationModeQuery.CompanyId = header.CompanyId
searchCooperationModeQuery.OrgId = header.OrgId
searchCooperationModeQuery.UserId = header.UserId
searchCooperationModeQuery.UserBaseId = header.UserBaseId
data, err := cooperationModeService.SearchCooperationMode(searchCooperationModeQuery)
controller.Response(data, err)
}
func (controller *CooperationModeController) ListCooperationMode() {
cooperationModeService := service.NewCooperationModeService(nil)
listCooperationModeQuery := &query.ListCooperationModeQuery{}
// 解析头部信息
header := controller.GetRequestHeader(controller.Ctx)
listCooperationModeQuery.CompanyId = header.CompanyId
listCooperationModeQuery.OrgId = header.OrgId
listCooperationModeQuery.UserId = header.UserId
listCooperationModeQuery.UserBaseId = header.UserBaseId
pageSize, _ := controller.GetInt64("pageSize")
listCooperationModeQuery.PageSize = pageSize
pageNumber, _ := controller.GetInt64("pageNumber")
listCooperationModeQuery.PageNumber = pageNumber
data, err := cooperationModeService.ListCooperationMode(listCooperationModeQuery)
controller.Response(data, err)
}
func (controller *CooperationModeController) OperateCooperationMode() {
cooperationModeService := service.NewCooperationModeService(nil)
operateCooperationModeCommand := &command.OperateCooperationModeCommand{}
_ = controller.Unmarshal(operateCooperationModeCommand)
// 解析头部信息
header := controller.GetRequestHeader(controller.Ctx)
operateCooperationModeCommand.CompanyId = header.CompanyId
operateCooperationModeCommand.OrgId = header.OrgId
operateCooperationModeCommand.UserId = header.UserId
operateCooperationModeCommand.UserBaseId = header.UserBaseId
data, err := cooperationModeService.OperateCooperationMode(operateCooperationModeCommand)
controller.Response(data, err)
}
func (controller *CooperationModeController) BatchOperateCooperationMode() {
cooperationModeService := service.NewCooperationModeService(nil)
batchOperateCooperationModeCommand := &command.BatchOperateCooperationModeCommand{}
_ = controller.Unmarshal(batchOperateCooperationModeCommand)
// 解析头部信息
header := controller.GetRequestHeader(controller.Ctx)
batchOperateCooperationModeCommand.CompanyId = header.CompanyId
batchOperateCooperationModeCommand.OrgId = header.OrgId
batchOperateCooperationModeCommand.UserId = header.UserId
batchOperateCooperationModeCommand.UserBaseId = header.UserBaseId
data, err := cooperationModeService.BatchOperateCooperationMode(batchOperateCooperationModeCommand)
controller.Response(data, err)
}