Example #1
0
 @RequestMapping("/search/{con}")
 public String search(@PathVariable String con, Model model) {
   SystemContext.setOrder("asc");
   SystemContext.setSort("c.orders");
   model.addAttribute("cs", channelService.listChannelByType(ChannelType.NAV_CHANNEL));
   SystemContext.setOrder("desc");
   SystemContext.setSort("t.publishDate");
   Pager<Topic> topics = topicService.searchTopic(con);
   emp(topics, con);
   model.addAttribute("datas", topics);
   model.addAttribute("con", con);
   return "index/search";
 }
Example #2
0
 @RequestMapping("/channel/{cid}")
 public String showChannel(
     @PathVariable int cid, Model model, HttpServletResponse resp, HttpServletRequest req)
     throws IOException {
   Channel c = channelService.load(cid);
   System.out.println(c.getType());
   Channel pc = null;
   if (c.getType() == ChannelType.NAV_CHANNEL) {
     pc = c;
     // 如果是导航栏目,需要获取该栏目中的第一个栏目
     c = channelService.loadFirstChannelByNav(c.getId());
   } else {
     pc = c.getParent();
   }
   //		System.out.println(c.getType()==ChannelType.TOPIC_LIST);
   //		System.out.println(c.getType());
   if (c.getType() == ChannelType.TOPIC_CONTENT) {
     resp.sendRedirect(
         req.getContextPath() + "/topic/" + topicService.loadLastedTopicByColumn(cid).getId());
   } else if (c.getType() == ChannelType.TOPIC_IMG) {
     SystemContext.setPageSize(16);
     SystemContext.setSort("a.topic.publishDate");
     SystemContext.setOrder("desc");
     Pager<Attachment> atts = attachmentService.findChannelPic(cid);
     model.addAttribute("datas", atts);
   } else if (c.getType() == ChannelType.TOPIC_LIST) {
     SystemContext.setSort("t.publishDate");
     SystemContext.setOrder("desc");
     // System.out.println(c.getType());
     model.addAttribute("datas", topicService.find(c.getId(), null, 1));
   }
   SystemContext.removeSort();
   SystemContext.removeOrder();
   model.addAttribute("pc", pc);
   model.addAttribute("cs", channelService.listUseChannelByParent(pc.getId()));
   model.addAttribute("channel", c);
   if (c.getType() == ChannelType.TOPIC_LIST) {
     return "index/channel";
   } else {
     return "index/channel_pic";
   }
 }
Example #3
0
 @RequestMapping("/keyword/{con}")
 public String keyword(@PathVariable String con, Model model) {
   model.addAttribute("kws", keywordService.getMaxTimesKeyword(9));
   SystemContext.setOrder("desc");
   SystemContext.setSort("t.publishDate");
   Pager<Topic> topics = topicService.searchTopicByKeyword(con);
   emp(topics, con);
   model.addAttribute("datas", topics);
   model.addAttribute("con", con);
   return "index/keyword";
 }