Search in sources :

Example 1 with ViewMenuVo

use of com.paascloud.provider.model.vo.ViewMenuVo in project paascloud-master by paascloud.

the class UacMenuServiceImpl method getViewVoById.

@Override
@Transactional(readOnly = true, rollbackFor = Exception.class)
public ViewMenuVo getViewVoById(Long id) {
    Preconditions.checkArgument(id != null, "菜单ID不能为空");
    UacMenu menu = uacMenuMapper.selectByPrimaryKey(id);
    if (menu == null) {
        logger.error("找不到菜单信息id={}", id);
        throw new UacBizException(ErrorCodeEnum.UAC10013003, id);
    }
    // 获取父级菜单信息
    UacMenu parentMenu = uacMenuMapper.selectByPrimaryKey(menu.getPid());
    ModelMapper modelMapper = new ModelMapper();
    ViewMenuVo menuVo = modelMapper.map(menu, ViewMenuVo.class);
    if (parentMenu != null) {
        menuVo.setParentMenuName(parentMenu.getMenuName());
    }
    return menuVo;
}
Also used : UacMenu(com.paascloud.provider.model.domain.UacMenu) UacBizException(com.paascloud.provider.model.exceptions.UacBizException) ViewMenuVo(com.paascloud.provider.model.vo.ViewMenuVo) ModelMapper(org.modelmapper.ModelMapper) Transactional(org.springframework.transaction.annotation.Transactional)

Aggregations

UacMenu (com.paascloud.provider.model.domain.UacMenu)1 UacBizException (com.paascloud.provider.model.exceptions.UacBizException)1 ViewMenuVo (com.paascloud.provider.model.vo.ViewMenuVo)1 ModelMapper (org.modelmapper.ModelMapper)1 Transactional (org.springframework.transaction.annotation.Transactional)1