dividends_estimate_controller.go 5.9 KB
package controllers

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

type DividendsEstimateController struct {
	beego.BaseController
}

func (controller *DividendsEstimateController) CreateDividendsEstimate() {
	dividendsEstimateService := service.NewDividendsEstimateService(nil)
	createDividendsEstimateCommand := &command.CreateDividendsEstimateCommand{}
	controller.Unmarshal(createDividendsEstimateCommand)
	data, err := dividendsEstimateService.CreateDividendsEstimate(createDividendsEstimateCommand)
	controller.Response(data, err)
}

func (controller *DividendsEstimateController) UpdateDividendsEstimate() {
	dividendsEstimateService := service.NewDividendsEstimateService(nil)
	updateDividendsEstimateCommand := &command.UpdateDividendsEstimateCommand{}
	controller.Unmarshal(updateDividendsEstimateCommand)
	dividendsEstimateId, _ := controller.GetInt64(":dividendsEstimateId")
	updateDividendsEstimateCommand.DividendsEstimateId = dividendsEstimateId
	data, err := dividendsEstimateService.UpdateDividendsEstimate(updateDividendsEstimateCommand)
	controller.Response(data, err)
}

func (controller *DividendsEstimateController) GetDividendsEstimate() {
	dividendsEstimateService := service.NewDividendsEstimateService(nil)
	getDividendsEstimateQuery := &query.GetDividendsEstimateQuery{}
	dividendsEstimateId, _ := controller.GetInt64(":dividendsEstimateId")
	getDividendsEstimateQuery.DividendsEstimateId = dividendsEstimateId
	data, err := dividendsEstimateService.GetDividendsEstimate(getDividendsEstimateQuery)
	controller.Response(data, err)
}

func (controller *DividendsEstimateController) RemoveDividendsEstimate() {
	dividendsEstimateService := service.NewDividendsEstimateService(nil)
	removeDividendsEstimateCommand := &command.RemoveDividendsEstimateCommand{}
	controller.Unmarshal(removeDividendsEstimateCommand)
	dividendsEstimateId, _ := controller.GetInt64(":dividendsEstimateId")
	removeDividendsEstimateCommand.DividendsEstimateId = dividendsEstimateId
	data, err := dividendsEstimateService.RemoveDividendsEstimate(removeDividendsEstimateCommand)
	controller.Response(data, err)
}

func (controller *DividendsEstimateController) CancelDividendsEstimate() {
	dividendsEstimateService := service.NewDividendsEstimateService(nil)
	cancelDividendsEstimateCommand := &command.CancelDividendsEstimateCommand{}
	controller.Unmarshal(cancelDividendsEstimateCommand)
	dividendsEstimateId := controller.GetString(":dividendsEstimateId")
	cancelDividendsEstimateCommand.DividendsEstimateId = dividendsEstimateId
	data, err := dividendsEstimateService.CancelDividendsEstimate(cancelDividendsEstimateCommand)
	controller.Response(data, err)
}

func (controller *DividendsEstimateController) SearchDividendsEstimate() {
	dividendsEstimateService := service.NewDividendsEstimateService(nil)
	searchDividendsEstimateQuery := &query.SearchDividendsEstimateQuery{}
	data, err := dividendsEstimateService.SearchDividendsEstimate(searchDividendsEstimateQuery)
	controller.Response(data, err)
}

func (controller *DividendsEstimateController) EstimateDividendsIncentives() {
	dividendsEstimateService := service.NewDividendsEstimateService(nil)
	estimateDividendsIncentivesCommand := &command.EstimateDividendsIncentivesCommand{}
	controller.Unmarshal(estimateDividendsIncentivesCommand)
	data, err := dividendsEstimateService.EstimateDividendsIncentives(estimateDividendsIncentivesCommand)
	controller.Response(data, err)
}

func (controller *DividendsEstimateController) EstimateMoneyIncentives() {
	dividendsEstimateService := service.NewDividendsEstimateService(nil)
	estimateMoneyIncentivesCommand := &command.EstimateMoneyIncentivesCommand{}
	controller.Unmarshal(estimateMoneyIncentivesCommand)
	data, err := dividendsEstimateService.EstimateMoneyIncentives(estimateMoneyIncentivesCommand)
	controller.Response(data, err)
}

func (controller *DividendsEstimateController) ListMoneyIncentives() {
	dividendsEstimateService := service.NewDividendsEstimateService(nil)
	listMoneyIncentivesQuery := &query.ListMoneyIncentivesQuery{}
	data, err := dividendsEstimateService.ListMoneyIncentives(listMoneyIncentivesQuery)
	controller.Response(data, err)
}

func (controller *DividendsEstimateController) SearchMoneyIncentives() {
	dividendsEstimateService := service.NewDividendsEstimateService(nil)
	searchMoneyIncentivesQuery := &query.SearchMoneyIncentivesQuery{}
	data, err := dividendsEstimateService.SearchMoneyIncentives(searchMoneyIncentivesQuery)
	controller.Response(data, err)
}

func (controller *DividendsEstimateController) ListDividendsIncentives() {
	dividendsEstimateService := service.NewDividendsEstimateService(nil)
	listDividendsIncentivesQuery := &query.ListDividendsIncentivesQuery{}
	data, err := dividendsEstimateService.ListDividendsIncentives(listDividendsIncentivesQuery)
	controller.Response(data, err)
}

func (controller *DividendsEstimateController) SearchDividendsIncentives() {
	dividendsEstimateService := service.NewDividendsEstimateService(nil)
	searchDividendsIncentivesQuery := &query.SearchDividendsIncentivesQuery{}
	data, err := dividendsEstimateService.SearchDividendsIncentives(searchDividendsIncentivesQuery)
	controller.Response(data, err)
}

func (controller *DividendsEstimateController) ListDividendsEstimate() {
	dividendsEstimateService := service.NewDividendsEstimateService(nil)
	listDividendsEstimateQuery := &query.ListDividendsEstimateQuery{}
	offset, _ := controller.GetInt("offset")
	listDividendsEstimateQuery.Offset = offset
	limit, _ := controller.GetInt("limit")
	listDividendsEstimateQuery.Limit = limit
	data, err := dividendsEstimateService.ListDividendsEstimate(listDividendsEstimateQuery)
	controller.Response(data, err)
}