product_calendar_controller.go
3.8 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
package controllers
import (
"github.com/linmadan/egglib-go/web/beego"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/application/productCalendar/command"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/application/productCalendar/query"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/application/productCalendar/service"
)
type ProductCalendarController struct {
beego.BaseController
}
func (controller *ProductCalendarController) CreateProductCalendar() {
productCalendarService := service.NewProductCalendarService(nil)
createProductCalendarCommand := &command.CreateProductCalendarCommand{}
Must(controller.Unmarshal(createProductCalendarCommand))
data, err := productCalendarService.CreateProductCalendar(ParseOperateInfo(controller.BaseController), createProductCalendarCommand)
controller.Response(data, err)
}
func (controller *ProductCalendarController) UpdateProductCalendar() {
productCalendarService := service.NewProductCalendarService(nil)
updateProductCalendarCommand := &command.UpdateProductCalendarCommand{}
Must(controller.Unmarshal(updateProductCalendarCommand))
productCalendarId, _ := controller.GetInt(":productCalendarId")
updateProductCalendarCommand.ProductCalendarId = productCalendarId
data, err := productCalendarService.UpdateProductCalendar(updateProductCalendarCommand)
controller.Response(data, err)
}
func (controller *ProductCalendarController) GetProductCalendar() {
productCalendarService := service.NewProductCalendarService(nil)
getProductCalendarQuery := &query.GetProductCalendarQuery{}
productCalendarId, _ := controller.GetInt(":productCalendarId")
getProductCalendarQuery.ProductCalendarId = productCalendarId
data, err := productCalendarService.GetProductCalendar(getProductCalendarQuery)
controller.Response(data, err)
}
func (controller *ProductCalendarController) RemoveProductCalendar() {
productCalendarService := service.NewProductCalendarService(nil)
removeProductCalendarCommand := &command.RemoveProductCalendarCommand{}
Must(controller.Unmarshal(removeProductCalendarCommand))
productCalendarId, _ := controller.GetInt(":productCalendarId")
removeProductCalendarCommand.ProductCalendarId = productCalendarId
data, err := productCalendarService.RemoveProductCalendar(removeProductCalendarCommand)
controller.Response(data, err)
}
func (controller *ProductCalendarController) BatchRemoveProductCalendar() {
productCalendarService := service.NewProductCalendarService(nil)
removeProductCalendarCommand := &command.BatchRemoveProductCalendarCommand{}
Must(controller.Unmarshal(removeProductCalendarCommand))
data, err := productCalendarService.BatchRemoveProductCalendar(removeProductCalendarCommand)
controller.Response(data, err)
}
func (controller *ProductCalendarController) ListProductCalendar() {
productCalendarService := service.NewProductCalendarService(nil)
listProductCalendarQuery := &query.ListProductCalendarQuery{}
offset, _ := controller.GetInt("offset")
listProductCalendarQuery.Offset = offset
limit, _ := controller.GetInt("limit")
listProductCalendarQuery.Limit = limit
data, err := productCalendarService.ListProductCalendar(listProductCalendarQuery)
controller.Response(data, err)
}
func (controller *ProductCalendarController) SearchProductCalendar() {
productCalendarService := service.NewProductCalendarService(nil)
cmd := &query.SearchProductCalendarQuery{}
Must(controller.Unmarshal(cmd))
operateInfo := ParseOperateInfo(controller.BaseController)
//cmd.OrgId = operateInfo.OrgId
cmd.CompanyId = operateInfo.CompanyId
cmd.InOrgIds = operateInfo.OrgIds
total, data, err := productCalendarService.SearchProductCalendar(ParseOperateInfo(controller.BaseController), cmd)
ResponseGrid(controller.BaseController, total, data, err)
}