cooperation_mode_controller.go
3.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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
package web_client
import (
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/cooperationMode/command"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/cooperationMode/query"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/cooperationMode/service"
"strconv"
)
type CooperationModeController struct {
baseController
}
func (controller *CooperationModeController) CreateCooperationMode() {
svr := service.CooperationModeService{}
cmd := &command.CreateCooperationModeCommand{}
err := controller.Unmarshal(cmd)
if err != nil {
controller.Response(nil, err)
return
}
cmd.Operator = controller.GetOperator()
data, err := svr.CreateCooperationMode(cmd)
controller.Response(data, err)
}
func (controller *CooperationModeController) UpdateCooperationMode() {
svr := service.CooperationModeService{}
cmd := &command.UpdateCooperationModeCommand{}
err := controller.Unmarshal(cmd)
if err != nil {
controller.Response(nil, err)
return
}
cooperationModeId := controller.GetString(":cooperationModeId")
cmd.CooperationModeId, _ = strconv.Atoi(cooperationModeId)
cmd.Operator = controller.GetOperator()
data, err := svr.UpdateCooperationMode(cmd)
controller.Response(data, err)
}
func (controller *CooperationModeController) GetCooperationMode() {
svr := service.CooperationModeService{}
cmd := &query.GetCooperationModeQuery{}
err := controller.Unmarshal(cmd)
if err != nil {
controller.Response(nil, err)
return
}
cooperationModeId := controller.GetString(":cooperationModeId")
cmd.CooperationModeId, _ = strconv.Atoi(cooperationModeId)
cmd.Operator = controller.GetOperator()
data, err := svr.GetCooperationMode(cmd)
controller.Response(data, err)
}
func (controller *CooperationModeController) RemoveCooperationMode() {
svr := service.CooperationModeService{}
cmd := &command.RemoveCooperationModeCommand{}
err := controller.Unmarshal(cmd)
if err != nil {
controller.Response(nil, err)
return
}
cooperationModeId := controller.GetString(":cooperationModeId")
cmd.CooperationModeId, _ = strconv.Atoi(cooperationModeId)
cmd.Operator = controller.GetOperator()
data, err := svr.RemoveCooperationMode(cmd)
controller.Response(data, err)
}
func (controller *CooperationModeController) SearchCooperationMode() {
svr := service.CooperationModeService{}
cmd := &query.ListCooperationModeQuery{}
err := controller.Unmarshal(cmd)
if err != nil {
controller.Response(nil, err)
return
}
cmd.Operator = controller.GetOperator()
cnt, data, err := svr.ListCooperationMode(cmd)
controller.returnPageListData(cnt, data, err, cmd.PageNumber)
}
func (controller *CooperationModeController) ListCooperationMode() {
svr := service.CooperationModeService{}
cmd := &query.ListCooperationModeQuery{}
err := controller.Unmarshal(cmd)
if err != nil {
controller.Response(nil, err)
return
}
cmd.Operator = controller.GetOperator()
_, data, err := svr.ListCooperationMode(cmd)
controller.Response(data, err)
}