You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

44 lines
1.0 KiB
Go

package department_admin
import (
"context"
"git.noahlan.cn/n-admin/n-admin-server/rpc/core/types/core"
"git.noahlan.cn/n-admin/n-admin-server/api/internal/svc"
"git.noahlan.cn/n-admin/n-admin-server/api/internal/types"
"net/http"
)
type GetDepartmentAdminLogic struct {
ctx context.Context
svcCtx *svc.ServiceContext
r *http.Request
}
func NewGetDepartmentAdminLogic(r *http.Request, ctx context.Context, svcCtx *svc.ServiceContext) *GetDepartmentAdminLogic {
return &GetDepartmentAdminLogic{
r: r,
ctx: ctx,
svcCtx: svcCtx,
}
}
func (l *GetDepartmentAdminLogic) GetDepartmentAdmin(req *types.DepartmentReq) (resp *types.DepartmentInfo, err error) {
rpcResp, err := l.svcCtx.CoreRpc.GetDepartment(l.ctx, &core.DepartmentReq{
ID: req.ID,
Name: req.Name,
LeaderId: req.LeaderId,
ParentId: req.ParentId,
WithLeader: true,
WithUser: false,
WithChildren: true,
})
if err != nil {
return nil, err
}
resp = l.svcCtx.Convert.ConvertDepartment(l.ctx, rpcResp)
return
}