public ShopAdmin getAdmin(HttpServletRequest request, HttpServletResponse response, Website web) { Long webId = web.getId(); Long adminId = (Long) session.getAttribute(request, SESSION_ADMIN_ID_KEY); ShopAdmin admin; if (adminId != null) { admin = shopAdminMng.findById(adminId); if (admin != null && admin.getWebsite().getId().equals(webId)) { // 本站管理员 return admin; } else { // 其他站点跳转而来 Long userId = admin.getAdmin().getUser().getId(); admin = shopAdminMng.getByUserId(userId, webId); return admin; } } return null; }