Browse Source

--update queryFindHot();

zzy.zhiyuan.foxmail 7 years ago
parent
commit
5272facca3
1 changed files with 11 additions and 7 deletions
  1. 11 7
      src/main/java/com/ekexiu/portal/dao/ArticleDao.java

+ 11 - 7
src/main/java/com/ekexiu/portal/dao/ArticleDao.java

@ -839,10 +839,10 @@ public abstract class ArticleDao {
839 839
        boolean firstPage = (1 == pageNo);
840 840
        if(firstPage){
841 841
        	queryResult.setPageNo(1);
842
        	sql = "(SELECT ARTICLE_ID,ARTICLE_TITLE,ARTICLE_IMG,ARTICLE_TYPE,CREATE_TIME,ORG_ID,PROFESSOR_ID FROM ARTICLE WHERE STATUS = '1')"
842
        	sql = "(SELECT ARTICLE_ID,ARTICLE_TITLE,ARTICLE_IMG,ARTICLE_TYPE,PUBLISH_TIME,ORG_ID,PROFESSOR_ID FROM ARTICLE WHERE STATUS = '1')"
843 843
                + " UNION ALL (SELECT RESOURCE_ID,RESOURCE_NAME,NULL,CASE WHEN RESOURCE_TYPE = '1' THEN '3' WHEN RESOURCE_TYPE = '2' THEN '4' ELSE NULL END,"
844
                + " CREATE_TIME,ORG_ID,PROFESSOR_ID FROM RESOURCE WHERE STATUS = '1')";
845
            sql = sql + " ORDER BY CREATE_TIME DESC ";
844
                + " PUBLISH_TIME,ORG_ID,PROFESSOR_ID FROM RESOURCE WHERE STATUS = '1')";
845
            sql = sql + " ORDER BY PUBLISH_TIME DESC ";
846 846
            sql = sql + " LIMIT " + pageSize;
847 847
        }else{
848 848
            int pageNum = total / pageSize;
@ -855,10 +855,10 @@ public abstract class ArticleDao {
855 855
            queryResult.setPageNo(pageNo);
856 856
            --pageNo;
857 857
            int offset = (pageNo * pageSize);
858
            sql = "(SELECT ARTICLE_ID,ARTICLE_TITLE,ARTICLE_IMG,ARTICLE_TYPE,CREATE_TIME,ORG_ID,PROFESSOR_ID FROM ARTICLE WHERE STATUS = '1')"
858
            sql = "(SELECT ARTICLE_ID,ARTICLE_TITLE,ARTICLE_IMG,ARTICLE_TYPE,PUBLISH_TIME,ORG_ID,PROFESSOR_ID FROM ARTICLE WHERE STATUS = '1')"
859 859
                + " UNION ALL (SELECT RESOURCE_ID,RESOURCE_NAME,NULL,CASE WHEN RESOURCE_TYPE = '1' THEN '3' WHEN RESOURCE_TYPE = '2' THEN '4' ELSE NULL END,"
860
                + " CREATE_TIME,ORG_ID,PROFESSOR_ID FROM RESOURCE WHERE STATUS = '1')";
861
            sql = sql + " ORDER BY CREATE_TIME DESC ";
860
                + " PUBLISH_TIME,ORG_ID,PROFESSOR_ID FROM RESOURCE WHERE STATUS = '1')";
861
            sql = sql + " ORDER BY PUBLISH_TIME DESC ";
862 862
            sql = sql + " LIMIT " + pageSize+ " OFFSET " + offset;
863 863
        }
864 864
        ps = con.prepareStatement(sql);
@ -879,7 +879,11 @@ public abstract class ArticleDao {
879 879
                    }
880 880
                    findInfo.setImage(image);
881 881
                    findInfo.setType(rs.getString(4));
882
                    findInfo.setCreateTime(rs.getString(5));
882
                    String createTime = rs.getString(5);
883
                    if(rs.wasNull()){
884
                    	createTime = null;
885
                    }
886
                    findInfo.setCreateTime(createTime);
883 887
                    String orgId = rs.getString(6);
884 888
                    if(rs.wasNull()){
885 889
                    	findInfo.setOwner(rs.getString(7));