cooperation_contract_change_log_controller.go 5.7 KB
package controllers

import (
	"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/application/cooperationContractChangeLog/command"
	"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/application/cooperationContractChangeLog/query"
	"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/application/cooperationContractChangeLog/service"
)

type CooperationContractChangeLogController struct {
	BaseController
}

func (controller *CooperationContractChangeLogController) CreateCooperationContractChangeLog() {
	cooperationContractChangeLogService := service.NewCooperationContractChangeLogService(nil)
	createCooperationContractChangeLogCommand := &command.CreateCooperationContractChangeLogCommand{}
	_ = controller.Unmarshal(createCooperationContractChangeLogCommand)
	header := controller.GetRequestHeader(controller.Ctx)
	createCooperationContractChangeLogCommand.CompanyId = header.CompanyId
	createCooperationContractChangeLogCommand.OrgId = header.OrgId
	createCooperationContractChangeLogCommand.UserId = header.UserId
	createCooperationContractChangeLogCommand.UserBaseId = header.UserBaseId
	data, err := cooperationContractChangeLogService.CreateCooperationContractChangeLog(createCooperationContractChangeLogCommand)
	controller.Response(data, err)
}

func (controller *CooperationContractChangeLogController) UpdateCooperationContractChangeLog() {
	cooperationContractChangeLogService := service.NewCooperationContractChangeLogService(nil)
	updateCooperationContractChangeLogCommand := &command.UpdateCooperationContractChangeLogCommand{}
	_ = controller.Unmarshal(updateCooperationContractChangeLogCommand)
	header := controller.GetRequestHeader(controller.Ctx)
	updateCooperationContractChangeLogCommand.CompanyId = header.CompanyId
	updateCooperationContractChangeLogCommand.OrgId = header.OrgId
	updateCooperationContractChangeLogCommand.UserId = header.UserId
	updateCooperationContractChangeLogCommand.UserBaseId = header.UserBaseId
	cooperationContractChangeLogId, _ := controller.GetInt64(":cooperationContractChangeLogId")
	updateCooperationContractChangeLogCommand.CooperationContractChangeLogId = cooperationContractChangeLogId
	data, err := cooperationContractChangeLogService.UpdateCooperationContractChangeLog(updateCooperationContractChangeLogCommand)
	controller.Response(data, err)
}

func (controller *CooperationContractChangeLogController) GetCooperationContractChangeLog() {
	cooperationContractChangeLogService := service.NewCooperationContractChangeLogService(nil)
	getCooperationContractChangeLogQuery := &query.GetCooperationContractChangeLogQuery{}
	header := controller.GetRequestHeader(controller.Ctx)
	getCooperationContractChangeLogQuery.CompanyId = header.CompanyId
	getCooperationContractChangeLogQuery.OrgId = header.OrgId
	getCooperationContractChangeLogQuery.UserId = header.UserId
	getCooperationContractChangeLogQuery.UserBaseId = header.UserBaseId
	cooperationContractChangeLogId, _ := controller.GetInt64(":cooperationContractChangeLogId")
	getCooperationContractChangeLogQuery.CooperationContractChangeLogId = cooperationContractChangeLogId
	data, err := cooperationContractChangeLogService.GetCooperationContractChangeLog(getCooperationContractChangeLogQuery)
	controller.Response(data, err)
}

func (controller *CooperationContractChangeLogController) RemoveCooperationContractChangeLog() {
	cooperationContractChangeLogService := service.NewCooperationContractChangeLogService(nil)
	removeCooperationContractChangeLogCommand := &command.RemoveCooperationContractChangeLogCommand{}
	_ = controller.Unmarshal(removeCooperationContractChangeLogCommand)
	header := controller.GetRequestHeader(controller.Ctx)
	removeCooperationContractChangeLogCommand.CompanyId = header.CompanyId
	removeCooperationContractChangeLogCommand.OrgId = header.OrgId
	removeCooperationContractChangeLogCommand.UserId = header.UserId
	removeCooperationContractChangeLogCommand.UserBaseId = header.UserBaseId
	cooperationContractChangeLogId, _ := controller.GetInt64(":cooperationContractChangeLogId")
	removeCooperationContractChangeLogCommand.CooperationContractChangeLogId = cooperationContractChangeLogId
	data, err := cooperationContractChangeLogService.RemoveCooperationContractChangeLog(removeCooperationContractChangeLogCommand)
	controller.Response(data, err)
}

func (controller *CooperationContractChangeLogController) ListCooperationContractChangeLog() {
	cooperationContractChangeLogService := service.NewCooperationContractChangeLogService(nil)
	listCooperationContractChangeLogQuery := &query.ListCooperationContractChangeLogQuery{}
	header := controller.GetRequestHeader(controller.Ctx)
	listCooperationContractChangeLogQuery.CompanyId = header.CompanyId
	listCooperationContractChangeLogQuery.OrgId = header.OrgId
	listCooperationContractChangeLogQuery.UserId = header.UserId
	listCooperationContractChangeLogQuery.UserBaseId = header.UserBaseId
	pageSize, _ := controller.GetInt64("pageSize")
	listCooperationContractChangeLogQuery.PageSize = pageSize
	pageNumber, _ := controller.GetInt64("pageNumber")
	listCooperationContractChangeLogQuery.PageNumber = pageNumber
	data, err := cooperationContractChangeLogService.ListCooperationContractChangeLog(listCooperationContractChangeLogQuery)
	controller.Response(data, err)
}

func (controller *CooperationContractChangeLogController) SearchCooperationContractChangeLog() {
	cooperationContractChangeLogService := service.NewCooperationContractChangeLogService(nil)
	searchCooperationContractChangeLogQuery := &query.SearchCooperationContractChangeLogQuery{}
	_ = controller.Unmarshal(searchCooperationContractChangeLogQuery)
	data, err := cooperationContractChangeLogService.SearchCooperationContractChangeLog(searchCooperationContractChangeLogQuery)
	controller.Response(data, err)
}