Exemple #1
0
 /**
  * find all with order
  *
  * @param order
  * @return
  */
 public List<BlogTypeModel> findAll(String order) {
   StringBuilder sb = new StringBuilder("select * from t_blog_type ");
   if (QStringUtil.isEmpty(order)) {
     return dao.find(sb.append("order by cdate desc").toString());
   } else {
     return dao.find(sb.append(order).toString());
   }
 }
Exemple #2
0
  /** 跳转到博客详情页面 */
  public void detail() {
    try {
      String blogCode = getPara();
      if (QStringUtil.notEmpty(blogCode)) {
        BlogArticleModel blog = BlogArticleModel.dao.findByCode(blogCode);
        blog.set("blog_article_read_times", ((Integer) blog.get("blog_article_read_times") + 1))
            .update();

        setAttr("blog", blog);
        setAttr("prevBlog", getBlog("prev", blog));
        setAttr("nextBlog", getBlog("next", blog));

        render("/WEB-INF/view/fore/blog/blog-detail.html");
        return;
      }
    } catch (Exception e) {
      e.printStackTrace();
    }

    redirect("/blog/list");
  }