cooperation_mode_controller.go
4.8 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
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.GetString(":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) SearchCooperationMode() {
cooperationModeService := service.NewCooperationModeService(nil)
searchCooperationModeQuery := &query.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.GetInt32("pageSize")
listCooperationModeQuery.PageSize = pageSize
pageNumber, _ := controller.GetInt32("pageNumber")
listCooperationModeQuery.PageNumber = pageNumber
data, err := cooperationModeService.ListCooperationMode(listCooperationModeQuery)
controller.Response(data, err)
}