use of com.paascloud.provider.model.domain.UacMenu in project paascloud-master by paascloud.
the class UacMenuServiceImpl method getAllChildMenuByMenuId.
@Override
@Transactional(readOnly = true, rollbackFor = Exception.class)
public List<UacMenu> getAllChildMenuByMenuId(Long menuId, String menuStatus) {
UacMenu uacMenuQuery = new UacMenu();
uacMenuQuery.setId(menuId);
uacMenuQuery = mapper.selectOne(uacMenuQuery);
List<UacMenu> uacMenuList = Lists.newArrayList();
uacMenuList = buildNode(uacMenuList, uacMenuQuery, menuStatus);
return uacMenuList;
}
use of com.paascloud.provider.model.domain.UacMenu 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;
}
use of com.paascloud.provider.model.domain.UacMenu in project paascloud-master by paascloud.
the class UacMenuServiceImpl method getPid.
private void getPid(Set<UacMenu> menuSet, UacMenu menu, Map<Long, UacMenu> map) {
UacMenu parent = map.get(menu.getPid());
if (parent != null && parent.getId() != 0L) {
menuSet.add(parent);
getPid(menuSet, parent, map);
}
}
use of com.paascloud.provider.model.domain.UacMenu in project paascloud-master by paascloud.
the class UacMenuServiceImpl method disableMenuList.
@Override
public int disableMenuList(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.DISABLE.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.UAC10013005, menu.getId());
}
}
return sum;
}
use of com.paascloud.provider.model.domain.UacMenu in project paascloud-master by paascloud.
the class UacMenuServiceImpl method saveUacMenu.
@Override
public int saveUacMenu(UacMenu menu, LoginAuthDto loginAuthDto) {
Long pid = menu.getPid();
menu.setUpdateInfo(loginAuthDto);
UacMenu parentMenu = mapper.selectByPrimaryKey(pid);
if (PublicUtil.isEmpty(parentMenu)) {
throw new UacBizException(ErrorCodeEnum.UAC10013001, pid);
}
if (menu.isNew()) {
UacMenu updateMenu = new UacMenu();
menu.setLevel(parentMenu.getLevel() + 1);
updateMenu.setLeaf(MenuConstant.MENU_LEAF_NO);
updateMenu.setId(pid);
Long menuId = super.generateId();
menu.setId(menuId);
int result = mapper.updateByPrimaryKeySelective(updateMenu);
if (result < 1) {
throw new UacBizException(ErrorCodeEnum.UAC10013002, menuId);
}
menu.setStatus(UacMenuStatusEnum.ENABLE.getType());
menu.setCreatorId(loginAuthDto.getUserId());
menu.setCreator(loginAuthDto.getUserName());
menu.setLastOperatorId(loginAuthDto.getUserId());
menu.setLastOperator(loginAuthDto.getUserName());
// 新增的菜单是叶子节点
menu.setLeaf(MenuConstant.MENU_LEAF_YES);
return uacMenuMapper.insertSelective(menu);
} else {
return uacMenuMapper.updateByPrimaryKeySelective(menu);
}
}
Aggregations