cooperation_project_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
124
125
126
127
128
129
package controllers
import (
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/application/cooperationProject/command"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/application/cooperationProject/query"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/application/cooperationProject/service"
)
type CooperationProjectController struct {
BaseController
}
func (controller *CooperationProjectController) ReleaseCooperationProject() {
cooperationProjectService := service.NewCooperationProjectService(nil)
releaseCooperationProjectCommand := &command.ReleaseCooperationProjectCommand{}
_ = controller.Unmarshal(releaseCooperationProjectCommand)
// 解析头部信息
header := controller.GetRequestHeader(controller.Ctx)
releaseCooperationProjectCommand.CompanyId = header.CompanyId
releaseCooperationProjectCommand.OrgId = header.OrgId
releaseCooperationProjectCommand.UserId = header.UserId
releaseCooperationProjectCommand.UserBaseId = header.UserBaseId
data, err := cooperationProjectService.ReleaseCooperationProject(releaseCooperationProjectCommand)
controller.Response(data, err)
}
func (controller *CooperationProjectController) CreateCooperationProject() {
cooperationProjectService := service.NewCooperationProjectService(nil)
createCooperationProjectCommand := &command.CreateCooperationProjectCommand{}
_ = controller.Unmarshal(createCooperationProjectCommand)
// 解析头部信息
header := controller.GetRequestHeader(controller.Ctx)
createCooperationProjectCommand.CompanyId = header.CompanyId
createCooperationProjectCommand.OrgId = header.OrgId
createCooperationProjectCommand.UserId = header.UserId
createCooperationProjectCommand.UserBaseId = header.UserBaseId
data, err := cooperationProjectService.CreateCooperationProject(createCooperationProjectCommand)
controller.Response(data, err)
}
func (controller *CooperationProjectController) UpdateCooperationProject() {
cooperationProjectService := service.NewCooperationProjectService(nil)
updateCooperationProjectCommand := &command.UpdateCooperationProjectCommand{}
_ = controller.Unmarshal(updateCooperationProjectCommand)
// 解析头部信息
header := controller.GetRequestHeader(controller.Ctx)
updateCooperationProjectCommand.CompanyId = header.CompanyId
updateCooperationProjectCommand.OrgId = header.OrgId
updateCooperationProjectCommand.UserId = header.UserId
updateCooperationProjectCommand.UserBaseId = header.UserBaseId
cooperationProjectId := controller.GetString(":cooperationProjectId")
updateCooperationProjectCommand.CooperationProjectId = cooperationProjectId
data, err := cooperationProjectService.UpdateCooperationProject(updateCooperationProjectCommand)
controller.Response(data, err)
}
func (controller *CooperationProjectController) GetCooperationProject() {
cooperationProjectService := service.NewCooperationProjectService(nil)
getCooperationProjectQuery := &query.GetCooperationProjectQuery{}
// 解析头部信息
header := controller.GetRequestHeader(controller.Ctx)
getCooperationProjectQuery.CompanyId = header.CompanyId
getCooperationProjectQuery.OrgId = header.OrgId
getCooperationProjectQuery.UserId = header.UserId
getCooperationProjectQuery.UserBaseId = header.UserBaseId
cooperationProjectId, _ := controller.GetInt64(":cooperationProjectId")
getCooperationProjectQuery.CooperationProjectId = cooperationProjectId
data, err := cooperationProjectService.GetCooperationProject(getCooperationProjectQuery)
controller.Response(data, err)
}
func (controller *CooperationProjectController) RemoveCooperationProject() {
cooperationProjectService := service.NewCooperationProjectService(nil)
removeCooperationProjectCommand := &command.RemoveCooperationProjectCommand{}
_ = controller.Unmarshal(removeCooperationProjectCommand)
// 解析头部信息
header := controller.GetRequestHeader(controller.Ctx)
removeCooperationProjectCommand.CompanyId = header.CompanyId
removeCooperationProjectCommand.OrgId = header.OrgId
removeCooperationProjectCommand.UserId = header.UserId
removeCooperationProjectCommand.UserBaseId = header.UserBaseId
cooperationProjectId, _ := controller.GetInt64(":cooperationProjectId")
removeCooperationProjectCommand.CooperationProjectId = cooperationProjectId
data, err := cooperationProjectService.RemoveCooperationProject(removeCooperationProjectCommand)
controller.Response(data, err)
}
func (controller *CooperationProjectController) SearchCooperationProject() {
cooperationProjectService := service.NewCooperationProjectService(nil)
searchCooperationProjectQuery := &query.SearchCooperationProjectQuery{}
// 解析头部信息
header := controller.GetRequestHeader(controller.Ctx)
searchCooperationProjectQuery.CompanyId = header.CompanyId
searchCooperationProjectQuery.OrgId = header.OrgId
searchCooperationProjectQuery.UserId = header.UserId
searchCooperationProjectQuery.UserBaseId = header.UserBaseId
data, err := cooperationProjectService.SearchCooperationProject(searchCooperationProjectQuery)
controller.Response(data, err)
}
func (controller *CooperationProjectController) CheckUndertaker() {
cooperationProjectService := service.NewCooperationProjectService(nil)
checkUndertakerQuery := &query.CheckUndertakerQuery{}
// 解析头部信息
header := controller.GetRequestHeader(controller.Ctx)
checkUndertakerQuery.CompanyId = header.CompanyId
checkUndertakerQuery.OrgId = header.OrgId
checkUndertakerQuery.UserId = header.UserId
checkUndertakerQuery.UserBaseId = header.UserBaseId
data, err := cooperationProjectService.CheckUndertaker(checkUndertakerQuery)
controller.Response(data, err)
}
func (controller *CooperationProjectController) ListCooperationProject() {
cooperationProjectService := service.NewCooperationProjectService(nil)
listCooperationProjectQuery := &query.ListCooperationProjectQuery{}
// 解析头部信息
header := controller.GetRequestHeader(controller.Ctx)
listCooperationProjectQuery.CompanyId = header.CompanyId
listCooperationProjectQuery.OrgId = header.OrgId
listCooperationProjectQuery.UserId = header.UserId
listCooperationProjectQuery.UserBaseId = header.UserBaseId
pageSize, _ := controller.GetInt64("pageSize")
listCooperationProjectQuery.PageSize = pageSize
pageNumber, _ := controller.GetInt64("pageNumber")
listCooperationProjectQuery.PageNumber = pageNumber
data, err := cooperationProjectService.ListCooperationProject(listCooperationProjectQuery)
controller.Response(data, err)
}