Search in sources :

Example 6 with UacMenu

use of com.paascloud.provider.model.domain.UacMenu in project paascloud-master by paascloud.

the class UacMenuServiceImpl method buildParentNote.

/**
 * 递归获取菜单的父菜单
 */
private List<UacMenu> buildParentNote(List<UacMenu> uacMenuList, UacMenu uacMenu) {
    List<UacMenu> uacMenuQueryList = mapper.select(uacMenu);
    UacMenu uacMenuQuery;
    for (UacMenu menu : uacMenuQueryList) {
        if (UacMenuStatusEnum.DISABLE.getType().equals(menu.getStatus()) && !MenuConstant.MENU_LEVEL_ROOT.equals(menu.getLevel())) {
            // 禁用状态
            uacMenuList.add(menu);
        }
        uacMenuQuery = new UacMenu();
        uacMenuQuery.setId(menu.getPid());
        buildParentNote(uacMenuList, uacMenuQuery);
    }
    return uacMenuList;
}
Also used : UacMenu(com.paascloud.provider.model.domain.UacMenu)

Example 7 with UacMenu

use of com.paascloud.provider.model.domain.UacMenu in project paascloud-master by paascloud.

the class UacMenuServiceImpl method buildNode.

/**
 * 递归获取菜单的子菜单
 */
private List<UacMenu> buildNode(List<UacMenu> uacMenuList, UacMenu uacMenu, String menuStatus) {
    List<UacMenu> uacMenuQueryList = mapper.select(uacMenu);
    UacMenu uacMenuQuery;
    for (UacMenu menu : uacMenuQueryList) {
        // 启用状态
        if (menuStatus.equals(menu.getStatus()) && !MenuConstant.MENU_LEVEL_ROOT.equals(menu.getLevel())) {
            uacMenuList.add(menu);
        }
        uacMenuQuery = new UacMenu();
        uacMenuQuery.setPid(menu.getId());
        buildNode(uacMenuList, uacMenuQuery, menuStatus);
    }
    return uacMenuList;
}
Also used : UacMenu(com.paascloud.provider.model.domain.UacMenu)

Example 8 with UacMenu

use of com.paascloud.provider.model.domain.UacMenu in project paascloud-master by paascloud.

the class UacMenuServiceImpl method checkMenuHasChildMenu.

@Override
@Transactional(readOnly = true, rollbackFor = Exception.class)
public boolean checkMenuHasChildMenu(Long pid) {
    Preconditions.checkArgument(pid != null, "菜单pid不能为空");
    UacMenu uacMenu = new UacMenu();
    uacMenu.setStatus(UacMenuStatusEnum.ENABLE.getType());
    uacMenu.setPid(pid);
    return mapper.selectCount(uacMenu) > 0;
}
Also used : UacMenu(com.paascloud.provider.model.domain.UacMenu) Transactional(org.springframework.transaction.annotation.Transactional)

Example 9 with UacMenu

use of com.paascloud.provider.model.domain.UacMenu in project paascloud-master by paascloud.

the class UacMenuServiceImpl method getMenuVo.

private List<MenuVo> getMenuVo(List<UacMenu> list) {
    List<MenuVo> menuVoList = Lists.newArrayList();
    for (UacMenu uacMenu : list) {
        MenuVo menuVo = new MenuVo();
        BeanUtils.copyProperties(uacMenu, menuVo);
        menuVo.setUrl(uacMenu.getUrl());
        menuVo.setMenuName(uacMenu.getMenuName());
        menuVoList.add(menuVo);
    }
    return menuVoList;
}
Also used : MenuVo(com.paascloud.provider.model.vo.MenuVo) ViewMenuVo(com.paascloud.provider.model.vo.ViewMenuVo) UacMenu(com.paascloud.provider.model.domain.UacMenu)

Example 10 with UacMenu

use of com.paascloud.provider.model.domain.UacMenu in project paascloud-master by paascloud.

the class UacMenuServiceImpl method enableMenuList.

@Override
public int enableMenuList(List<UacMenu> menuList, LoginAuthDto loginAuthDto) {
    UacMenu uacMenuUpdate = new UacMenu();
    int sum = 0;
    for (UacMenu menu : menuList) {
        uacMenuUpdate.setId(menu.getId());
        uacMenuUpdate.setVersion(menu.getVersion() + 1);
        uacMenuUpdate.setStatus(UacMenuStatusEnum.ENABLE.getType());
        uacMenuUpdate.setLastOperator(loginAuthDto.getLoginName());
        uacMenuUpdate.setLastOperatorId(loginAuthDto.getUserId());
        uacMenuUpdate.setUpdateTime(new Date());
        int result = mapper.updateByPrimaryKeySelective(uacMenuUpdate);
        if (result > 0) {
            sum += 1;
        } else {
            throw new UacBizException(ErrorCodeEnum.UAC10013004, menu.getId());
        }
    }
    return sum;
}
Also used : UacMenu(com.paascloud.provider.model.domain.UacMenu) UacBizException(com.paascloud.provider.model.exceptions.UacBizException)

Aggregations

UacMenu (com.paascloud.provider.model.domain.UacMenu)18 UacBizException (com.paascloud.provider.model.exceptions.UacBizException)6 Transactional (org.springframework.transaction.annotation.Transactional)6 ViewMenuVo (com.paascloud.provider.model.vo.ViewMenuVo)4 MenuVo (com.paascloud.provider.model.vo.MenuVo)3 LoginAuthDto (com.paascloud.base.dto.LoginAuthDto)1 LogAnnotation (com.paascloud.core.annotation.LogAnnotation)1 UacRoleMenu (com.paascloud.provider.model.domain.UacRoleMenu)1 ApiOperation (io.swagger.annotations.ApiOperation)1 ModelMapper (org.modelmapper.ModelMapper)1