product_job_controller.go
2.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
package controllers
import (
"github.com/linmadan/egglib-go/web/beego"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/application/productJob/command"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/application/productJob/query"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/application/productJob/service"
)
type ProductJobController struct {
beego.BaseController
}
func (controller *ProductJobController) CreateProductJob() {
productJobService := service.NewProductJobService(nil)
createProductJobCommand := &command.CreateProductJobCommand{}
controller.Unmarshal(createProductJobCommand)
data, err := productJobService.CreateProductJob(ParseOperateInfo(controller.BaseController), createProductJobCommand)
controller.Response(data, err)
}
func (controller *ProductJobController) UpdateProductJob() {
productJobService := service.NewProductJobService(nil)
updateProductJobCommand := &command.UpdateProductJobCommand{}
controller.Unmarshal(updateProductJobCommand)
productJobId, _ := controller.GetInt(":productJobId")
updateProductJobCommand.ProductJobId = productJobId
data, err := productJobService.UpdateProductJob(updateProductJobCommand)
controller.Response(data, err)
}
func (controller *ProductJobController) GetProductJob() {
productJobService := service.NewProductJobService(nil)
getProductJobQuery := &query.GetProductJobQuery{}
productJobId, _ := controller.GetInt(":productJobId")
getProductJobQuery.ProductJobId = productJobId
data, err := productJobService.GetProductJob(getProductJobQuery)
controller.Response(data, err)
}
func (controller *ProductJobController) RemoveProductJob() {
productJobService := service.NewProductJobService(nil)
removeProductJobCommand := &command.RemoveProductJobCommand{}
controller.Unmarshal(removeProductJobCommand)
productJobId, _ := controller.GetInt(":productJobId")
removeProductJobCommand.ProductJobId = productJobId
data, err := productJobService.RemoveProductJob(removeProductJobCommand)
controller.Response(data, err)
}
func (controller *ProductJobController) ListProductJob() {
productJobService := service.NewProductJobService(nil)
listProductJobQuery := &query.ListProductJobQuery{}
offset, _ := controller.GetInt("offset")
listProductJobQuery.Offset = offset
limit, _ := controller.GetInt("limit")
listProductJobQuery.Limit = limit
data, err := productJobService.ListProductJob(listProductJobQuery)
controller.Response(data, err)
}
func (controller *ProductJobController) SearchProductJob() {
productJobService := service.NewProductJobService(nil)
listProductJobQuery := &query.SearchProductJobQuery{}
controller.Unmarshal(listProductJobQuery)
total, data, err := productJobService.SearchProductJob(ParseOperateInfo(controller.BaseController), listProductJobQuery)
ResponseGrid(controller.BaseController, total, data, err)
}