同学好,其实同学站在业务的角度来理解,就比较容易理解了,这里你创建了多个店铺后,在shoplist的页面选择其中一个店铺,就会来到这个店铺的管理控制台,那么选择店铺的时候,咱们就会把currentShop给设置到session里,后面就直接从session取就好了。
@RequestMapping(value = "/getshopmanagementinfo", method = RequestMethod.GET)
@ResponseBody
private Map<String, Object> getShopManagementInfo(HttpServletRequest request) {
Map<String, Object> modelMap = new HashMap<String, Object>();
long shopId = HttpServletRequestUtil.getLong(request, "shopId");
if (shopId <= 0) {
Object currentShopObj = request.getSession().getAttribute("currentShop");
if (currentShopObj == null) {
modelMap.put("redirect", true);
modelMap.put("url", "/myo2o/shopadmin/shoplist");
} else {
Shop currentShop = (Shop) currentShopObj;
modelMap.put("redirect", false);
modelMap.put("shopId", currentShop.getShopId());
}
} else {
Shop currentShop = new Shop();
currentShop.setShopId(shopId);
request.getSession().setAttribute("currentShop", currentShop);
modelMap.put("redirect", false);
}
return modelMap;
}