dividends_order_controller.go
3.3 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
package controllers
import (
"github.com/linmadan/egglib-go/web/beego"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/application/dividendsOrder/command"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/application/dividendsOrder/query"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/application/dividendsOrder/service"
)
type DividendsOrderController struct {
beego.BaseController
}
func (controller *DividendsOrderController) CreateDividendsOrder() {
dividendsOrderService := service.NewDividendsOrderService(nil)
createDividendsOrderCommand := &command.CreateDividendsOrderCommand{}
controller.Unmarshal(createDividendsOrderCommand)
data, err := dividendsOrderService.CreateDividendsOrder(createDividendsOrderCommand)
controller.Response(data, err)
}
func (controller *DividendsOrderController) UpdateDividendsOrder() {
dividendsOrderService := service.NewDividendsOrderService(nil)
updateDividendsOrderCommand := &command.UpdateDividendsOrderCommand{}
controller.Unmarshal(updateDividendsOrderCommand)
dividendsOrderId := controller.GetString(":dividendsOrderId")
updateDividendsOrderCommand.DividendsOrderId = dividendsOrderId
data, err := dividendsOrderService.UpdateDividendsOrder(updateDividendsOrderCommand)
controller.Response(data, err)
}
func (controller *DividendsOrderController) GetDividendsOrder() {
dividendsOrderService := service.NewDividendsOrderService(nil)
getDividendsOrderQuery := &query.GetDividendsOrderQuery{}
dividendsOrderId, _ := controller.GetInt64(":dividendsOrderId")
getDividendsOrderQuery.DividendsOrderId = dividendsOrderId
data, err := dividendsOrderService.GetDividendsOrder(getDividendsOrderQuery)
controller.Response(data, err)
}
func (controller *DividendsOrderController) RemoveDividendsOrder() {
dividendsOrderService := service.NewDividendsOrderService(nil)
removeDividendsOrderCommand := &command.RemoveDividendsOrderCommand{}
controller.Unmarshal(removeDividendsOrderCommand)
dividendsOrderId := controller.GetString(":dividendsOrderId")
removeDividendsOrderCommand.DividendsOrderId = dividendsOrderId
data, err := dividendsOrderService.RemoveDividendsOrder(removeDividendsOrderCommand)
controller.Response(data, err)
}
func (controller *DividendsOrderController) SearchDividendsOrder() {
dividendsOrderService := service.NewDividendsOrderService(nil)
searchDividendsOrderQuery := &query.SearchDividendsOrderQuery{}
data, err := dividendsOrderService.SearchDividendsOrder(searchDividendsOrderQuery)
controller.Response(data, err)
}
func (controller *DividendsOrderController) SearchDividendsOrderNumber() {
dividendsOrderService := service.NewDividendsOrderService(nil)
searchDividendsOrderNumberQuery := &query.SearchDividendsOrderNumberQuery{}
data, err := dividendsOrderService.SearchDividendsOrderNumber(searchDividendsOrderNumberQuery)
controller.Response(data, err)
}
func (controller *DividendsOrderController) ListDividendsOrders() {
dividendsOrderService := service.NewDividendsOrderService(nil)
listDividendsOrdersQuery := &query.ListDividendsOrdersQuery{}
offset, _ := controller.GetInt("offset")
listDividendsOrdersQuery.Offset = offset
limit, _ := controller.GetInt("limit")
listDividendsOrdersQuery.Limit = limit
data, err := dividendsOrderService.ListDividendsOrders(listDividendsOrdersQuery)
controller.Response(data, err)
}