@RequestMapping("/page") public R page(@RequestParam Map<String, Object> params, HttpServletRequest request){ logger.debug("page方法:,,Controller:{},,params:{}",this.getClass().getName(),JSONObject.toJSONString(params)); String role = String.valueOf(request.getSession().getAttribute("role")); if(false) return R.error(511,"永不会进入"); else if("老师".equals(role)){ params.put("laoshiId",request.getSession().getAttribute("userId")); LaoshiEntity laoshiEntity = laoshiService.selectById(Integer.valueOf(String.valueOf(request.getSession().getAttribute("userId")))); if(laoshiEntity == null) return R.error("查不到登录的老师"); params.put("yuanxiTypes", laoshiEntity.getYuanxiTypes()); } if(params.get("orderBy")==null || params.get("orderBy")==""){ params.put("orderBy","id"); } PageUtils page = banjiService.queryPage(params); //字典表数据转换 List<BanjiView> list =(List<BanjiView>)page.getList(); for(BanjiView c:list){ //修改对应字典表字段 dictionaryService.dictionaryConvert(c, request); } return R.ok().put("data", page); }把这段代码改为不需要权限验证
时间: 2024-02-22 15:00:45 浏览: 72
快速解决SpringMVC @RequestBody 用map接收请求参数的问题
可以直接去掉第4行的权限验证代码,即将代码修改为:
```
@RequestMapping("/page")
public R page(@RequestParam Map<String, Object> params, HttpServletRequest request){
logger.debug("page方法:,,Controller:{},,params:{}",this.getClass().getName(),JSONObject.toJSONString(params));
if(params.get("orderBy")==null || params.get("orderBy")==""){
params.put("orderBy","id");
}
PageUtils page = banjiService.queryPage(params);
//字典表数据转换
List<BanjiView> list =(List<BanjiView>)page.getList();
for(BanjiView c:list){
//修改对应字典表字段
dictionaryService.dictionaryConvert(c, request);
}
return R.ok().put("data", page);
}
```
这样就可以去掉权限验证了。
阅读全文