Commit 00de0c95 authored by Liang Ding's avatar Liang Ding

🎨 Fix #12622

parent 181039c0
...@@ -29,7 +29,7 @@ import org.json.JSONObject; ...@@ -29,7 +29,7 @@ import org.json.JSONObject;
* Archive date-Article repository. * Archive date-Article repository.
* *
* @author <a href="http://88250.b3log.org">Liang Ding</a> * @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 1.0.0.3, Sep 30, 2018 * @version 1.0.0.4, Jan 15, 2019
* @since 0.3.1 * @since 0.3.1
*/ */
@Repository @Repository
...@@ -66,7 +66,7 @@ public class ArchiveDateArticleRepository extends AbstractRepository { ...@@ -66,7 +66,7 @@ public class ArchiveDateArticleRepository extends AbstractRepository {
public JSONObject getByArchiveDateId(final String archiveDateId, final int currentPageNum, final int pageSize) throws RepositoryException { public JSONObject getByArchiveDateId(final String archiveDateId, final int currentPageNum, final int pageSize) throws RepositoryException {
final Query query = new Query().setFilter(new PropertyFilter(ArchiveDate.ARCHIVE_DATE + "_" + Keys.OBJECT_ID, FilterOperator.EQUAL, archiveDateId)). final Query query = new Query().setFilter(new PropertyFilter(ArchiveDate.ARCHIVE_DATE + "_" + Keys.OBJECT_ID, FilterOperator.EQUAL, archiveDateId)).
addSort(Article.ARTICLE + "_" + Keys.OBJECT_ID, SortDirection.DESCENDING). addSort(Article.ARTICLE + "_" + Keys.OBJECT_ID, SortDirection.DESCENDING).
setCurrentPageNum(currentPageNum).setPageSize(pageSize).setPageCount(1); setPage(currentPageNum, pageSize).setPageCount(1);
return get(query); return get(query);
} }
......
...@@ -206,7 +206,7 @@ public class ArticleRepository extends AbstractRepository { ...@@ -206,7 +206,7 @@ public class ArticleRepository extends AbstractRepository {
final Query query = new Query(). final Query query = new Query().
setFilter(new PropertyFilter(Article.ARTICLE_IS_PUBLISHED, FilterOperator.EQUAL, true)). setFilter(new PropertyFilter(Article.ARTICLE_IS_PUBLISHED, FilterOperator.EQUAL, true)).
addSort(Article.ARTICLE_UPDATED, SortDirection.DESCENDING). addSort(Article.ARTICLE_UPDATED, SortDirection.DESCENDING).
setCurrentPageNum(1).setPageSize(fetchSize).setPageCount(1); setPage(1, fetchSize).setPageCount(1);
return getList(query); return getList(query);
} }
...@@ -223,7 +223,7 @@ public class ArticleRepository extends AbstractRepository { ...@@ -223,7 +223,7 @@ public class ArticleRepository extends AbstractRepository {
addSort(Article.ARTICLE_COMMENT_COUNT, SortDirection.DESCENDING). addSort(Article.ARTICLE_COMMENT_COUNT, SortDirection.DESCENDING).
addSort(Article.ARTICLE_UPDATED, SortDirection.DESCENDING). addSort(Article.ARTICLE_UPDATED, SortDirection.DESCENDING).
setFilter(new PropertyFilter(Article.ARTICLE_IS_PUBLISHED, FilterOperator.EQUAL, true)). setFilter(new PropertyFilter(Article.ARTICLE_IS_PUBLISHED, FilterOperator.EQUAL, true)).
setCurrentPageNum(1).setPageSize(num).setPageCount(1); setPage(1, num).setPageCount(1);
return getList(query); return getList(query);
} }
...@@ -240,7 +240,7 @@ public class ArticleRepository extends AbstractRepository { ...@@ -240,7 +240,7 @@ public class ArticleRepository extends AbstractRepository {
addSort(Article.ARTICLE_VIEW_COUNT, SortDirection.DESCENDING). addSort(Article.ARTICLE_VIEW_COUNT, SortDirection.DESCENDING).
addSort(Article.ARTICLE_UPDATED, SortDirection.DESCENDING). addSort(Article.ARTICLE_UPDATED, SortDirection.DESCENDING).
setFilter(new PropertyFilter(Article.ARTICLE_IS_PUBLISHED, FilterOperator.EQUAL, true)). setFilter(new PropertyFilter(Article.ARTICLE_IS_PUBLISHED, FilterOperator.EQUAL, true)).
setCurrentPageNum(1).setPageSize(num).setPageCount(1); setPage(1, num).setPageCount(1);
return getList(query); return getList(query);
} }
...@@ -269,7 +269,7 @@ public class ArticleRepository extends AbstractRepository { ...@@ -269,7 +269,7 @@ public class ArticleRepository extends AbstractRepository {
new PropertyFilter(Article.ARTICLE_CREATED, FilterOperator.LESS_THAN, currentArticleCreated), new PropertyFilter(Article.ARTICLE_CREATED, FilterOperator.LESS_THAN, currentArticleCreated),
new PropertyFilter(Article.ARTICLE_IS_PUBLISHED, FilterOperator.EQUAL, true))). new PropertyFilter(Article.ARTICLE_IS_PUBLISHED, FilterOperator.EQUAL, true))).
addSort(Article.ARTICLE_CREATED, SortDirection.DESCENDING). addSort(Article.ARTICLE_CREATED, SortDirection.DESCENDING).
setCurrentPageNum(1).setPageSize(1).setPageCount(1). setPage(1, 1).setPageCount(1).
select(Article.ARTICLE_TITLE, Article.ARTICLE_PERMALINK, Article.ARTICLE_ABSTRACT); select(Article.ARTICLE_TITLE, Article.ARTICLE_PERMALINK, Article.ARTICLE_ABSTRACT);
final JSONObject result = get(query); final JSONObject result = get(query);
...@@ -316,7 +316,7 @@ public class ArticleRepository extends AbstractRepository { ...@@ -316,7 +316,7 @@ public class ArticleRepository extends AbstractRepository {
new PropertyFilter(Article.ARTICLE_CREATED, FilterOperator.GREATER_THAN, currentArticleCreated), new PropertyFilter(Article.ARTICLE_CREATED, FilterOperator.GREATER_THAN, currentArticleCreated),
new PropertyFilter(Article.ARTICLE_IS_PUBLISHED, FilterOperator.EQUAL, true))). new PropertyFilter(Article.ARTICLE_IS_PUBLISHED, FilterOperator.EQUAL, true))).
addSort(Article.ARTICLE_CREATED, SortDirection.ASCENDING). addSort(Article.ARTICLE_CREATED, SortDirection.ASCENDING).
setCurrentPageNum(1).setPageSize(1).setPageCount(1). setPage(1, 1).setPageCount(1).
select(Article.ARTICLE_TITLE, Article.ARTICLE_PERMALINK, Article.ARTICLE_ABSTRACT); select(Article.ARTICLE_TITLE, Article.ARTICLE_PERMALINK, Article.ARTICLE_ABSTRACT);
final JSONObject result = get(query); final JSONObject result = get(query);
......
...@@ -29,7 +29,7 @@ import org.json.JSONObject; ...@@ -29,7 +29,7 @@ import org.json.JSONObject;
* Category-Tag relation repository. * Category-Tag relation repository.
* *
* @author <a href="http://88250.b3log.org">Liang Ding</a> * @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 1.1.0.2, Sep 30, 2018 * @version 1.1.0.3, Jan 15, 2019
* @since 2.0.0 * @since 2.0.0
*/ */
@Repository @Repository
...@@ -64,7 +64,7 @@ public class CategoryTagRepository extends AbstractRepository { ...@@ -64,7 +64,7 @@ public class CategoryTagRepository extends AbstractRepository {
*/ */
public JSONObject getByCategoryId(final String categoryId, final int currentPageNum, final int pageSize) throws RepositoryException { public JSONObject getByCategoryId(final String categoryId, final int currentPageNum, final int pageSize) throws RepositoryException {
final Query query = new Query().setFilter(new PropertyFilter(Category.CATEGORY + "_" + Keys.OBJECT_ID, FilterOperator.EQUAL, categoryId)). final Query query = new Query().setFilter(new PropertyFilter(Category.CATEGORY + "_" + Keys.OBJECT_ID, FilterOperator.EQUAL, categoryId)).
setCurrentPageNum(currentPageNum).setPageSize(pageSize).setPageCount(1); setPage(currentPageNum, pageSize).setPageCount(1);
return get(query); return get(query);
} }
...@@ -91,7 +91,7 @@ public class CategoryTagRepository extends AbstractRepository { ...@@ -91,7 +91,7 @@ public class CategoryTagRepository extends AbstractRepository {
*/ */
public JSONObject getByTagId(final String tagId, final int currentPageNum, final int pageSize) throws RepositoryException { public JSONObject getByTagId(final String tagId, final int currentPageNum, final int pageSize) throws RepositoryException {
final Query query = new Query().setFilter(new PropertyFilter(Tag.TAG + "_" + Keys.OBJECT_ID, FilterOperator.EQUAL, tagId)). final Query query = new Query().setFilter(new PropertyFilter(Tag.TAG + "_" + Keys.OBJECT_ID, FilterOperator.EQUAL, tagId)).
setCurrentPageNum(currentPageNum).setPageSize(pageSize).setPageCount(1); setPage(currentPageNum, pageSize).setPageCount(1);
return get(query); return get(query);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment