cooperation_contract_controller.go
6.4 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
package controllers
import (
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/application/cooperationContract/command"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/application/cooperationContract/query"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/application/cooperationContract/service"
)
type CooperationContractController struct {
BaseController
}
func (controller *CooperationContractController) CreateCooperationContract() {
cooperationContractService := service.NewCooperationContractService(nil)
createCooperationContractCommand := &command.CreateCooperationContractCommand{}
_ = controller.Unmarshal(createCooperationContractCommand)
// 解析头部信息
header := controller.GetRequestHeader(controller.Ctx)
createCooperationContractCommand.CompanyId = header.CompanyId
createCooperationContractCommand.OrgId = header.OrgId
createCooperationContractCommand.UserId = header.UserId
createCooperationContractCommand.UserBaseId = header.UserBaseId
data, err := cooperationContractService.CreateCooperationContract(createCooperationContractCommand)
controller.Response(data, err)
}
func (controller *CooperationContractController) UpdateCooperationContract() {
cooperationContractService := service.NewCooperationContractService(nil)
updateCooperationContractCommand := &command.UpdateCooperationContractCommand{}
_ = controller.Unmarshal(updateCooperationContractCommand)
// 解析头部信息
header := controller.GetRequestHeader(controller.Ctx)
updateCooperationContractCommand.CompanyId = header.CompanyId
updateCooperationContractCommand.OrgId = header.OrgId
updateCooperationContractCommand.UserId = header.UserId
updateCooperationContractCommand.UserBaseId = header.UserBaseId
cooperationContractId := controller.GetString(":cooperationContractId")
updateCooperationContractCommand.CooperationContractId = cooperationContractId
data, err := cooperationContractService.UpdateCooperationContract(updateCooperationContractCommand)
controller.Response(data, err)
}
func (controller *CooperationContractController) GetCooperationContract() {
cooperationContractService := service.NewCooperationContractService(nil)
getCooperationContractQuery := &query.GetCooperationContractQuery{}
// 解析头部信息
header := controller.GetRequestHeader(controller.Ctx)
getCooperationContractQuery.CompanyId = header.CompanyId
getCooperationContractQuery.OrgId = header.OrgId
getCooperationContractQuery.UserId = header.UserId
getCooperationContractQuery.UserBaseId = header.UserBaseId
cooperationContractId, _ := controller.GetInt64(":cooperationContractId")
getCooperationContractQuery.CooperationContractId = cooperationContractId
data, err := cooperationContractService.GetCooperationContract(getCooperationContractQuery)
controller.Response(data, err)
}
func (controller *CooperationContractController) RemoveCooperationContract() {
cooperationContractService := service.NewCooperationContractService(nil)
removeCooperationContractCommand := &command.RemoveCooperationContractCommand{}
_ = controller.Unmarshal(removeCooperationContractCommand)
// 解析头部信息
header := controller.GetRequestHeader(controller.Ctx)
removeCooperationContractCommand.CompanyId = header.CompanyId
removeCooperationContractCommand.OrgId = header.OrgId
removeCooperationContractCommand.UserId = header.UserId
removeCooperationContractCommand.UserBaseId = header.UserBaseId
cooperationContractId, _ := controller.GetInt64(":cooperationContractId")
removeCooperationContractCommand.CooperationContractId = cooperationContractId
data, err := cooperationContractService.RemoveCooperationContract(removeCooperationContractCommand)
controller.Response(data, err)
}
func (controller *CooperationContractController) SearchCooperationContract() {
cooperationContractService := service.NewCooperationContractService(nil)
searchCooperationContractQuery := &query.SearchCooperationContractQuery{}
// 解析头部信息
header := controller.GetRequestHeader(controller.Ctx)
searchCooperationContractQuery.CompanyId = header.CompanyId
searchCooperationContractQuery.OrgId = header.OrgId
searchCooperationContractQuery.UserId = header.UserId
searchCooperationContractQuery.UserBaseId = header.UserBaseId
pageSize, _ := controller.GetInt32("pageSize")
searchCooperationContractQuery.PageSize = pageSize
pageNumber, _ := controller.GetInt32("pageNumber")
searchCooperationContractQuery.PageNumber = pageNumber
data, err := cooperationContractService.SearchCooperationContract(searchCooperationContractQuery)
controller.Response(data, err)
}
func (controller *CooperationContractController) SearchCooperationContractByUndertaker() {
cooperationContractService := service.NewCooperationContractService(nil)
searchCooperationContractByUndertakerQuery := &query.SearchCooperationContractByUndertakerQuery{}
// 解析头部信息
header := controller.GetRequestHeader(controller.Ctx)
searchCooperationContractByUndertakerQuery.CompanyId = header.CompanyId
searchCooperationContractByUndertakerQuery.OrgId = header.OrgId
searchCooperationContractByUndertakerQuery.UserId = header.UserId
searchCooperationContractByUndertakerQuery.UserBaseId = header.UserBaseId
pageSize, _ := controller.GetInt32("pageSize")
searchCooperationContractByUndertakerQuery.PageSize = pageSize
pageNumber, _ := controller.GetInt32("pageNumber")
searchCooperationContractByUndertakerQuery.PageNumber = pageNumber
data, err := cooperationContractService.SearchCooperationContractByUndertaker(searchCooperationContractByUndertakerQuery)
controller.Response(data, err)
}
func (controller *CooperationContractController) ListCooperationContract() {
cooperationContractService := service.NewCooperationContractService(nil)
listCooperationContractQuery := &query.ListCooperationContractQuery{}
// 解析头部信息
header := controller.GetRequestHeader(controller.Ctx)
listCooperationContractQuery.CompanyId = header.CompanyId
listCooperationContractQuery.OrgId = header.OrgId
listCooperationContractQuery.UserId = header.UserId
listCooperationContractQuery.UserBaseId = header.UserBaseId
pageSize, _ := controller.GetInt32("pageSize")
listCooperationContractQuery.PageSize = pageSize
pageNumber, _ := controller.GetInt32("pageNumber")
listCooperationContractQuery.PageNumber = pageNumber
data, err := cooperationContractService.ListCooperationContract(listCooperationContractQuery)
controller.Response(data, err)
}