cooperation_mode_controller.go
3.1 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
package controllers
import (
"github.com/linmadan/egglib-go/web/beego"
"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 {
beego.BaseController
}
func (controller *CooperationModeController) CreateCooperationMode() {
cooperationModeService := service.NewCooperationModeService(nil)
createCooperationModeCommand := &command.CreateCooperationModeCommand{}
controller.Unmarshal(createCooperationModeCommand)
data, err := cooperationModeService.CreateCooperationMode(createCooperationModeCommand)
controller.Response(data, err)
}
func (controller *CooperationModeController) UpdateCooperationMode() {
cooperationModeService := service.NewCooperationModeService(nil)
updateCooperationModeCommand := &command.UpdateCooperationModeCommand{}
controller.Unmarshal(updateCooperationModeCommand)
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{}
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)
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{}
data, err := cooperationModeService.SearchCooperationMode(searchCooperationModeQuery)
controller.Response(data, err)
}
func (controller *CooperationModeController) ListCooperationMode() {
cooperationModeService := service.NewCooperationModeService(nil)
listCooperationModeQuery := &query.ListCooperationModeQuery{}
offset, _ := controller.GetInt("offset")
listCooperationModeQuery.Offset = offset
limit, _ := controller.GetInt("limit")
listCooperationModeQuery.Limit = limit
data, err := cooperationModeService.ListCooperationMode(listCooperationModeQuery)
controller.Response(data, err)
}