project_module_version.go 3.6 KB
package controllers

import (
	"github.com/tiptok/gocomm/pkg/log"
	"gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/application/project_module_version"
	"gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/protocol"
	protocolx "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/protocol/project_module_version"
)

type ProjectModuleVersionController struct {
	BaseController
}

// CreateProjectModuleVersion
// CreateProjectModuleVersion execute command  create  ProjectModuleVersion
func (this *ProjectModuleVersionController) CreateProjectModuleVersion() {
	var (
		msg     *protocol.ResponseMessage
		svr     = project_module_version.NewProjectModuleVersionService(nil)
		request *protocolx.CreateProjectModuleVersionRequest
	)
	defer func() {
		this.Resp(msg)
	}()
	if err := this.JsonUnmarshal(&request); err != nil {
		msg = protocol.NewResponseMessage(2, "")
		return
	}
	header := this.GetRequestHeader(this.Ctx)
	data, err := svr.CreateProjectModuleVersion(header, request)
	if err != nil {
		log.Error(err)
	}
	msg = protocol.NewResponseMessageData(data, err)
}

// UpdateProjectModuleVersion
// UpdateProjectModuleVersion execute command  update  ProjectModuleVersion
func (this *ProjectModuleVersionController) UpdateProjectModuleVersion() {
	var (
		msg     *protocol.ResponseMessage
		svr     = project_module_version.NewProjectModuleVersionService(nil)
		request *protocolx.UpdateProjectModuleVersionRequest
	)
	defer func() {
		this.Resp(msg)
	}()
	if err := this.JsonUnmarshal(&request); err != nil {
		msg = protocol.NewResponseMessage(2, "")
		return
	}
	request.ProjectModuleVersionId, _ = this.GetInt64(":projectModuleVersionId")
	header := this.GetRequestHeader(this.Ctx)
	data, err := svr.UpdateProjectModuleVersion(header, request)
	if err != nil {
		log.Error(err)
	}
	msg = protocol.NewResponseMessageData(data, err)
}

// GetProjectModuleVersion
// GetProjectModuleVersion execute query  get  ProjectModuleVersion
func (this *ProjectModuleVersionController) GetProjectModuleVersion() {
	var (
		msg     *protocol.ResponseMessage
		svr     = project_module_version.NewProjectModuleVersionService(nil)
		request = &protocolx.GetProjectModuleVersionRequest{}
	)
	defer func() {
		this.Resp(msg)
	}()
	request.Id, _ = this.GetInt64(":projectModuleVersionId")
	header := this.GetRequestHeader(this.Ctx)
	data, err := svr.GetProjectModuleVersion(header, request)
	if err != nil {
		log.Error(err)
	}
	msg = protocol.NewResponseMessageData(data, err)
}

// DeleteProjectModuleVersion
// DeleteProjectModuleVersion execute command  delete  ProjectModuleVersion
func (this *ProjectModuleVersionController) DeleteProjectModuleVersion() {
	var (
		msg     *protocol.ResponseMessage
		svr     = project_module_version.NewProjectModuleVersionService(nil)
		request = &protocolx.DeleteProjectModuleVersionRequest{}
	)
	defer func() {
		this.Resp(msg)
	}()
	request.Id, _ = this.GetInt64(":projectModuleVersionId")
	header := this.GetRequestHeader(this.Ctx)
	data, err := svr.DeleteProjectModuleVersion(header, request)
	if err != nil {
		log.Error(err)
	}
	msg = protocol.NewResponseMessageData(data, err)
}

// ListProjectModuleVersion
// ListProjectModuleVersion execute query  list  ProjectModuleVersion
func (this *ProjectModuleVersionController) ListProjectModuleVersion() {
	var (
		msg     *protocol.ResponseMessage
		svr     = project_module_version.NewProjectModuleVersionService(nil)
		request = &protocolx.ListProjectModuleVersionRequest{}
	)
	defer func() {
		this.Resp(msg)
	}()
	request.ProjectModuleId, _ = this.GetInt64("projectModuleId")
	header := this.GetRequestHeader(this.Ctx)
	data, err := svr.ListProjectModuleVersion(header, request)
	if err != nil {
		log.Error(err)
	}
	msg = protocol.NewResponseMessageData(data, err)
}