一个SpringMVC下的多参数传递注解

来源:互联网 发布:us域名被墙 编辑:程序博客网 时间:2024/06/05 05:25
/**     * 跳转到频道页面     * @return     */    @RequestMapping("channel/{id}/{modules}")    public ModelAndView channel(@PathVariable String id,@PathVariable String modules){        Map<String,Object> paramMap = new HashMap<String,Object>();        ModelAndView mav = new ModelAndView();        Map<ChannelInfo,List<ChannelInfo>> menuMap = new LinkedHashMap<ChannelInfo,List<ChannelInfo>>();        // 获取首页左侧菜单的栏目        List<ChannelInfo> preList =  channelService.getPre();        for(ChannelInfo bean:preList){            List<ChannelInfo> childList = channelService.getChildByPre(bean.getId()+"");            menuMap.put(bean, childList);        }        Page p = new Page();        p.setCurrentPage(1);        p.setPageSize(10);        // 获取推荐文章        paramMap.put("type", 1);        Page tjPage = indexService.getNewsInfoArticleList(paramMap, p);        // 获取热点文章        paramMap.put("type", 2);        Page rdPage = indexService.getNewsInfoArticleList(paramMap, p);        // 获取头条文章        paramMap.put("type", 3);        Page ttPage = indexService.getNewsInfoArticleList(paramMap, p);        // 获取专家观点        paramMap.put("type", 4);        paramMap.put("channelId", 15);        Page zjPage = indexService.getNewsInfoArticleList(paramMap, p);        // 获取会展活动        paramMap.put("channelId", 36);        Page hzPage = indexService.getNewsInfoArticleList(paramMap, p);        // 获取热门标签        Page bqPage = keywordService.getKeyword(p);        // 获取子栏目        List<ChannelInfo> channelList = channelService.getChildByPre(id);        // 获取当前栏目        ChannelInfo channelInfo = channelService.getInfoById(Integer.parseInt(id));        // 获取文章列表        p.setPageSize(6);        paramMap.put("type", 5);        paramMap.put("modules", modules);        Page newsPage  = indexService.getNewsInfoArticleList(paramMap, p);        mav.addObject("tjPage", tjPage);        mav.addObject("ttPage", ttPage);        mav.addObject("rdPage", rdPage);        mav.addObject("zjPage", zjPage);        mav.addObject("hzPage", hzPage);        mav.addObject("bqPage", bqPage);        mav.addObject("newsPage", newsPage);        // 添加左侧栏目        mav.addObject("menuMap", menuMap);        mav.addObject("channelList", channelList);        mav.addObject("id", id);        mav.addObject("channelInfo", channelInfo);        mav.setViewName("channel/channel");        return mav;    }
0 0
原创粉丝点击