...
|
...
|
@@ -4,7 +4,7 @@ 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"
|
|
|
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/log"
|
|
|
)
|
|
|
|
|
|
type CooperationModeController struct {
|
...
|
...
|
@@ -12,85 +12,59 @@ type CooperationModeController struct { |
|
|
}
|
|
|
|
|
|
func (controller *CooperationModeController) CreateCooperationMode() {
|
|
|
svr := service.CooperationModeService{}
|
|
|
cmd := &command.CreateCooperationModeCommand{}
|
|
|
err := controller.Unmarshal(cmd)
|
|
|
cooperationModeService := service.NewCooperationModeService(nil)
|
|
|
createCooperationModeCommand := &command.CreateCooperationModeCommand{}
|
|
|
err := controller.Unmarshal(createCooperationModeCommand)
|
|
|
if err != nil {
|
|
|
controller.Response(nil, err)
|
|
|
return
|
|
|
log.Logger.Debug("json err:" + err.Error())
|
|
|
}
|
|
|
cmd.Operator = controller.GetOperator()
|
|
|
data, err := svr.CreateCooperationMode(cmd)
|
|
|
createCooperationModeCommand.Operator = controller.GetOperator()
|
|
|
data, err := cooperationModeService.CreateCooperationMode(createCooperationModeCommand)
|
|
|
controller.Response(data, err)
|
|
|
}
|
|
|
|
|
|
func (controller *CooperationModeController) UpdateCooperationMode() {
|
|
|
svr := service.CooperationModeService{}
|
|
|
cmd := &command.UpdateCooperationModeCommand{}
|
|
|
err := controller.Unmarshal(cmd)
|
|
|
cooperationModeService := service.NewCooperationModeService(nil)
|
|
|
updateCooperationModeCommand := &command.UpdateCooperationModeCommand{}
|
|
|
err := controller.Unmarshal(updateCooperationModeCommand)
|
|
|
if err != nil {
|
|
|
controller.Response(nil, err)
|
|
|
return
|
|
|
log.Logger.Debug("json err:" + err.Error())
|
|
|
}
|
|
|
cooperationModeId := controller.GetString(":cooperationModeId")
|
|
|
cmd.CooperationModeId, _ = strconv.Atoi(cooperationModeId)
|
|
|
cmd.Operator = controller.GetOperator()
|
|
|
data, err := svr.UpdateCooperationMode(cmd)
|
|
|
modeId, _ := controller.GetInt(":modeId")
|
|
|
updateCooperationModeCommand.Operator = controller.GetOperator()
|
|
|
updateCooperationModeCommand.CooperationModeId = modeId
|
|
|
data, err := cooperationModeService.UpdateCooperationMode(updateCooperationModeCommand)
|
|
|
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)
|
|
|
cooperationModeService := service.NewCooperationModeService(nil)
|
|
|
getCooperationModeQuery := &query.GetCooperationModeQuery{}
|
|
|
modeId, _ := controller.GetInt(":modeId")
|
|
|
getCooperationModeQuery.CooperationModeId = modeId
|
|
|
getCooperationModeQuery.Operator = controller.GetOperator()
|
|
|
data, err := cooperationModeService.GetCooperationMode(getCooperationModeQuery)
|
|
|
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)
|
|
|
cooperationModeService := service.NewCooperationModeService(nil)
|
|
|
removeCooperationModeCommand := &command.RemoveCooperationModeCommand{}
|
|
|
modeId, _ := controller.GetInt(":modeId")
|
|
|
removeCooperationModeCommand.Operator = controller.GetOperator()
|
|
|
removeCooperationModeCommand.CooperationModeId = modeId
|
|
|
data, err := cooperationModeService.RemoveCooperationMode(removeCooperationModeCommand)
|
|
|
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)
|
|
|
cooperationModeService := service.NewCooperationModeService(nil)
|
|
|
listCooperationModeQuery := &query.ListCooperationModeQuery{}
|
|
|
err := controller.Unmarshal(listCooperationModeQuery)
|
|
|
if err != nil {
|
|
|
controller.Response(nil, err)
|
|
|
return
|
|
|
log.Logger.Debug("json err:" + err.Error())
|
|
|
}
|
|
|
cmd.Operator = controller.GetOperator()
|
|
|
_, data, err := svr.ListCooperationMode(cmd)
|
|
|
controller.Response(data, err)
|
|
|
listCooperationModeQuery.Operator = controller.GetOperator()
|
|
|
cnt, data, err := cooperationModeService.ListCooperationMode(listCooperationModeQuery)
|
|
|
controller.returnPageListData(cnt, data, err, listCooperationModeQuery.PageNumber)
|
|
|
} |
...
|
...
|
|