cooperation_project_controller.go
4.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
package controllers
import (
"github.com/linmadan/egglib-go/web/beego"
"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 {
beego.BaseController
}
func (controller *CooperationProjectController) ReleaseCooperationProject() {
cooperationProjectService := service.NewCooperationProjectService(nil)
releaseCooperationProjectCommand := &command.ReleaseCooperationProjectCommand{}
controller.Unmarshal(releaseCooperationProjectCommand)
data, err := cooperationProjectService.ReleaseCooperationProject(releaseCooperationProjectCommand)
controller.Response(data, err)
}
func (controller *CooperationProjectController) CreateCooperationProject() {
cooperationProjectService := service.NewCooperationProjectService(nil)
createCooperationProjectCommand := &command.CreateCooperationProjectCommand{}
controller.Unmarshal(createCooperationProjectCommand)
data, err := cooperationProjectService.CreateCooperationProject(createCooperationProjectCommand)
controller.Response(data, err)
}
func (controller *CooperationProjectController) UpdateCooperationProject() {
cooperationProjectService := service.NewCooperationProjectService(nil)
updateCooperationProjectCommand := &command.UpdateCooperationProjectCommand{}
controller.Unmarshal(updateCooperationProjectCommand)
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{}
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)
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{}
data, err := cooperationProjectService.SearchCooperationProject(searchCooperationProjectQuery)
controller.Response(data, err)
}
func (controller *CooperationProjectController) CheckUndertaker() {
cooperationProjectService := service.NewCooperationProjectService(nil)
checkUndertakerQuery := &query.CheckUndertakerQuery{}
data, err := cooperationProjectService.CheckUndertaker(checkUndertakerQuery)
controller.Response(data, err)
}
func (controller *CooperationProjectController) ListCooperationProject() {
cooperationProjectService := service.NewCooperationProjectService(nil)
listCooperationProjectQuery := &query.ListCooperationProjectQuery{}
offset, _ := controller.GetInt("offset")
listCooperationProjectQuery.Offset = offset
limit, _ := controller.GetInt("limit")
listCooperationProjectQuery.Limit = limit
data, err := cooperationProjectService.ListCooperationProject(listCooperationProjectQuery)
controller.Response(data, err)
}