orgs_controller.go
2.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
package web_client
import (
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/orgs/command"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/orgs/query"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/orgs/service"
)
type OrgsController struct {
baseController
}
func (controller *OrgsController) OrgAdd() {
orgsService := service.NewOrgsService(nil)
orgAddCommand := &command.OrgAddCommand{}
controller.Unmarshal(orgAddCommand)
orgAddCommand.Operator = controller.GetOperator()
data, err := orgsService.OrgAdd(orgAddCommand)
controller.Response(data, err)
}
func (controller *OrgsController) OrgUpdate() {
orgsService := service.NewOrgsService(nil)
orgUpdateCommand := &command.OrgUpdateCommand{}
controller.Unmarshal(orgUpdateCommand)
orgId := controller.GetString(":orgId")
orgUpdateCommand.OrgId = orgId
orgUpdateCommand.Operator = controller.GetOperator()
data, err := orgsService.OrgUpdate(orgUpdateCommand)
controller.Response(data, err)
}
func (controller *OrgsController) OrgList() {
orgsService := service.NewOrgsService(nil)
orgListQuery := &query.OrgListQuery{}
controller.Unmarshal(orgListQuery)
orgListQuery.Operator = controller.GetOperator()
data, err := orgsService.OrgList(orgListQuery)
controller.Response(data, err)
}
func (controller *OrgsController) OrgGet() {
orgsService := service.NewOrgsService(nil)
orgGetQuery := &query.OrgGetQuery{}
orgId := controller.GetString(":orgId")
orgGetQuery.OrgId = orgId
orgGetQuery.Operator = controller.GetOperator()
data, err := orgsService.OrgGet(orgGetQuery)
controller.Response(data, err)
}
func (controller *OrgsController) OrgEnable() {
orgsService := service.NewOrgsService(nil)
orgEnableCommand := &command.OrgEnableCommand{}
controller.Unmarshal(orgEnableCommand)
orgEnableCommand.Operator = controller.GetOperator()
data, err := orgsService.OrgEnable(orgEnableCommand)
controller.Response(data, err)
}
func (controller *OrgsController) OrgGetSubDepartment() {
orgsService := service.NewOrgsService(nil)
orgGetSubDepartmentQuery := &query.OrgGetSubDepartmentQuery{}
controller.Unmarshal(orgGetSubDepartmentQuery)
orgGetSubDepartmentQuery.Operator = controller.GetOperator()
data, err := orgsService.OrgGetSubDepartment(orgGetSubDepartmentQuery)
controller.Response(data, err)
}