|
@@ -18,7 +18,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
/**
|
|
|
* Service: re_role_menu -- app用户菜单中间表
|
|
|
- * @author qzy
|
|
|
+ * @author qzy
|
|
|
*/
|
|
|
@Service
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@@ -52,10 +52,10 @@ public class ReRoleMenuService extends ServiceImpl<ReRoleMenuMapper, ReRoleMenu>
|
|
|
return super.getById(id);
|
|
|
}
|
|
|
|
|
|
- /** 查集合 - 根据条件(参数为空时代表忽略指定条件) */
|
|
|
+ /** 查集合 - 根据条件(参数为空时代表忽略指定条件) */
|
|
|
List<ReRoleMenu> getList(SoMap so,Integer appRoleId) {
|
|
|
so.set("app_role_id",appRoleId);
|
|
|
- return reRoleMenuMapper.getList(so);
|
|
|
+ return reRoleMenuMapper.getList(so);
|
|
|
}
|
|
|
|
|
|
|
|
@@ -66,19 +66,22 @@ public class ReRoleMenuService extends ServiceImpl<ReRoleMenuMapper, ReRoleMenu>
|
|
|
//app_menu的主键进行去重
|
|
|
List<Long> permissionsDtoList = assignPermissionsDto.getList().stream().distinct().collect(Collectors.toList());
|
|
|
//情况1:传进来的集合为空,默认删除该职务下属的所有权限
|
|
|
- if(permissionsDtoList.size() == 0){
|
|
|
+ //if(permissionsDtoList.size() == 0){
|
|
|
//删除所有权限
|
|
|
- List<Long> perList = methodRoleMenuService.getPerList(roleId);
|
|
|
+ //List<Long> perList = methodRoleMenuService.getPerList(roleId);
|
|
|
//清除
|
|
|
- int i = reRoleMenuMapper.deleteBatchIds(perList);
|
|
|
- return i == perList.size();
|
|
|
- }
|
|
|
+ //int i = reRoleMenuMapper.deleteBatchIds(perList);
|
|
|
+ //return i == perList.size();
|
|
|
+ //int i = reRoleMenuMapper.delete(new LambdaQueryWrapper<ReRoleMenu>().eq(ReRoleMenu::getAppRoleId, roleId));
|
|
|
+ //return true;
|
|
|
+ //}
|
|
|
//情况2: 传进来的集合不为空
|
|
|
//2.1 先清除该职务的权限
|
|
|
- List<Long> perList = methodRoleMenuService.getPerList(roleId);
|
|
|
+ //List<Long> perList = methodRoleMenuService.getPerList(roleId);
|
|
|
//执行清除
|
|
|
- int i = reRoleMenuMapper.deleteBatchIds(perList);
|
|
|
- if(i != perList.size())throw new RuntimeException("权限分配失败Ⅰ!");
|
|
|
+ //int i = reRoleMenuMapper.deleteBatchIds(perList);
|
|
|
+ //if(i != perList.size())throw new RuntimeException("权限分配失败Ⅰ!");
|
|
|
+ int i = reRoleMenuMapper.delete(new LambdaQueryWrapper<ReRoleMenu>().eq(ReRoleMenu::getAppRoleId, roleId));
|
|
|
//2.2 再添加新的权限给到该职务
|
|
|
//定义计数器
|
|
|
int count = 0;
|
|
@@ -90,6 +93,6 @@ public class ReRoleMenuService extends ServiceImpl<ReRoleMenuMapper, ReRoleMenu>
|
|
|
|
|
|
return count == permissionsDtoList.size();
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
|
|
|
}
|