|
@@ -780,5 +780,29 @@ public class ArticleTweetImplDao implements ArticleTweetDao {
|
|
|
return namedParameterJdbcTemplate.queryForInt(sql, sps);
|
|
return namedParameterJdbcTemplate.queryForInt(sql, sps);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 获取点赞数最多的最新推文数据
|
|
|
|
|
+ */
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public List<ArticleLikeMaxVo> queryTop3ArticleLike() {
|
|
|
|
|
+ String sql = "select t.id,t.townId,t.townName,t.title,t.content from (select at.id,at.location_id as townId,hd.name as townName,at.title,at.content,(select Count(*) from article_likes where is_lose = 0 and article_id = at.id) as like_num,at.create_date\n" +
|
|
|
|
|
+ "from article_tweet at\n" +
|
|
|
|
|
+ "left join hotel_dict hd on hd.id = at.location_id\n" +
|
|
|
|
|
+ "where at.approve = 2) t\n" +
|
|
|
|
|
+ "order by t.like_num desc,t.create_date desc LIMIT 3";
|
|
|
|
|
+ MapSqlParameterSource sps = new MapSqlParameterSource();
|
|
|
|
|
+ List<ArticleLikeMaxVo> list = null;
|
|
|
|
|
+ try {
|
|
|
|
|
+ list = namedParameterJdbcTemplate.query(sql, sps,
|
|
|
|
|
+ new BeanPropertyRowMapper<>(ArticleLikeMaxVo.class));
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ e.printStackTrace();
|
|
|
|
|
+ }
|
|
|
|
|
+ if (list != null && list.size() > 0) {
|
|
|
|
|
+ return list;
|
|
|
|
|
+ }
|
|
|
|
|
+ return null;
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
}
|
|
}
|