47 lines
1.0 KiB
Go
47 lines
1.0 KiB
Go
// Code scaffolded by goctl. Safe to edit.
|
|
// goctl 1.10.1
|
|
|
|
package role
|
|
|
|
import (
|
|
"context"
|
|
|
|
"sundynix-micro-go/app/system/api/internal/svc"
|
|
"sundynix-micro-go/app/system/api/internal/types"
|
|
"sundynix-micro-go/app/system/rpc/system"
|
|
|
|
"github.com/zeromicro/go-zero/core/logx"
|
|
)
|
|
|
|
type GetRoleDetailLogic struct {
|
|
logx.Logger
|
|
ctx context.Context
|
|
svcCtx *svc.ServiceContext
|
|
}
|
|
|
|
// 角色详情(含已授权菜单)
|
|
func NewGetRoleDetailLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetRoleDetailLogic {
|
|
return &GetRoleDetailLogic{
|
|
Logger: logx.WithContext(ctx),
|
|
ctx: ctx,
|
|
svcCtx: svcCtx,
|
|
}
|
|
}
|
|
|
|
func (l *GetRoleDetailLogic) GetRoleDetail(req *types.IdQueryReq) (resp *types.RoleDetailResp, err error) {
|
|
rpcResp, err := l.svcCtx.SystemRpc.GetRoleDetail(l.ctx, &system.GetRoleDetailReq{
|
|
Id: req.Id,
|
|
})
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return &types.RoleDetailResp{
|
|
Id: rpcResp.Id,
|
|
Name: rpcResp.Name,
|
|
Code: rpcResp.Code,
|
|
Sort: int(rpcResp.Sort),
|
|
MenuIds: rpcResp.MenuIds,
|
|
}, nil
|
|
}
|