package controllers import ( "github.com/linmadan/egglib-go/core/application" "github.com/linmadan/egglib-go/web/beego" "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/department" "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/department/command" "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/port/beego/middlewares" ) type DepartmentController struct { beego.BaseController } func (controller *DepartmentController) ListAndCount() { dService := department.NewDepartmentService() in := &command.QueryDepartmentCommand{} if err := controller.Unmarshal(in); err != nil { controller.Response(nil, application.ThrowError(application.ARG_ERROR, err.Error())) } else { ua := middlewares.GetUser(controller.Ctx) in.CompanyId = ua.CompanyId controller.Response(dService.ListAndCount(in)) } }