cooperation_application_controller.go
4.9 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
package controllers
import (
"github.com/linmadan/egglib-go/web/beego"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/application/cooperationApplication/command"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/application/cooperationApplication/query"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/application/cooperationApplication/service"
)
type CooperationApplicationController struct {
beego.BaseController
}
func (controller *CooperationApplicationController) ApplyForCooperation() {
cooperationApplicationService := service.NewCooperationApplicationService(nil)
applyForCooperationCommand := &command.ApplyForCooperationCommand{}
controller.Unmarshal(applyForCooperationCommand)
data, err := cooperationApplicationService.ApplyForCooperation(applyForCooperationCommand)
controller.Response(data, err)
}
func (controller *CooperationApplicationController) AgreeCooperationApplication() {
cooperationApplicationService := service.NewCooperationApplicationService(nil)
agreeCooperationApplicationCommand := &command.AgreeCooperationApplicationCommand{}
controller.Unmarshal(agreeCooperationApplicationCommand)
data, err := cooperationApplicationService.AgreeCooperationApplication(agreeCooperationApplicationCommand)
controller.Response(data, err)
}
func (controller *CooperationApplicationController) RejectCooperationApplication() {
cooperationApplicationService := service.NewCooperationApplicationService(nil)
rejectCooperationApplicationCommand := &command.RejectCooperationApplicationCommand{}
controller.Unmarshal(rejectCooperationApplicationCommand)
data, err := cooperationApplicationService.RejectCooperationApplication(rejectCooperationApplicationCommand)
controller.Response(data, err)
}
func (controller *CooperationApplicationController) CreateCooperationApplication() {
cooperationApplicationService := service.NewCooperationApplicationService(nil)
createCooperationApplicationCommand := &command.CreateCooperationApplicationCommand{}
controller.Unmarshal(createCooperationApplicationCommand)
data, err := cooperationApplicationService.CreateCooperationApplication(createCooperationApplicationCommand)
controller.Response(data, err)
}
func (controller *CooperationApplicationController) UpdateCooperationApplication() {
cooperationApplicationService := service.NewCooperationApplicationService(nil)
updateCooperationApplicationCommand := &command.UpdateCooperationApplicationCommand{}
controller.Unmarshal(updateCooperationApplicationCommand)
cooperationApplicationId := controller.GetString(":cooperationApplicationId")
updateCooperationApplicationCommand.CooperationApplicationId = cooperationApplicationId
data, err := cooperationApplicationService.UpdateCooperationApplication(updateCooperationApplicationCommand)
controller.Response(data, err)
}
func (controller *CooperationApplicationController) GetCooperationApplication() {
cooperationApplicationService := service.NewCooperationApplicationService(nil)
getCooperationApplicationQuery := &query.GetCooperationApplicationQuery{}
cooperationApplicationId, _ := controller.GetInt64(":cooperationApplicationId")
getCooperationApplicationQuery.CooperationApplicationId = cooperationApplicationId
data, err := cooperationApplicationService.GetCooperationApplication(getCooperationApplicationQuery)
controller.Response(data, err)
}
func (controller *CooperationApplicationController) RemoveCooperationApplication() {
cooperationApplicationService := service.NewCooperationApplicationService(nil)
removeCooperationApplicationCommand := &command.RemoveCooperationApplicationCommand{}
controller.Unmarshal(removeCooperationApplicationCommand)
cooperationApplicationId, _ := controller.GetInt64(":cooperationApplicationId")
removeCooperationApplicationCommand.CooperationApplicationId = cooperationApplicationId
data, err := cooperationApplicationService.RemoveCooperationApplication(removeCooperationApplicationCommand)
controller.Response(data, err)
}
func (controller *CooperationApplicationController) SearchCooperationApplication() {
cooperationApplicationService := service.NewCooperationApplicationService(nil)
searchCooperationApplicationQuery := &query.SearchCooperationApplicationQuery{}
data, err := cooperationApplicationService.SearchCooperationApplication(searchCooperationApplicationQuery)
controller.Response(data, err)
}
func (controller *CooperationApplicationController) ListCooperationApplication() {
cooperationApplicationService := service.NewCooperationApplicationService(nil)
listCooperationApplicationQuery := &query.ListCooperationApplicationQuery{}
offset, _ := controller.GetInt("offset")
listCooperationApplicationQuery.Offset = offset
limit, _ := controller.GetInt("limit")
listCooperationApplicationQuery.Limit = limit
data, err := cooperationApplicationService.ListCooperationApplication(listCooperationApplicationQuery)
controller.Response(data, err)
}