system_setting_controller.go 1.7 KB
package controllers

import (
	"gitlab.fjmaimaimai.com/allied-creation/allied-creation-basic/pkg/application/systemSetting/command"
	"gitlab.fjmaimaimai.com/allied-creation/allied-creation-basic/pkg/application/systemSetting/query"
	"gitlab.fjmaimaimai.com/allied-creation/allied-creation-basic/pkg/application/systemSetting/service"
	"gitlab.fjmaimaimai.com/allied-creation/allied-creation-basic/pkg/log"
)

type SystemSettingController struct {
	baseController
}

func (controller *SystemSettingController) UpdateSystemSetting() {
	systemSettingService := service.NewSystemSettingService(nil)
	updateSystemSettingCommand := &command.UpdateSystemSettingCommand{}
	err := controller.Unmarshal(updateSystemSettingCommand)
	if err != nil {
		log.Logger.Debug(err.Error())
	}
	updateSystemSettingCommand.CompanyId = controller.GetCompanyId()
	data, err := systemSettingService.UpdateSystemSetting(updateSystemSettingCommand)
	controller.Response(data, err)
}

func (controller *SystemSettingController) GetSystemSetting() {
	systemSettingService := service.NewSystemSettingService(nil)
	getSystemSettingQuery := &query.GetSystemSettingQuery{}
	err := controller.Unmarshal(getSystemSettingQuery)
	if err != nil {
		log.Logger.Debug(err.Error())
	}
	getSystemSettingQuery.CompanyId = controller.GetCompanyId()
	data, err := systemSettingService.GetSystemSetting(getSystemSettingQuery)
	controller.Response(data, err)
}

func (controller *SystemSettingController) ListSystemSetting() {
	systemSettingService := service.NewSystemSettingService(nil)
	listSystemSettingQuery := &query.ListSystemSettingQuery{}
	listSystemSettingQuery.CompanyId = controller.GetCompanyId()
	data, err := systemSettingService.ListSystemSetting(listSystemSettingQuery)
	controller.Response(data, err)
}