Browse Source

更新文件 ArticleTweetImplDao.java

陈士柏 2 years ago
parent
commit
bc5f35277d
1 changed files with 12 additions and 3 deletions
  1. 12 3
      mhotel/src/com/happy/dao/impl/ArticleTweetImplDao.java

+ 12 - 3
mhotel/src/com/happy/dao/impl/ArticleTweetImplDao.java

@@ -201,9 +201,10 @@ public class ArticleTweetImplDao implements ArticleTweetDao {
     }
     }
 
 
     public int updateArticleTop(ArticleTweet articleTweet) {
     public int updateArticleTop(ArticleTweet articleTweet) {
-        String sql = "update article_tweet set is_top=:isTop where id = :id";
+        String sql = "update article_tweet set is_top=:isTop,create_date=:createDate where id = :id";
         MapSqlParameterSource sps = new MapSqlParameterSource();
         MapSqlParameterSource sps = new MapSqlParameterSource();
         sps.addValue("isTop", articleTweet.getIsTop());
         sps.addValue("isTop", articleTweet.getIsTop());
+        sps.addValue("createDate", articleTweet.getCreateDate());
         sps.addValue("id", articleTweet.getId());
         sps.addValue("id", articleTweet.getId());
         int num = 0;
         int num = 0;
         try {
         try {
@@ -595,7 +596,7 @@ public class ArticleTweetImplDao implements ArticleTweetDao {
                 leftSql +
                 leftSql +
                 innSql +
                 innSql +
                 "where at.approve = 2 " + sqlWhere +
                 "where at.approve = 2 " + sqlWhere +
-                "order by at.create_date desc ";
+                "order by at.is_top desc,at.create_date desc ";
         MapSqlParameterSource sps = new MapSqlParameterSource();
         MapSqlParameterSource sps = new MapSqlParameterSource();
         sps.addValue("start", start);
         sps.addValue("start", start);
         sps.addValue("rows", rows);
         sps.addValue("rows", rows);
@@ -927,7 +928,7 @@ public class ArticleTweetImplDao implements ArticleTweetDao {
                 "from article_tweet at\n" +
                 "from article_tweet at\n" +
                 "left join hotel_dict hd on hd.id = at.location_id\n" +
                 "left join hotel_dict hd on hd.id = at.location_id\n" +
                 "where at.approve = 2) t\n" +
                 "where at.approve = 2) t\n" +
-                "order by t.like_num desc,t.create_date desc LIMIT 3";
+                "order by at.is_top desc, t.like_num desc,t.create_date desc LIMIT 3";
         MapSqlParameterSource sps = new MapSqlParameterSource();
         MapSqlParameterSource sps = new MapSqlParameterSource();
         List<ArticleLikeMaxVo> list = null;
         List<ArticleLikeMaxVo> list = null;
         try {
         try {
@@ -958,4 +959,12 @@ public class ArticleTweetImplDao implements ArticleTweetDao {
         return null;
         return null;
     }
     }
 
 
+    public int updateUser(Admin admin){
+        String sql = "update `admin` set user_id=:userId where id=:id ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("userId", admin.getUserId());
+        sps.addValue("id", admin.getId());
+        return namedParameterJdbcTemplate.update(sql, sps);
+    }
+
 }
 }