cooperation_project_controller.go
3.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
package web_client
import (
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/cooperationProject/command"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/cooperationProject/query"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/cooperationProject/service"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/log"
)
type CooperationProjectController struct {
baseController
}
func (controller *CooperationProjectController) CreateCooperationProject() {
cooperationProjectService := service.NewCooperationProjectService(nil)
createCooperationProjectCommand := &command.CreateCooperationProjectCommand{}
err := controller.Unmarshal(createCooperationProjectCommand)
if err != nil {
log.Logger.Debug("json err:" + err.Error())
}
createCooperationProjectCommand.Operator = controller.GetOperator()
data, err := cooperationProjectService.CreateCooperationProject(createCooperationProjectCommand)
controller.Response(data, err)
}
func (controller *CooperationProjectController) UpdateCooperationProject() {
cooperationProjectService := service.NewCooperationProjectService(nil)
updateCooperationProjectCommand := &command.UpdateCooperationProjectCommand{}
err := controller.Unmarshal(updateCooperationProjectCommand)
if err != nil {
log.Logger.Debug("json err:" + err.Error())
}
projectId := controller.GetString(":projectId")
updateCooperationProjectCommand.CooperationProjectId = projectId
updateCooperationProjectCommand.Operator = controller.GetOperator()
data, err := cooperationProjectService.UpdateCooperationProject(updateCooperationProjectCommand)
controller.Response(data, err)
}
func (controller *CooperationProjectController) GetCooperationProject() {
cooperationProjectService := service.NewCooperationProjectService(nil)
getCooperationProjectQuery := &query.GetCooperationProjectQuery{}
projectId, _ := controller.GetInt(":projectId")
getCooperationProjectQuery.CooperationProjectId = projectId
getCooperationProjectQuery.Operator = controller.GetOperator()
data, err := cooperationProjectService.GetCooperationProject(getCooperationProjectQuery)
controller.Response(data, err)
}
func (controller *CooperationProjectController) ListCooperationProject() {
cooperationProjectService := service.NewCooperationProjectService(nil)
listCooperationProjectQuery := &query.ListCooperationProjectQuery{}
err := controller.Unmarshal(listCooperationProjectQuery)
if err != nil {
log.Logger.Debug("json err:" + err.Error())
}
listCooperationProjectQuery.Operator = controller.GetOperator()
cnt, data, err := cooperationProjectService.ListCooperationProject(listCooperationProjectQuery)
controller.returnPageListData(cnt, data, err, listCooperationProjectQuery.PageNumber)
}
func (controller *CooperationProjectController) EndCooperationProject() {
cooperationProjectService := service.NewCooperationProjectService(nil)
endCooperationProjectCommand := &command.EndCooperationProjectCommand{}
controller.Unmarshal(endCooperationProjectCommand)
//TODO
endCooperationProjectCommand.Operator = controller.GetOperator()
data, err := cooperationProjectService.EndCooperationProject(endCooperationProjectCommand)
controller.Response(data, err)
}