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.

41 lines
992 B
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 CreateDepartmentAdminLogic struct {
ctx context.Context
svcCtx *svc.ServiceContext
r *http.Request
}
func NewCreateDepartmentAdminLogic(r *http.Request, ctx context.Context, svcCtx *svc.ServiceContext) *CreateDepartmentAdminLogic {
return &CreateDepartmentAdminLogic{
r: r,
ctx: ctx,
svcCtx: svcCtx,
}
}
func (l *CreateDepartmentAdminLogic) CreateDepartmentAdmin(req *types.DepartmentInfo) (resp *types.BaseID, err error) {
rpcResp, err := l.svcCtx.CoreRpc.CreateDepartment(l.ctx, &core.DepartmentInfo{
Status: req.Status,
Name: req.Name,
LeaderId: req.LeaderId,
Remark: req.Remark,
ParentId: req.ParentId,
})
if err != nil {
return nil, err
}
resp = &types.BaseID{ID: rpcResp.ID}
return
}