Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
beyond-clouds
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
4
Issues
4
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
段启岩
beyond-clouds
Commits
0af1ef08
Commit
0af1ef08
authored
Feb 01, 2020
by
段启岩
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化PageVO
parent
80c24924
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
19 additions
and
76 deletions
+19
-76
src/main/java/cn/meteor/beyondclouds/modules/blog/api/BlogApi.java
+6
-12
src/main/java/cn/meteor/beyondclouds/modules/project/api/ProjectApi.java
+3
-9
src/main/java/cn/meteor/beyondclouds/modules/project/api/ProjectCommentApi.java
+1
-3
src/main/java/cn/meteor/beyondclouds/modules/question/api/QuestionApi.java
+5
-13
src/main/java/cn/meteor/beyondclouds/modules/question/vo/PageVO.java
+0
-23
src/main/java/cn/meteor/beyondclouds/modules/user/api/UserApi.java
+4
-16
No files found.
src/main/java/cn/meteor/beyondclouds/modules/blog/api/BlogApi.java
View file @
0af1ef08
...
...
@@ -87,10 +87,8 @@ public class BlogApi {
@ApiOperation
(
"博客列表"
)
@GetMapping
(
"/blogs"
)
public
Response
<
PageVO
<
Blog
>>
getBlogs
(
@Valid
PageForm
pageForm
)
{
IPage
<
Blog
>
blogIPage
=
blogService
.
getBlogPage
(
pageForm
.
getPage
(),
pageForm
.
getSize
());
PageVO
<
Blog
>
blogPageVO
=
new
PageVO
<>();
blogPageVO
.
setTotalPage
(
blogIPage
.
getPages
());
blogPageVO
.
setDataList
(
blogIPage
.
getRecords
());
IPage
<
Blog
>
blogPage
=
blogService
.
getBlogPage
(
pageForm
.
getPage
(),
pageForm
.
getSize
());
PageVO
<
Blog
>
blogPageVO
=
new
PageVO
<>(
blogPage
);
return
Response
.
success
(
blogPageVO
);
}
...
...
@@ -103,10 +101,8 @@ public class BlogApi {
@ApiOperation
(
"我的博客列表"
)
@GetMapping
(
"/my/blogs"
)
public
Response
<
PageVO
<
Blog
>>
getMyBlogs
(
@Valid
PageForm
pageForm
,
@CurrentSubject
Subject
subject
)
{
IPage
<
Blog
>
blogIPage
=
blogService
.
getUserBlogPage
(
pageForm
.
getPage
(),
pageForm
.
getSize
(),
(
String
)
subject
.
getId
());
PageVO
<
Blog
>
blogPageVO
=
new
PageVO
<>();
blogPageVO
.
setTotalPage
(
blogIPage
.
getPages
());
blogPageVO
.
setDataList
(
blogIPage
.
getRecords
());
IPage
<
Blog
>
blogPage
=
blogService
.
getUserBlogPage
(
pageForm
.
getPage
(),
pageForm
.
getSize
(),
(
String
)
subject
.
getId
());
PageVO
<
Blog
>
blogPageVO
=
new
PageVO
<>(
blogPage
);
return
Response
.
success
(
blogPageVO
);
}
...
...
@@ -120,10 +116,8 @@ public class BlogApi {
@ApiOperation
(
"他人博客列表"
)
@GetMapping
(
"/user/{userId}/blogs"
)
public
Response
<
PageVO
<
Blog
>>
getMyBlogs
(
@Valid
PageForm
pageForm
,
@PathVariable
(
"userId"
)
String
userId
)
{
IPage
<
Blog
>
blogIPage
=
blogService
.
getUserBlogPage
(
pageForm
.
getPage
(),
pageForm
.
getSize
(),
userId
);
PageVO
<
Blog
>
blogPageVO
=
new
PageVO
<>();
blogPageVO
.
setTotalPage
(
blogIPage
.
getPages
());
blogPageVO
.
setDataList
(
blogIPage
.
getRecords
());
IPage
<
Blog
>
blogPage
=
blogService
.
getUserBlogPage
(
pageForm
.
getPage
(),
pageForm
.
getSize
(),
userId
);
PageVO
<
Blog
>
blogPageVO
=
new
PageVO
<>(
blogPage
);
return
Response
.
success
(
blogPageVO
);
}
...
...
src/main/java/cn/meteor/beyondclouds/modules/project/api/ProjectApi.java
View file @
0af1ef08
...
...
@@ -149,9 +149,7 @@ public class ProjectApi {
public
Response
<
PageVO
<
Project
>>
getProjects
(
@Valid
PageForm
pageForm
)
{
// 获取列表并返回
IPage
<
Project
>
projectPage
=
projectService
.
getProjectPage
(
pageForm
.
getPage
(),
pageForm
.
getSize
());
PageVO
<
Project
>
projectPageVO
=
new
PageVO
<>();
projectPageVO
.
setTotalPage
(
projectPage
.
getPages
());
projectPageVO
.
setDataList
(
projectPage
.
getRecords
());
PageVO
<
Project
>
projectPageVO
=
new
PageVO
<>(
projectPage
);
return
Response
.
success
(
projectPageVO
);
}
...
...
@@ -165,9 +163,7 @@ public class ProjectApi {
public
Response
<
PageVO
<
Project
>>
getMyProjects
(
@Valid
PageForm
pageForm
,
@CurrentSubject
Subject
subject
)
{
// 根据用户获取列表并返回
IPage
<
Project
>
projectPage
=
projectService
.
getProjectPage
(
pageForm
.
getPage
(),
pageForm
.
getSize
(),
(
String
)
subject
.
getId
());
PageVO
<
Project
>
projectPageVO
=
new
PageVO
<>();
projectPageVO
.
setTotalPage
(
projectPage
.
getPages
());
projectPageVO
.
setDataList
(
projectPage
.
getRecords
());
PageVO
<
Project
>
projectPageVO
=
new
PageVO
<>(
projectPage
);
return
Response
.
success
(
projectPageVO
);
}
...
...
@@ -183,9 +179,7 @@ public class ProjectApi {
@PathVariable
(
"userId"
)
String
userId
)
{
// 根据用户获取列表并返回
IPage
<
Project
>
projectPage
=
projectService
.
getProjectPage
(
pageForm
.
getPage
(),
pageForm
.
getSize
(),
userId
);
PageVO
<
Project
>
projectPageVO
=
new
PageVO
<>();
projectPageVO
.
setTotalPage
(
projectPage
.
getPages
());
projectPageVO
.
setDataList
(
projectPage
.
getRecords
());
PageVO
<
Project
>
projectPageVO
=
new
PageVO
<>(
projectPage
);
return
Response
.
success
(
projectPageVO
);
}
}
src/main/java/cn/meteor/beyondclouds/modules/project/api/ProjectCommentApi.java
View file @
0af1ef08
...
...
@@ -87,9 +87,7 @@ public class ProjectCommentApi {
try
{
// 根据用户获取列表并返回
IPage
<
ProjectComment
>
commentPage
=
projectCommentService
.
getCommentPage
(
pageForm
.
getPage
(),
pageForm
.
getSize
(),
projectId
,
parentId
);
PageVO
<
ProjectComment
>
projectPageVO
=
new
PageVO
<>();
projectPageVO
.
setTotalPage
(
commentPage
.
getPages
());
projectPageVO
.
setDataList
(
commentPage
.
getRecords
());
PageVO
<
ProjectComment
>
projectPageVO
=
new
PageVO
<>(
commentPage
);
return
Response
.
success
(
projectPageVO
);
}
catch
(
ProjectCommentServiceException
e
)
{
e
.
printStackTrace
();
...
...
src/main/java/cn/meteor/beyondclouds/modules/question/api/QuestionApi.java
View file @
0af1ef08
package
cn
.
meteor
.
beyondclouds
.
modules
.
question
.
api
;
import
cn.meteor.beyondclouds.common.form.PageForm
;
import
cn.meteor.beyondclouds.common.vo.PageVO
;
import
cn.meteor.beyondclouds.core.annotation.Anonymous
;
import
cn.meteor.beyondclouds.core.annotation.CurrentSubject
;
import
cn.meteor.beyondclouds.core.api.Response
;
...
...
@@ -14,7 +15,6 @@ import cn.meteor.beyondclouds.modules.question.form.QuestionForm;
import
cn.meteor.beyondclouds.modules.question.service.IQuestionService
;
import
cn.meteor.beyondclouds.modules.question.service.IQuestionTagService
;
import
cn.meteor.beyondclouds.modules.question.util.QuestionUtils
;
import
cn.meteor.beyondclouds.modules.question.vo.PageVO
;
import
cn.meteor.beyondclouds.modules.tag.entity.Tag
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
io.swagger.annotations.Api
;
...
...
@@ -187,9 +187,7 @@ public class QuestionApi {
public
Response
<
PageVO
<
Question
>>
getQuestions
(
@Valid
PageForm
pageForm
)
{
//获取列表并返回
IPage
<
Question
>
questionPage
=
questionService
.
getQuestionPage
(
pageForm
.
getPage
(),
pageForm
.
getSize
());
PageVO
<
Question
>
questionPageVO
=
new
PageVO
<>();
questionPageVO
.
setTotalPage
(
questionPage
.
getPages
());
questionPageVO
.
setDataList
(
questionPage
.
getRecords
());
PageVO
<
Question
>
questionPageVO
=
new
PageVO
<>(
questionPage
);
return
Response
.
success
(
questionPageVO
);
}
...
...
@@ -204,9 +202,7 @@ public class QuestionApi {
public
Response
<
PageVO
<
Question
>>
getMyQuestions
(
@Valid
PageForm
pageForm
,
@CurrentSubject
Subject
subject
)
{
//获取我的列表并返回
IPage
<
Question
>
myQuestionPage
=
questionService
.
getUserQuestionPage
(
pageForm
.
getPage
(),
pageForm
.
getSize
(),
(
String
)
subject
.
getId
());
PageVO
<
Question
>
questionPageVO
=
new
PageVO
<>();
questionPageVO
.
setTotalPage
(
myQuestionPage
.
getTotal
());
questionPageVO
.
setDataList
(
myQuestionPage
.
getRecords
());
PageVO
<
Question
>
questionPageVO
=
new
PageVO
<>(
myQuestionPage
);
return
Response
.
success
(
questionPageVO
);
}
...
...
@@ -221,9 +217,7 @@ public class QuestionApi {
public
Response
<
PageVO
<
QuestionReply
>>
getMyParticipateQuestions
(
@Valid
PageForm
pageForm
,
@CurrentSubject
Subject
subject
)
{
//获取我的列表并返回
IPage
<
QuestionReply
>
userParticipateQuestionReplyPage
=
questionService
.
getUserParticipateQuestionReplyPage
(
pageForm
.
getPage
(),
pageForm
.
getSize
(),
(
String
)
subject
.
getId
());
PageVO
<
QuestionReply
>
questionReplyPageVO
=
new
PageVO
<>();
questionReplyPageVO
.
setTotalPage
(
userParticipateQuestionReplyPage
.
getTotal
());
questionReplyPageVO
.
setDataList
(
userParticipateQuestionReplyPage
.
getRecords
());
PageVO
<
QuestionReply
>
questionReplyPageVO
=
new
PageVO
<>(
userParticipateQuestionReplyPage
);
return
Response
.
success
(
questionReplyPageVO
);
}
...
...
@@ -239,9 +233,7 @@ public class QuestionApi {
public
Response
<
PageVO
<
Question
>>
getOthersQuestions
(
@Valid
PageForm
pageForm
,
@PathVariable
(
"userId"
)
String
userId
)
{
//获取别人的问答列表并返回
IPage
<
Question
>
questionPage
=
questionService
.
getUserQuestionPage
(
pageForm
.
getPage
(),
pageForm
.
getSize
(),
userId
);
PageVO
<
Question
>
questionPageVO
=
new
PageVO
<>();
questionPageVO
.
setTotalPage
(
questionPage
.
getTotal
());
questionPageVO
.
setDataList
(
questionPage
.
getRecords
());
PageVO
<
Question
>
questionPageVO
=
new
PageVO
<>(
questionPage
);
return
Response
.
success
(
questionPageVO
);
}
...
...
src/main/java/cn/meteor/beyondclouds/modules/question/vo/PageVO.java
deleted
100644 → 0
View file @
80c24924
package
cn
.
meteor
.
beyondclouds
.
modules
.
question
.
vo
;
import
lombok.Data
;
import
java.util.List
;
/**
* @author 胡学良
* @since 2020/2/1
*/
@Data
public
class
PageVO
<
T
>
{
/**
* 总页数
*/
private
Long
totalPage
;
/**
* 数据
*/
private
List
<
T
>
dataList
;
}
src/main/java/cn/meteor/beyondclouds/modules/user/api/UserApi.java
View file @
0af1ef08
...
...
@@ -168,9 +168,7 @@ public class UserApi {
// 根据userId获取粉丝并返回
IPage
<
UserFollow
>
fansPage
=
userFollowService
.
getFansPage
(
pageForm
.
getPage
(),
pageForm
.
getSize
(),
(
String
)
subject
.
getId
());
PageVO
<
UserFollow
>
fansPageVo
=
new
PageVO
<>();
fansPageVo
.
setTotalPage
(
fansPage
.
getPages
());
fansPageVo
.
setDataList
(
fansPage
.
getRecords
());
PageVO
<
UserFollow
>
fansPageVo
=
new
PageVO
<>(
fansPage
);
return
Response
.
success
(
fansPageVo
);
}
...
...
@@ -181,9 +179,7 @@ public class UserApi {
// 根据userId获取粉丝并返回
IPage
<
UserFollow
>
fansPage
=
userFollowService
.
getFansPage
(
pageForm
.
getPage
(),
pageForm
.
getSize
(),
userId
);
PageVO
<
UserFollow
>
fansPageVo
=
new
PageVO
<>();
fansPageVo
.
setTotalPage
(
fansPage
.
getPages
());
fansPageVo
.
setDataList
(
fansPage
.
getRecords
());
PageVO
<
UserFollow
>
fansPageVo
=
new
PageVO
<>(
fansPage
);
return
Response
.
success
(
fansPageVo
);
}
...
...
@@ -194,9 +190,7 @@ public class UserApi {
// 根据userId获取关注列表并返回
IPage
<
UserFollow
>
followersPage
=
userFollowService
.
getFollowersPage
(
pageForm
.
getPage
(),
pageForm
.
getSize
(),
String
.
valueOf
(
subject
.
getId
()));
PageVO
<
UserFollow
>
followersPageVo
=
new
PageVO
<>();
followersPageVo
.
setTotalPage
(
followersPage
.
getPages
());
followersPageVo
.
setDataList
(
followersPage
.
getRecords
());
PageVO
<
UserFollow
>
followersPageVo
=
new
PageVO
<>(
followersPage
);
return
Response
.
success
(
followersPageVo
);
}
...
...
@@ -206,16 +200,10 @@ public class UserApi {
// 根据userId获取关注列表并返回
IPage
<
UserFollow
>
followersPage
=
userFollowService
.
getFollowersPage
(
pageForm
.
getPage
(),
pageForm
.
getSize
(),
userId
);
PageVO
<
UserFollow
>
followersPageVo
=
new
PageVO
<>();
followersPageVo
.
setTotalPage
(
followersPage
.
getPages
());
followersPageVo
.
setDataList
(
followersPage
.
getRecords
());
PageVO
<
UserFollow
>
followersPageVo
=
new
PageVO
<>(
followersPage
);
return
Response
.
success
(
followersPageVo
);
}
}
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