|
|
package web_client
|
|
|
|
|
|
import (
|
|
|
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/cooperationMode/command"
|
|
|
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/cooperationMode/query"
|
|
|
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/cooperationMode/service"
|
|
|
"strconv"
|
|
|
)
|
|
|
|
|
|
type CooperationModeController struct {
|
|
|
baseController
|
|
|
}
|
|
|
|
|
|
func (controller *CooperationModeController) CreateCooperationMode() {
|
|
|
svr := service.CooperationModeService{}
|
|
|
cmd := &command.CreateCooperationModeCommand{}
|
|
|
err := controller.Unmarshal(cmd)
|
|
|
if err != nil {
|
|
|
controller.Response(nil, err)
|
|
|
return
|
|
|
}
|
|
|
cmd.Operator = controller.GetOperator()
|
|
|
data, err := svr.CreateCooperationMode(cmd)
|
|
|
controller.Response(data, err)
|
|
|
}
|
|
|
|
|
|
func (controller *CooperationModeController) UpdateCooperationMode() {
|
|
|
svr := service.CooperationModeService{}
|
|
|
cmd := &command.UpdateCooperationModeCommand{}
|
|
|
err := controller.Unmarshal(cmd)
|
|
|
if err != nil {
|
|
|
controller.Response(nil, err)
|
|
|
return
|
|
|
}
|
|
|
cooperationModeId := controller.GetString(":cooperationModeId")
|
|
|
cmd.CooperationModeId, _ = strconv.Atoi(cooperationModeId)
|
|
|
cmd.Operator = controller.GetOperator()
|
|
|
data, err := svr.UpdateCooperationMode(cmd)
|
|
|
controller.Response(data, err)
|
|
|
}
|
|
|
|
|
|
func (controller *CooperationModeController) GetCooperationMode() {
|
|
|
svr := service.CooperationModeService{}
|
|
|
cmd := &query.GetCooperationModeQuery{}
|
|
|
err := controller.Unmarshal(cmd)
|
|
|
if err != nil {
|
|
|
controller.Response(nil, err)
|
|
|
return
|
|
|
}
|
|
|
cooperationModeId := controller.GetString(":cooperationModeId")
|
|
|
cmd.CooperationModeId, _ = strconv.Atoi(cooperationModeId)
|
|
|
cmd.Operator = controller.GetOperator()
|
|
|
data, err := svr.GetCooperationMode(cmd)
|
|
|
controller.Response(data, err)
|
|
|
}
|
|
|
|
|
|
func (controller *CooperationModeController) RemoveCooperationMode() {
|
|
|
svr := service.CooperationModeService{}
|
|
|
cmd := &command.RemoveCooperationModeCommand{}
|
|
|
err := controller.Unmarshal(cmd)
|
|
|
if err != nil {
|
|
|
controller.Response(nil, err)
|
|
|
return
|
|
|
}
|
|
|
cooperationModeId := controller.GetString(":cooperationModeId")
|
|
|
cmd.CooperationModeId, _ = strconv.Atoi(cooperationModeId)
|
|
|
cmd.Operator = controller.GetOperator()
|
|
|
data, err := svr.RemoveCooperationMode(cmd)
|
|
|
controller.Response(data, err)
|
|
|
}
|
|
|
|
|
|
func (controller *CooperationModeController) SearchCooperationMode() {
|
|
|
svr := service.CooperationModeService{}
|
|
|
cmd := &query.ListCooperationModeQuery{}
|
|
|
err := controller.Unmarshal(cmd)
|
|
|
if err != nil {
|
|
|
controller.Response(nil, err)
|
|
|
return
|
|
|
}
|
|
|
cmd.Operator = controller.GetOperator()
|
|
|
cnt, data, err := svr.ListCooperationMode(cmd)
|
|
|
controller.returnPageListData(cnt, data, err, cmd.PageNumber)
|
|
|
}
|
|
|
|
|
|
func (controller *CooperationModeController) ListCooperationMode() {
|
|
|
svr := service.CooperationModeService{}
|
|
|
cmd := &query.ListCooperationModeQuery{}
|
|
|
err := controller.Unmarshal(cmd)
|
|
|
if err != nil {
|
|
|
controller.Response(nil, err)
|
|
|
return
|
|
|
}
|
|
|
cmd.Operator = controller.GetOperator()
|
|
|
_, data, err := svr.ListCooperationMode(cmd)
|
|
|
controller.Response(data, err)
|
|
|
} |
...
|
...
|
|