user_base_controller.go 1.1 KB
package controllers

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

type UserBaseController struct {
	beego.BaseController
}

func (controller *UserBaseController) SearchUser() {
	userService := service.NewUserBaseService(nil)
	listUserQuery := &query.ListUserQuery{}
	Must(controller.Unmarshal(listUserQuery))
	listUserQuery.OperateInfo = ParseOperateInfo(controller.BaseController)
	data, err := userService.SearchUser(listUserQuery)
	controller.Response(data, err)
}

func (controller *UserBaseController) BatchEnable() {
	userService := service.NewUserBaseService(nil)
	batchEnableCommand := &command.BatchEnableCommand{}
	controller.Unmarshal(batchEnableCommand)
	batchEnableCommand.OperateInfo = ParseOperateInfo(controller.BaseController)
	data, err := userService.BatchEnable(batchEnableCommand)
	controller.Response(data, err)
}