use of com.paascloud.provider.model.domain.UacRoleMenu in project paascloud-master by paascloud.
the class UacRoleMenuServiceImpl method listByRoleId.
@Override
@Transactional(readOnly = true, rollbackFor = Exception.class)
public List<UacRoleMenu> listByRoleId(Long roleId) {
if (roleId == null) {
throw new UacBizException(ErrorCodeEnum.UAC10012001);
}
UacRoleMenu roleMenu = new UacRoleMenu();
roleMenu.setRoleId(roleId);
return uacRoleMenuMapper.select(roleMenu);
}
use of com.paascloud.provider.model.domain.UacRoleMenu in project paascloud-master by paascloud.
the class UacRoleMenuServiceImpl method deleteByRoleId.
@Override
public void deleteByRoleId(Long roleId) {
if (roleId == null) {
throw new UacBizException(ErrorCodeEnum.UAC10012001);
}
UacRoleMenu roleMenu = new UacRoleMenu();
roleMenu.setRoleId(roleId);
uacRoleMenuMapper.delete(roleMenu);
}
use of com.paascloud.provider.model.domain.UacRoleMenu in project paascloud-master by paascloud.
the class UacRoleMenuServiceImpl method insert.
@Override
public void insert(Long roleId, Set<Long> menuIdList) {
if (roleId == null) {
throw new UacBizException(ErrorCodeEnum.UAC10012001);
}
UacRoleMenu uacRoleMenu = new UacRoleMenu();
uacRoleMenu.setRoleId(roleId);
for (Long menuId : menuIdList) {
uacRoleMenu.setMenuId(menuId);
uacRoleMenuMapper.insertSelective(uacRoleMenu);
}
}
use of com.paascloud.provider.model.domain.UacRoleMenu in project paascloud-master by paascloud.
the class UacMenuServiceImpl method deleteUacMenuById.
@Override
public int deleteUacMenuById(Long id, LoginAuthDto loginAuthDto) {
Preconditions.checkArgument(id != null, "菜单id不能为空");
int result;
// 获取当前菜单信息
UacMenu uacMenuQuery = new UacMenu();
uacMenuQuery.setId(id);
uacMenuQuery = mapper.selectOne(uacMenuQuery);
if (PublicUtil.isEmpty(uacMenuQuery)) {
throw new UacBizException(ErrorCodeEnum.UAC10013003, id);
}
// 删除菜单与角色的关联关系
UacRoleMenu uacRoleMenu = new UacRoleMenu();
uacRoleMenu.setMenuId(id);
uacRoleMenuService.delete(uacRoleMenu);
// 删除菜单
result = uacMenuMapper.deleteByPrimaryKey(id);
if (result < 1) {
logger.error("删除菜单失败 menuId={}", id);
throw new UacBizException(ErrorCodeEnum.UAC10013008, id);
}
// 删除权限
// TODO 应该先查询再删除
uacActionService.deleteByMenuId(id);
// 修改当前删除菜单的父菜单是否是叶子节点
UacMenu updateParentUacMenu = new UacMenu();
updateParentUacMenu.setId(uacMenuQuery.getPid());
updateParentUacMenu.setLeaf(MenuConstant.MENU_LEAF_YES);
// 是二三级
if (Objects.equals(MenuConstant.MENU_LEVEL_TWO, uacMenuQuery.getLevel()) || Objects.equals(MenuConstant.MENU_LEVEL_THREE, uacMenuQuery.getLevel())) {
// 查询是否是叶子节点
int count = uacMenuMapper.selectMenuChildCountByPid(uacMenuQuery.getPid());
if (count == 0) {
uacMenuMapper.updateByPrimaryKeySelective(updateParentUacMenu);
}
}
return result;
}
Aggregations