|
@@ -30,7 +30,7 @@ public class UserRoleServiceImpl extends ServiceImpl<UserRoleMapper, UserRole> i
|
|
|
private MenusServiceImpl menusService;
|
|
|
|
|
|
public List<UserRole> roles(){
|
|
|
- return list().stream().peek(role -> {
|
|
|
+ return lambdaQuery().gt(UserRole::getRoleId, 1).list().stream().peek(role -> {
|
|
|
role.setMenus(menusService.lambdaQuery().in(Menus::getId, Arrays.asList(role.getMenuId().split(","))).list());
|
|
|
}).collect(Collectors.toList());
|
|
|
}
|
|
@@ -44,7 +44,7 @@ public class UserRoleServiceImpl extends ServiceImpl<UserRoleMapper, UserRole> i
|
|
|
|
|
|
public void updateRole(RoleDTO roleDTO){
|
|
|
UserRole ur = getById(roleDTO.getId());
|
|
|
- if (null == ur){
|
|
|
+ if (roleDTO.getId() <= 1 || null == ur){
|
|
|
throw new BizException("角色不存在");
|
|
|
}
|
|
|
ur.setName(roleDTO.getName());
|
|
@@ -53,6 +53,9 @@ public class UserRoleServiceImpl extends ServiceImpl<UserRoleMapper, UserRole> i
|
|
|
}
|
|
|
|
|
|
public void deleteRole(Integer id){
|
|
|
+ if (id <= 1){
|
|
|
+ throw new BizException("角色不存在");
|
|
|
+ }
|
|
|
removeById(id);
|
|
|
}
|
|
|
|