Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
solo-1
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
solo-1
Commits
9ccf83a1
Unverified
Commit
9ccf83a1
authored
May 17, 2018
by
Liang Ding
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
🎨
#12412
parent
b6ca6eea
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
14 deletions
+2
-14
src/main/java/org/b3log/solo/service/ArticleQueryService.java
...main/java/org/b3log/solo/service/ArticleQueryService.java
+2
-14
No files found.
src/main/java/org/b3log/solo/service/ArticleQueryService.java
View file @
9ccf83a1
...
...
@@ -53,7 +53,7 @@ import static org.b3log.solo.model.Article.*;
* @author <a href="http://blog.sweelia.com">ArmstrongCN</a>
* @author <a href="http://zephyr.b3log.org">Zephyr</a>
* @author <a href="http://vanessa.b3log.org">Liyuan Li</a>
* @version 1.3.2.
1
, May 17, 2018
* @version 1.3.2.
2
, May 17, 2018
* @since 0.3.5
*/
@Service
...
...
@@ -616,17 +616,9 @@ public class ArticleQueryService {
query
.
addSort
(
ARTICLE_CREATE_DATE
,
SortDirection
.
DESCENDING
);
}
int
articleCount
=
statisticQueryService
.
getBlogArticleCount
();
final
String
keyword
=
requestJSONObject
.
optString
(
Common
.
KEYWORD
);
if
(
StringUtils
.
isBlank
(
keyword
))
{
query
.
setFilter
(
new
PropertyFilter
(
ARTICLE_IS_PUBLISHED
,
FilterOperator
.
EQUAL
,
articleIsPublished
));
if
(!
articleIsPublished
)
{
articleCount
-=
statisticQueryService
.
getPublishedBlogArticleCount
();
}
else
{
articleCount
=
statisticQueryService
.
getPublishedBlogArticleCount
();
}
}
else
{
query
.
setFilter
(
CompositeFilterOperator
.
and
(
new
PropertyFilter
(
ARTICLE_IS_PUBLISHED
,
FilterOperator
.
EQUAL
,
articleIsPublished
),
...
...
@@ -635,15 +627,11 @@ public class ArticleQueryService {
new
PropertyFilter
(
ARTICLE_TAGS_REF
,
FilterOperator
.
LIKE
,
"%"
+
keyword
+
"%"
)
)
));
articleCount
=
pageSize
;
}
final
int
pageCount
=
(
int
)
Math
.
ceil
((
double
)
articleCount
/
(
double
)
pageSize
);
query
.
setPageCount
(
pageCount
);
final
JSONObject
result
=
articleRepository
.
get
(
query
);
final
int
pageCount
=
result
.
optJSONObject
(
Pagination
.
PAGINATION
).
optInt
(
Pagination
.
PAGINATION_PAGE_COUNT
);
final
JSONObject
pagination
=
new
JSONObject
();
ret
.
put
(
Pagination
.
PAGINATION
,
pagination
);
final
List
<
Integer
>
pageNums
=
Paginator
.
paginate
(
currentPageNum
,
pageSize
,
pageCount
,
windowSize
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment