|
|
@ -2,6 +2,7 @@ package com.example.demo.serviceImpl; |
|
|
|
|
|
|
|
import com.example.demo.domain.entity.Role; |
|
|
|
import com.example.demo.domain.vo.ConsumeUser; |
|
|
|
import com.example.demo.domain.vo.MenuVo; |
|
|
|
import com.example.demo.domain.vo.Result; |
|
|
|
import com.example.demo.domain.vo.RoleVo; |
|
|
|
import com.example.demo.mapper.RefundMapper; |
|
|
@ -59,8 +60,7 @@ public class RoleServiceImpl implements RoleService { |
|
|
|
roleVo.setId(role.getId()); |
|
|
|
} |
|
|
|
menuService.addPermission(roleVo); |
|
|
|
}catch (Exception e) |
|
|
|
{ |
|
|
|
} catch (Exception e) { |
|
|
|
return Result.error("添加失败"); |
|
|
|
} |
|
|
|
|
|
|
@ -83,6 +83,13 @@ public class RoleServiceImpl implements RoleService { |
|
|
|
public PageInfo<RoleVo> selectBy(Integer pageNum, Integer pageSize, RoleVo roleVo) { |
|
|
|
PageHelper.startPage(pageNum, pageSize); |
|
|
|
List<RoleVo> roleVos = roleMapper.selectBy(roleVo); |
|
|
|
// 遍历 roleVos 列表 |
|
|
|
for (RoleVo role : roleVos) { |
|
|
|
// 获取每个角色的权限树 |
|
|
|
List<MenuVo> permissionTree = menuService.getPermissionTree(role.getId()); |
|
|
|
// 将权限树设置到角色对象中 |
|
|
|
role.setTree(permissionTree); |
|
|
|
} |
|
|
|
return new PageInfo<>(roleVos); |
|
|
|
} |
|
|
|
} |
|
|
|