package com.red.circle.console.app.command.admin.query;

import com.red.circle.console.app.convertor.RoleAppConvertor;
import com.red.circle.console.app.dto.clienobject.admin.RoleCO;
import com.red.circle.console.app.dto.cmd.admin.RoleIdCmd;
import com.red.circle.console.infra.database.rds.service.admin.RoleService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;

/**
 * 查询单个角色.
 *
 * @author pengliang on 2023/5/12
 */
@Component
@RequiredArgsConstructor
public class RoleSingleQryExe {

  private final RoleService roleService;
  private final RoleAppConvertor roleAppConvertor;

  public RoleCO execute(RoleIdCmd cmd) {
    return roleAppConvertor.toRoleCO(roleService.getById(cmd.getId()));
  }

}
