contract_undertaker_feedback_controller.go 5.9 KB
package controllers

import (
	"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 {
	BaseController
}

func (controller *ContractUndertakerFeedbackController) CreateContractUndertakerFeedback() {
	contractUndertakerFeedbackService := service.NewContractUndertakerFeedbackService(nil)
	createContractUndertakerFeedbackCommand := &command.CreateContractUndertakerFeedbackCommand{}
	_ = controller.Unmarshal(createContractUndertakerFeedbackCommand)
	header := controller.GetRequestHeader(controller.Ctx)
	createContractUndertakerFeedbackCommand.CompanyId = header.CompanyId
	createContractUndertakerFeedbackCommand.OrgId = header.OrgId
	createContractUndertakerFeedbackCommand.UserId = header.UserId
	createContractUndertakerFeedbackCommand.UserBaseId = header.UserBaseId
	data, err := contractUndertakerFeedbackService.CreateContractUndertakerFeedback(createContractUndertakerFeedbackCommand)
	controller.Response(data, err)
}

func (controller *ContractUndertakerFeedbackController) UpdateContractUndertakerFeedback() {
	contractUndertakerFeedbackService := service.NewContractUndertakerFeedbackService(nil)
	updateContractUndertakerFeedbackCommand := &command.UpdateContractUndertakerFeedbackCommand{}
	_ = controller.Unmarshal(updateContractUndertakerFeedbackCommand)
	header := controller.GetRequestHeader(controller.Ctx)
	updateContractUndertakerFeedbackCommand.CompanyId = header.CompanyId
	updateContractUndertakerFeedbackCommand.OrgId = header.OrgId
	updateContractUndertakerFeedbackCommand.UserId = header.UserId
	updateContractUndertakerFeedbackCommand.UserBaseId = header.UserBaseId
	contractUndertakerFeedbackId := controller.GetString(":contractUndertakerFeedbackId")
	updateContractUndertakerFeedbackCommand.FeedbackId = contractUndertakerFeedbackId
	data, err := contractUndertakerFeedbackService.UpdateContractUndertakerFeedback(updateContractUndertakerFeedbackCommand)
	controller.Response(data, err)
}

func (controller *ContractUndertakerFeedbackController) GetContractUndertakerFeedback() {
	contractUndertakerFeedbackService := service.NewContractUndertakerFeedbackService(nil)
	getContractUndertakerFeedbackQuery := &query.GetContractUndertakerFeedbackQuery{}
	header := controller.GetRequestHeader(controller.Ctx)
	getContractUndertakerFeedbackQuery.CompanyId = header.CompanyId
	getContractUndertakerFeedbackQuery.OrgId = header.OrgId
	getContractUndertakerFeedbackQuery.UserId = header.UserId
	getContractUndertakerFeedbackQuery.UserBaseId = header.UserBaseId
	contractUndertakerFeedbackId := controller.GetString(":contractUndertakerFeedbackId")
	getContractUndertakerFeedbackQuery.FeedbackId = contractUndertakerFeedbackId
	data, err := contractUndertakerFeedbackService.GetContractUndertakerFeedback(getContractUndertakerFeedbackQuery)
	controller.Response(data, err)
}

func (controller *ContractUndertakerFeedbackController) RemoveContractUndertakerFeedback() {
	contractUndertakerFeedbackService := service.NewContractUndertakerFeedbackService(nil)
	removeContractUndertakerFeedbackCommand := &command.RemoveContractUndertakerFeedbackCommand{}
	_ = controller.Unmarshal(removeContractUndertakerFeedbackCommand)
	header := controller.GetRequestHeader(controller.Ctx)
	removeContractUndertakerFeedbackCommand.CompanyId = header.CompanyId
	removeContractUndertakerFeedbackCommand.OrgId = header.OrgId
	removeContractUndertakerFeedbackCommand.UserId = header.UserId
	removeContractUndertakerFeedbackCommand.UserBaseId = header.UserBaseId
	contractUndertakerFeedbackId := controller.GetString(":contractUndertakerFeedbackId")
	removeContractUndertakerFeedbackCommand.FeedbackId = contractUndertakerFeedbackId
	data, err := contractUndertakerFeedbackService.RemoveContractUndertakerFeedback(removeContractUndertakerFeedbackCommand)
	controller.Response(data, err)
}

func (controller *ContractUndertakerFeedbackController) SearchContractUndertakerFeedback() {
	contractUndertakerFeedbackService := service.NewContractUndertakerFeedbackService(nil)
	searchContractUndertakerFeedbackQuery := &query.SearchContractUndertakerFeedbackQuery{}
	_ = controller.Unmarshal(searchContractUndertakerFeedbackQuery)
	header := controller.GetRequestHeader(controller.Ctx)
	searchContractUndertakerFeedbackQuery.CompanyId = header.CompanyId
	searchContractUndertakerFeedbackQuery.OrgId = header.OrgId
	searchContractUndertakerFeedbackQuery.UserId = header.UserId
	searchContractUndertakerFeedbackQuery.UserBaseId = header.UserBaseId
	data, err := contractUndertakerFeedbackService.SearchContractUndertakerFeedback(searchContractUndertakerFeedbackQuery)
	controller.Response(data, err)
}

func (controller *ContractUndertakerFeedbackController) ListContractUndertakerFeedback() {
	contractUndertakerFeedbackService := service.NewContractUndertakerFeedbackService(nil)
	listContractUndertakerFeedbackQuery := &query.ListContractUndertakerFeedbackQuery{}
	header := controller.GetRequestHeader(controller.Ctx)
	listContractUndertakerFeedbackQuery.CompanyId = header.CompanyId
	listContractUndertakerFeedbackQuery.OrgId = header.OrgId
	listContractUndertakerFeedbackQuery.UserId = header.UserId
	listContractUndertakerFeedbackQuery.UserBaseId = header.UserBaseId
	pageSize, _ := controller.GetInt64("pageSize")
	listContractUndertakerFeedbackQuery.PageSize = pageSize
	pageNumber, _ := controller.GetInt64("pageNumber")
	listContractUndertakerFeedbackQuery.PageNumber = pageNumber
	underTakerUid := controller.GetString(":underTakerUid")
	listContractUndertakerFeedbackQuery.UnderTakerUid = underTakerUid
	data, err := contractUndertakerFeedbackService.ListContractUndertakerFeedback(listContractUndertakerFeedbackQuery)
	controller.Response(data, err)
}