notice_setting_controller.go 2.5 KB
package web_client

import (
	"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/noticesetting/command"
	"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/noticesetting/query"
	"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/noticesetting/service"
)

type NoticeSettingController struct {
	baseController
}

func (controller *NoticeSettingController) NoticeSettingList() {
	noticeSettingService := service.NewNoticeSettingService(nil)
	noticeSettingListQuery := &query.NoticeSettingListQuery{}
	controller.Unmarshal(noticeSettingListQuery)
	noticeSettingListQuery.Operator = controller.GetOperator()
	cnt, data, err := noticeSettingService.NoticeSettingList(noticeSettingListQuery)
	controller.returnPageListData(cnt, data, err, noticeSettingListQuery.PageNumber)
}

func (controller *NoticeSettingController) NoticeSettingUpdate() {
	noticeSettingService := service.NewNoticeSettingService(nil)
	noticeSettingUpdateCommand := &command.NoticeSettingUpdateCommand{}
	settingId := controller.GetString(":settingId")
	controller.Unmarshal(noticeSettingUpdateCommand)
	noticeSettingUpdateCommand.Operator = controller.GetOperator()
	noticeSettingUpdateCommand.NoticeSettingId = settingId
	data, err := noticeSettingService.NoticeSettingUpdate(noticeSettingUpdateCommand)
	controller.Response(data, err)
}

func (controller *NoticeSettingController) NoticeSettingAdd() {
	noticeSettingService := service.NewNoticeSettingService(nil)
	noticeSettingAddCommand := &command.NoticeSettingAddCommand{}
	controller.Unmarshal(noticeSettingAddCommand)
	noticeSettingAddCommand.Operator = controller.GetOperator()
	data, err := noticeSettingService.NoticeSettingAdd(noticeSettingAddCommand)
	controller.Response(data, err)
}

func (controller *NoticeSettingController) NoticeSettingProfile() {
	noticeSettingService := service.NewNoticeSettingService(nil)
	p := &query.NoticeSettingProfileQuery{
		Operator: controller.GetOperator(),
	}
	data, err := noticeSettingService.NoticeSettingProfile(p)
	controller.Response(data, err)
}

func (controller *NoticeSettingController) NoticeSettingGet() {
	noticeSettingService := service.NewNoticeSettingService(nil)
	queryParm := &query.NoticeSettingGetQuery{
		Operator: controller.GetOperator(),
	}
	settingId := controller.GetString(":settingId")
	queryParm.NoticeSettingId = settingId
	data, err := noticeSettingService.NoticeSettingGet(queryParm)
	controller.Response(data, err)
}