contract_undertaker_feedback_controller.go 3.9 KB
package controllers

import (
	"github.com/linmadan/egglib-go/web/beego"
	"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/application/contractUndertakerFeedback/command"
	"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/application/contractUndertakerFeedback/query"
	"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/application/contractUndertakerFeedback/service"
)

type ContractUndertakerFeedbackController struct {
	beego.BaseController
}

func (controller *ContractUndertakerFeedbackController) CreateContractUndertakerFeedback() {
	contractUndertakerFeedbackService := service.NewContractUndertakerFeedbackService(nil)
	createContractUndertakerFeedbackCommand := &command.CreateContractUndertakerFeedbackCommand{}
	controller.Unmarshal(createContractUndertakerFeedbackCommand)
	data, err := contractUndertakerFeedbackService.CreateContractUndertakerFeedback(createContractUndertakerFeedbackCommand)
	controller.Response(data, err)
}

func (controller *ContractUndertakerFeedbackController) UpdateContractUndertakerFeedback() {
	contractUndertakerFeedbackService := service.NewContractUndertakerFeedbackService(nil)
	updateContractUndertakerFeedbackCommand := &command.UpdateContractUndertakerFeedbackCommand{}
	controller.Unmarshal(updateContractUndertakerFeedbackCommand)
	contractUndertakerFeedbackId, _ := controller.GetString(":contractUndertakerFeedbackId")
	updateContractUndertakerFeedbackCommand.ContractUndertakerFeedbackId = contractUndertakerFeedbackId
	data, err := contractUndertakerFeedbackService.UpdateContractUndertakerFeedback(updateContractUndertakerFeedbackCommand)
	controller.Response(data, err)
}

func (controller *ContractUndertakerFeedbackController) GetContractUndertakerFeedback() {
	contractUndertakerFeedbackService := service.NewContractUndertakerFeedbackService(nil)
	getContractUndertakerFeedbackQuery := &query.GetContractUndertakerFeedbackQuery{}
	contractUndertakerFeedbackId, _ := controller.GetString(":contractUndertakerFeedbackId")
	getContractUndertakerFeedbackQuery.ContractUndertakerFeedbackId = contractUndertakerFeedbackId
	data, err := contractUndertakerFeedbackService.GetContractUndertakerFeedback(getContractUndertakerFeedbackQuery)
	controller.Response(data, err)
}

func (controller *ContractUndertakerFeedbackController) RemoveContractUndertakerFeedback() {
	contractUndertakerFeedbackService := service.NewContractUndertakerFeedbackService(nil)
	removeContractUndertakerFeedbackCommand := &command.RemoveContractUndertakerFeedbackCommand{}
	controller.Unmarshal(removeContractUndertakerFeedbackCommand)
	contractUndertakerFeedbackId, _ := controller.GetString(":contractUndertakerFeedbackId")
	removeContractUndertakerFeedbackCommand.ContractUndertakerFeedbackId = contractUndertakerFeedbackId
	data, err := contractUndertakerFeedbackService.RemoveContractUndertakerFeedback(removeContractUndertakerFeedbackCommand)
	controller.Response(data, err)
}

func (controller *ContractUndertakerFeedbackController) SearchContractUndertakerFeedback() {
	contractUndertakerFeedbackService := service.NewContractUndertakerFeedbackService(nil)
	searchContractUndertakerFeedbackQuery := &query.SearchContractUndertakerFeedbackQuery{}
	data, err := contractUndertakerFeedbackService.SearchContractUndertakerFeedback(searchContractUndertakerFeedbackQuery)
	controller.Response(data, err)
}

func (controller *ContractUndertakerFeedbackController) ListContractUndertakerFeedback() {
	contractUndertakerFeedbackService := service.NewContractUndertakerFeedbackService(nil)
	listContractUndertakerFeedbackQuery := &query.ListContractUndertakerFeedbackQuery{}
	offset, _ := controller.GetInt("offset")
	listContractUndertakerFeedbackQuery.Offset = offset
	limit, _ := controller.GetInt("limit")
	listContractUndertakerFeedbackQuery.Limit = limit
	data, err := contractUndertakerFeedbackService.ListContractUndertakerFeedback(listContractUndertakerFeedbackQuery)
	controller.Response(data, err)
}