roles_controller.go
5.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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
package web_client
import (
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/roles/command"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/roles/query"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/roles/service"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/log"
)
type RolesController struct {
baseController
}
func (controller *RolesController) RoleAdd() {
rolesService := service.NewRolesService(nil)
roleAddCommand := &command.RoleAddCommand{}
err := controller.Unmarshal(roleAddCommand)
if err != nil {
log.Logger.Debug("json err:" + err.Error())
}
roleAddCommand.Operator = controller.GetOperator()
data, err := rolesService.RoleAdd(roleAddCommand)
controller.Response(data, err)
}
func (controller *RolesController) RoleUpdate() {
rolesService := service.NewRolesService(nil)
roleUpdateCommand := &command.RoleUpdateCommand{}
err := controller.Unmarshal(roleUpdateCommand)
if err != nil {
log.Logger.Debug("json err:" + err.Error())
}
roleId := controller.GetString(":roleId")
roleUpdateCommand.RoleId = roleId
roleUpdateCommand.Operator = controller.GetOperator()
data, err := rolesService.RoleEdit(roleUpdateCommand)
controller.Response(data, err)
}
func (controller *RolesController) RoleList() {
rolesService := service.NewRolesService(nil)
roleListQuery := &query.RoleListQuery{}
err := controller.Unmarshal(roleListQuery)
if err != nil {
log.Logger.Debug("json err:" + err.Error())
}
roleListQuery.Operator = controller.GetOperator()
cnt, data, err := rolesService.RoleList(roleListQuery)
controller.ReturnPageListData(cnt, data, err, roleListQuery.PageNumber)
}
func (controller *RolesController) RoleGet() {
rolesService := service.NewRolesService(nil)
roleGetQuery := &query.RoleGetQuery{}
roleId := controller.GetString(":roleId")
roleGetQuery.RoleId = roleId
roleGetQuery.Operator = controller.GetOperator()
data, err := rolesService.RoleGet(roleGetQuery)
controller.Response(data, err)
}
func (controller *RolesController) RoleUserInfo() {
rolesService := service.NewRolesService(nil)
roleUserInfoQuery := &query.RoleUserInfoQuery{}
roleId, _ := controller.GetInt64(":roleId")
roleUserInfoQuery.RoleId = roleId
roleUserInfoQuery.Operator = controller.GetOperator()
data, err := rolesService.RoleUserInfo(roleUserInfoQuery)
controller.Response(data, err)
}
func (controller *RolesController) RoleUserAdd() {
rolesService := service.NewRolesService(nil)
roleUserAddQuery := &command.RoleUserAddCommand{}
err := controller.Unmarshal(roleUserAddQuery)
if err != nil {
log.Logger.Debug("json err:" + err.Error())
}
roleUserAddQuery.Operator = controller.GetOperator()
data, err := rolesService.RoleUserAdd(roleUserAddQuery)
controller.Response(data, err)
}
func (controller *RolesController) RoleUserDelete() {
rolesService := service.NewRolesService(nil)
roleUserDeleteQuery := &command.RoleUserDeleteCommand{}
err := controller.Unmarshal(roleUserDeleteQuery)
if err != nil {
log.Logger.Debug("json err:" + err.Error())
}
roleUserDeleteQuery.Operator = controller.GetOperator()
data, err := rolesService.RoleUserDelete(roleUserDeleteQuery)
controller.Response(data, err)
}
func (controller *RolesController) RoleUserBeforeEdit() {
rolesService := service.NewRolesService(nil)
roleUserBeforeEditQuery := &query.RoleUserBeforeEditQuery{}
roleUserBeforeEditQuery.Operator = controller.GetOperator()
roleId := controller.GetString("roleId")
roleUserBeforeEditQuery.RoleId = roleId
data, err := rolesService.RoleUserBeforeEdit(roleUserBeforeEditQuery)
controller.Response(data, err)
}
func (controller *RolesController) RoleMenuBeforeEdit() {
rolesService := service.NewRolesService(nil)
roleMenuBeforeEditQuery := &query.RoleMenuBeforeEditQuery{}
roleMenuBeforeEditQuery.Operator = controller.GetOperator()
err := controller.Unmarshal(roleMenuBeforeEditQuery)
if err != nil {
log.Logger.Debug("json err:" + err.Error())
}
roleId := controller.GetString(":roleId")
roleMenuBeforeEditQuery.RoleId = roleId
data, err := rolesService.RoleMenuBeforeEdit(roleMenuBeforeEditQuery)
controller.Response(data, err)
}
func (controller *RolesController) RoleMenuEdit() {
rolesService := service.NewRolesService(nil)
roleMenuEditQuery := &command.RoleMenuEditCommand{}
err := controller.Unmarshal(roleMenuEditQuery)
if err != nil {
log.Logger.Debug("json err:" + err.Error())
}
roleId := controller.GetString(":roleId")
roleMenuEditQuery.RoleId = roleId
roleMenuEditQuery.Operator = controller.GetOperator()
data, err := rolesService.RoleMenuEdit(roleMenuEditQuery)
controller.Response(data, err)
}
func (controller *RolesController) RoleDelete() {
rolesService := service.NewRolesService(nil)
roleRemoveCommand := &command.RoleRemoveCommand{}
err := controller.Unmarshal(roleRemoveCommand)
if err != nil {
log.Logger.Debug("json err:" + err.Error())
}
roleRemoveCommand.Operator = controller.GetOperator()
data, err := rolesService.RoleRemove(roleRemoveCommand)
controller.Response(data, err)
}