请稍等 ...
×

采纳答案成功!

向帮助你的同学说点啥吧!感谢那些助人为乐的人

拦截器shoplist无法获取!

老师,我在调试过程中,发现在ShopPermissionIntercept中的shoplist始终为null,所以无论是不是本店铺id下的操作都会返回false,应该怎么解决!我实在没找到问题出在了哪里图片描述

正在回答

插入代码

1回答

同学好,其实问题还是比较简单的,只要站在业务全局就能够清晰的认识到,能取出来的前提是有地方存。

而能获取shopList的地方就是后端管理员展示店铺列表的时候

ShopManagementController里面

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
@RequestMapping(value = "/getshoplist", method = RequestMethod.GET)
@ResponseBody
private Map<String, Object> getShopList(HttpServletRequest request) {
    Map<String, Object> modelMap = new HashMap<String, Object>();
    PersonInfo user = (PersonInfo) request.getSession().getAttribute("user");
    try {
        Shop shopCondition = new Shop();
        shopCondition.setOwner(user);
        ShopExecution se = shopService.getShopList(shopCondition, 0100);
        modelMap.put("shopList", se.getShopList());
        // 列出店铺成功之后,将店铺放入session中作为权限验证依据,即该帐号只能操作它自己的店铺
        request.getSession().setAttribute("shopList", se.getShopList());
        modelMap.put("user", user);
        modelMap.put("success"true);
    catch (Exception e) {
        modelMap.put("success"false);
        modelMap.put("errMsg", e.getMessage());
    }
    return modelMap;
}


0 回复 有任何疑惑可以回复我~
  • 提问者 PangShll #1
    非常感谢!翔哥!
    回复 有任何疑惑可以回复我~ 2019-05-07 01:48:45
  • dzsam #2
    我也是这个问题,不知道哪一步没跟上。。
    回复 有任何疑惑可以回复我~ 2021-06-09 13:03:51
问题已解决,确定采纳
还有疑问,暂不采纳
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号