log_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
package controllers
import (
"github.com/linmadan/egglib-go/web/beego"
"gitlab.fjmaimaimai.com/allied-creation/character-library-metadata-bastion/pkg/application/log/command"
"gitlab.fjmaimaimai.com/allied-creation/character-library-metadata-bastion/pkg/application/log/query"
"gitlab.fjmaimaimai.com/allied-creation/character-library-metadata-bastion/pkg/application/log/service"
"gitlab.fjmaimaimai.com/allied-creation/character-library-metadata-bastion/pkg/domain"
)
type LogController struct {
beego.BaseController
}
func (controller *LogController) CreateLog() {
logService := service.NewLogService(nil)
createLogCommand := &command.CreateLogCommand{}
controller.Unmarshal(createLogCommand)
data, err := logService.CreateLog(createLogCommand)
controller.Response(data, err)
}
func (controller *LogController) UpdateLog() {
logService := service.NewLogService(nil)
updateLogCommand := &command.UpdateLogCommand{}
controller.Unmarshal(updateLogCommand)
logId, _ := controller.GetInt(":logId")
updateLogCommand.LogId = logId
data, err := logService.UpdateLog(updateLogCommand)
controller.Response(data, err)
}
func (controller *LogController) GetLog() {
logService := service.NewLogService(nil)
getLogQuery := &query.GetLogQuery{}
logId, _ := controller.GetInt(":logId")
getLogQuery.LogId = logId
data, err := logService.GetLog(getLogQuery)
controller.Response(data, err)
}
func (controller *LogController) RemoveLog() {
logService := service.NewLogService(nil)
removeLogCommand := &command.RemoveLogCommand{}
controller.Unmarshal(removeLogCommand)
logId, _ := controller.GetInt(":logId")
removeLogCommand.LogId = logId
data, err := logService.RemoveLog(removeLogCommand)
controller.Response(data, err)
}
func (controller *LogController) ListLog() {
logService := service.NewLogService(nil)
listLogQuery := &query.ListLogQuery{}
offset, _ := controller.GetInt("offset")
listLogQuery.Offset = offset
limit, _ := controller.GetInt("limit")
listLogQuery.Limit = limit
data, err := logService.ListLog(listLogQuery)
controller.Response(data, err)
}
func (controller *LogController) SearchLog() {
logService := service.NewLogService(nil)
cmd := &command.SearchLogCommand{}
controller.Unmarshal(cmd)
cmd.Context = ParseContext(controller.BaseController)
total, data, err := logService.SearchLog(cmd)
ResponseGrid(controller.BaseController, total, data, err)
}
func (controller *LogController) TableOperateLog() {
logService := service.NewLogService(nil)
cmd := &command.SearchLogCommand{}
controller.Unmarshal(cmd)
cmd.LogType = domain.CommonLog.ToString()
cmd.SortByLogId = "DESC"
cmd.Context = ParseContext(controller.BaseController)
total, data, err := logService.SearchLog(cmd)
ResponseGrid(controller.BaseController, total, data, err)
}
func (controller *LogController) VerifiedStepLog() {
logService := service.NewLogService(nil)
cmd := &command.SearchLogCommand{}
controller.Unmarshal(cmd)
cmd.Context = ParseContext(controller.BaseController)
_, data, err := logService.VerifiedStepLog(cmd)
controller.Response(data, err)
}