credit_account_controller.go
5.2 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
package controllers
import (
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/application/creditAccount/command"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/application/creditAccount/query"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/application/creditAccount/service"
)
type CreditAccountController struct {
BaseController
}
func (controller *CreditAccountController) CreateCreditAccount() {
creditAccountService := service.NewCreditAccountService(nil)
createCreditAccountCommand := &command.CreateCreditAccountCommand{}
_ = controller.Unmarshal(createCreditAccountCommand)
// 解析头部信息
header := controller.GetRequestHeader(controller.Ctx)
createCreditAccountCommand.CompanyId = header.CompanyId
createCreditAccountCommand.OrgId = header.OrgId
createCreditAccountCommand.UserId = header.UserId
createCreditAccountCommand.UserBaseId = header.UserBaseId
data, err := creditAccountService.CreateCreditAccount(createCreditAccountCommand)
controller.Response(data, err)
}
func (controller *CreditAccountController) UpdateCreditAccount() {
creditAccountService := service.NewCreditAccountService(nil)
updateCreditAccountCommand := &command.UpdateCreditAccountCommand{}
_ = controller.Unmarshal(updateCreditAccountCommand)
// 解析头部信息
header := controller.GetRequestHeader(controller.Ctx)
updateCreditAccountCommand.CompanyId = header.CompanyId
updateCreditAccountCommand.OrgId = header.OrgId
updateCreditAccountCommand.UserId = header.UserId
updateCreditAccountCommand.UserBaseId = header.UserBaseId
creditAccountId, _ := controller.GetInt64(":creditAccountId")
updateCreditAccountCommand.CreditAccountId = creditAccountId
data, err := creditAccountService.UpdateCreditAccount(updateCreditAccountCommand)
controller.Response(data, err)
}
func (controller *CreditAccountController) GetCreditAccount() {
creditAccountService := service.NewCreditAccountService(nil)
getCreditAccountQuery := &query.GetCreditAccountQuery{}
// 解析头部信息
header := controller.GetRequestHeader(controller.Ctx)
getCreditAccountQuery.CompanyId = header.CompanyId
getCreditAccountQuery.OrgId = header.OrgId
getCreditAccountQuery.UserId = header.UserId
getCreditAccountQuery.UserBaseId = header.UserBaseId
creditAccountId, _ := controller.GetInt64(":creditAccountId")
getCreditAccountQuery.CreditAccountId = creditAccountId
data, err := creditAccountService.GetCreditAccount(getCreditAccountQuery)
controller.Response(data, err)
}
func (controller *CreditAccountController) RemoveCreditAccount() {
creditAccountService := service.NewCreditAccountService(nil)
removeCreditAccountCommand := &command.RemoveCreditAccountCommand{}
_ = controller.Unmarshal(removeCreditAccountCommand)
// 解析头部信息
header := controller.GetRequestHeader(controller.Ctx)
removeCreditAccountCommand.CompanyId = header.CompanyId
removeCreditAccountCommand.OrgId = header.OrgId
removeCreditAccountCommand.UserId = header.UserId
removeCreditAccountCommand.UserBaseId = header.UserBaseId
creditAccountId, _ := controller.GetInt64(":creditAccountId")
removeCreditAccountCommand.CreditAccountId = creditAccountId
data, err := creditAccountService.RemoveCreditAccount(removeCreditAccountCommand)
controller.Response(data, err)
}
func (controller *CreditAccountController) SearchCreditAccount() {
creditAccountService := service.NewCreditAccountService(nil)
searchCreditAccountQuery := &query.SearchCreditAccountQuery{}
// 解析头部信息
header := controller.GetRequestHeader(controller.Ctx)
searchCreditAccountQuery.CompanyId = header.CompanyId
searchCreditAccountQuery.OrgId = header.OrgId
searchCreditAccountQuery.UserId = header.UserId
searchCreditAccountQuery.UserBaseId = header.UserBaseId
data, err := creditAccountService.SearchCreditAccount(searchCreditAccountQuery)
controller.Response(data, err)
}
func (controller *CreditAccountController) PayCreditAccount() {
creditAccountService := service.NewCreditAccountService(nil)
payCreditAccountCommand := &command.PayCreditAccountCommand{}
_ = controller.Unmarshal(payCreditAccountCommand)
// 解析头部信息
header := controller.GetRequestHeader(controller.Ctx)
payCreditAccountCommand.CompanyId = header.CompanyId
payCreditAccountCommand.OrgId = header.OrgId
payCreditAccountCommand.UserId = header.UserId
payCreditAccountCommand.UserBaseId = header.UserBaseId
data, err := creditAccountService.PayCreditAccount(payCreditAccountCommand)
controller.Response(data, err)
}
func (controller *CreditAccountController) ListCreditAccount() {
creditAccountService := service.NewCreditAccountService(nil)
listCreditAccountQuery := &query.ListCreditAccountQuery{}
// 解析头部信息
header := controller.GetRequestHeader(controller.Ctx)
listCreditAccountQuery.CompanyId = header.CompanyId
listCreditAccountQuery.OrgId = header.OrgId
listCreditAccountQuery.UserId = header.UserId
listCreditAccountQuery.UserBaseId = header.UserBaseId
pageSize, _ := controller.GetInt64("pageSize")
listCreditAccountQuery.PageSize = pageSize
pageNumber, _ := controller.GetInt64("pageNumber")
listCreditAccountQuery.PageNumber = pageNumber
data, err := creditAccountService.ListCreditAccount(listCreditAccountQuery)
controller.Response(data, err)
}