Example #1
0
  public String save() {
    News news = (News) this.newsService.get(this.newsComment.getNewsId());
    news.setReplyCounts(Integer.valueOf(news.getReplyCounts().intValue() + 1));
    this.newsService.save(news);

    this.newsComment.setAppUser((AppUser) this.appUserService.get(this.newsComment.getUserId()));
    this.newsComment.setCreatetime(new Date());
    this.newsComment.setNews(news);
    this.newsCommentService.save(this.newsComment);
    setJsonString("{success:true}");
    return "success";
  }
Example #2
0
  public String multiDel() {
    String[] ids = getRequest().getParameterValues("ids");
    if (ids != null) {
      for (String id : ids) {
        NewsComment delComment = (NewsComment) this.newsCommentService.get(new Long(id));
        News news = delComment.getNews();
        if (news.getReplyCounts().intValue() > 1) {
          news.setReplyCounts(Integer.valueOf(news.getReplyCounts().intValue() - 1));
        }
        this.newsService.save(news);
        this.newsCommentService.remove(new Long(id));
      }
    }

    this.jsonString = "{success:true}";

    return "success";
  }