contract_undertaker_feedback_controller.go 6.2 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{}
	// 解析头部信息
	header := controller.GetRequestHeader(controller.Ctx)
	searchContractUndertakerFeedbackQuery.CompanyId = header.CompanyId
	searchContractUndertakerFeedbackQuery.OrgId = header.OrgId
	searchContractUndertakerFeedbackQuery.UserId = header.UserId
	searchContractUndertakerFeedbackQuery.UserBaseId = header.UserBaseId
	// 获取路径参数
	pageSize, _ := controller.GetInt32("pageSize")
	searchContractUndertakerFeedbackQuery.PageSize = pageSize
	pageNumber, _ := controller.GetInt32("pageNumber")
	searchContractUndertakerFeedbackQuery.PageNumber = pageNumber
	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.GetInt32("pageSize")
	listContractUndertakerFeedbackQuery.PageSize = pageSize
	pageNumber, _ := controller.GetInt32("pageNumber")
	listContractUndertakerFeedbackQuery.PageNumber = pageNumber
	data, err := contractUndertakerFeedbackService.ListContractUndertakerFeedback(listContractUndertakerFeedbackQuery)
	controller.Response(data, err)
}