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

/**
     * 跳转到频道页面
     * @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;
    }
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值