Ejemplo n.º 1
0
 /** 统计三个问题的总量和最新评论 */
 public void publicLoad() throws Exception {
   postNum[0] = postService.listActivePost(null).size();
   postNum[1] = postService.listSolvedPost(null).size();
   postNum[2] = postService.listHotPost(null).size();
   PageBean page = new PageBean();
   page.setPageSize(10);
   newReplyColl = replyService.listReply(page);
 }
Ejemplo n.º 2
0
 /** 根据标题关键字模糊查找问题 */
 public String findPost() throws Exception {
   publicLoad();
   if (pageBean == null) {
     pageBean = new PageBean();
   }
   postColl = postService.searchPostByTitleKey(keyword, pageBean);
   return "success";
 }
Ejemplo n.º 3
0
 /** 进入已解决问题页 */
 public String solvedPost() throws Exception {
   publicLoad();
   if (pageBean == null) {
     pageBean = new PageBean();
   }
   postColl = postService.listSolvedPost(pageBean);
   return "success";
 }
Ejemplo n.º 4
0
 /** 保存问题 */
 public String savePost() throws Exception {
   Map<String, Object> session = ActionContext.getContext().getSession();
   if (!session.containsKey("loginId")) {
     return "fail";
   }
   Integer userId = (Integer) session.get("loginId");
   User user = userService.loadUser(userId);
   post.setUser(user);
   post.setAnswerNum(0);
   post.setPostPraiseNum(0);
   post.setPostReadNum(0);
   post.setPostTime(TimeBean.getCurrenTime());
   postService.savePost(post);
   return "success";
 }
Ejemplo n.º 5
0
 /** 显示问题 */
 public String showPost() throws Exception {
   publicLoad();
   replyColl = replyService.searchReplyByPost(id);
   post = postService.loadPost(id);
   return "success";
 }