若依跳过权限验证(进阶版)
首先使用这个方法把路径
添加:
(放开区域自己定)
//部门树形图接口开放
.antMatchers("/system/user/**","/system/user", "/deptList").permitAll()
添加代码进入:
@PostMapping("/deptList")
public AjaxResult deptList(SysDept dept)
{
return success(deptService.selectDeptList2(dept));
}
添加代码
(加了一个新service,要问为什么不用自带的查询service,这里讲解一下:若依自己写了一个注解@DataScope(deptAlias = “d”)链接如下身份权限设置了,显示效果,简单起见,这里直接新开一路,不让身份权限影响运行效果。)
/**
* 查询部门管理数据
*
* @param dept 部门信息
* @return 部门信息集合
*/
public List<SysDept> selectDeptList2(SysDept dept);
添加代码
/**
* 查询部门管理数据(无权限)
*
* @param dept 部门信息
* @return 部门信息集合
*/
@Override
public List<SysDept> selectDeptList2(SysDept dept)
{
return deptMapper.selectDeptList(dept);
}
最后可以实现跳过权限验证访问部门属性图!