reward_standard_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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
package controllers
import (
"github.com/linmadan/egglib-go/web/beego"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/application/rewardStandard/command"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/application/rewardStandard/query"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/application/rewardStandard/service"
)
type RewardStandardController struct {
beego.BaseController
}
//创建奖惩标准
func (c RewardStandardController) CreatedRewardStandard() {
srv := service.NewRewardStandardService(nil)
createCommand := &command.SaveRewardStandardCommand{}
Must(c.Unmarshal(createCommand))
operater := ParseOperateInfo(c.BaseController)
data, err := srv.SaveRewardStandard(operater, createCommand)
c.Response(data, err)
}
//更新奖惩标准
func (c RewardStandardController) UpdateRewardStandard() {
srv := service.NewRewardStandardService(nil)
createCommand := &command.SaveRewardStandardCommand{}
Must(c.Unmarshal(createCommand))
id, _ := c.GetInt(":id")
createCommand.Id = id
operater := ParseOperateInfo(c.BaseController)
data, err := srv.SaveRewardStandard(operater, createCommand)
c.Response(data, err)
}
//获取奖惩标准
func (c RewardStandardController) GetRewardStandard() {
srv := service.NewRewardStandardService(nil)
id, _ := c.GetInt(":id")
getQuery := &query.GetRewardStandard{
Id: id,
}
operater := ParseOperateInfo(c.BaseController)
data, err := srv.GetRewardStandard(operater, getQuery)
c.Response(data, err)
}
//删除奖惩标准
func (c RewardStandardController) DeleteRewardStandard() {
srv := service.NewRewardStandardService(nil)
getQuery := &query.GetRewardStandard{}
Must(c.Unmarshal(getQuery))
operater := ParseOperateInfo(c.BaseController)
data, err := srv.DeleteRewardStandard(operater, getQuery)
c.Response(data, err)
}
//列表展示奖惩标准
func (c RewardStandardController) ListRewardStandard() {
srv := service.NewRewardStandardService(nil)
cmd := &query.ListRewardStandard{}
Must(c.Unmarshal(cmd))
operateInfo := ParseOperateInfo(c.BaseController)
cmd.CompanyId = operateInfo.CompanyId
total, data, err := srv.ListRewardStandard(cmd)
ResponseGrid(c.BaseController, total, data, err)
}
//SaveRewardRule 保存奖惩规则
func (c RewardStandardController) SaveRewardRule() {
srv := service.NewRewardStandardService(nil)
createCommand := &command.SaveRewardRuleCommand{}
Must(c.Unmarshal(createCommand))
operater := ParseOperateInfo(c.BaseController)
data, err := srv.SaveRewardRule(operater, createCommand)
c.Response(data, err)
}
//GetRewardRule 获取奖惩规则
func (c RewardStandardController) GetRewardRule() {
srv := service.NewRewardStandardService(nil)
operater := ParseOperateInfo(c.BaseController)
data, err := srv.GetRewardRule(operater)
c.Response(data, err)
}