roles_controller.go
4.3 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
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"
)
type RolesController struct {
baseController
}
func (controller *RolesController) RoleAdd() {
rolesService := service.NewRolesService(nil)
roleAddCommand := &command.RoleAddCommand{}
controller.Unmarshal(roleAddCommand)
roleAddCommand.Operator = controller.GetOperator()
data, err := rolesService.RoleAdd(roleAddCommand)
controller.Response(data, err)
}
func (controller *RolesController) RoleUpdate() {
rolesService := service.NewRolesService(nil)
roleUpdateCommand := &command.RoleUpdateCommand{}
controller.Unmarshal(roleUpdateCommand)
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{}
controller.Unmarshal(roleListQuery)
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{}
controller.Unmarshal(roleUserAddQuery)
roleUserAddQuery.Operator = controller.GetOperator()
data, err := rolesService.RoleUserAdd(roleUserAddQuery)
controller.Response(data, err)
}
func (controller *RolesController) RoleUserDelete() {
rolesService := service.NewRolesService(nil)
roleUserDeleteQuery := &command.RoleUserDeleteCommand{}
controller.Unmarshal(roleUserDeleteQuery)
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()
controller.Unmarshal(roleMenuBeforeEditQuery)
data, err := rolesService.RoleMenuBeforeEdit(roleMenuBeforeEditQuery)
controller.Response(data, err)
}
func (controller *RolesController) RoleMenuEdit() {
rolesService := service.NewRolesService(nil)
roleMenuEditQuery := &command.RoleMenuEditCommand{}
controller.Unmarshal(roleMenuEditQuery)
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{}
controller.Unmarshal(roleRemoveCommand)
roleRemoveCommand.Operator = controller.GetOperator()
data, err := rolesService.RoleRemove(roleRemoveCommand)
controller.Response(data, err)
}