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
fe5474b3
Commit
fe5474b3
authored
Feb 02, 2020
by
段启岩
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
话题检索添加分页
parent
6e523a14
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
11 deletions
+15
-11
src/main/java/cn/meteor/beyondclouds/modules/topic/api/TopicApi.java
+7
-5
src/main/java/cn/meteor/beyondclouds/modules/topic/service/ITopicService.java
+3
-3
src/main/java/cn/meteor/beyondclouds/modules/topic/service/impl/TopicServiceImpl.java
+5
-3
No files found.
src/main/java/cn/meteor/beyondclouds/modules/topic/api/TopicApi.java
View file @
fe5474b3
...
@@ -19,7 +19,6 @@ import org.springframework.validation.BindingResult;
...
@@ -19,7 +19,6 @@ import org.springframework.validation.BindingResult;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
import
javax.validation.Valid
;
import
javax.validation.Valid
;
import
java.util.List
;
/**
/**
* @author 胡明森
* @author 胡明森
...
@@ -66,11 +65,14 @@ public class TopicApi {
...
@@ -66,11 +65,14 @@ public class TopicApi {
@ApiOperation
(
"检索话题"
)
@ApiOperation
(
"检索话题"
)
@GetMapping
(
"/topic/search"
)
@GetMapping
(
"/topic/search"
)
public
Response
<
List
<
Topic
>>
searchTopics
(
@RequestParam
(
"keywords"
)
String
keywords
)
{
public
Response
<?>
searchTopics
(
@Valid
PageForm
pageForm
,
BindingResult
bindingResult
,
@RequestParam
(
"keywords"
)
String
keywords
)
{
List
<
Topic
>
topics
=
topicService
.
searchTopics
(
keywords
);
if
(
bindingResult
.
hasErrors
())
{
return
Response
.
fieldError
(
bindingResult
.
getFieldError
());
}
return
Response
.
success
(
topics
);
IPage
<
Topic
>
topicPage
=
topicService
.
searchTopics
(
keywords
,
pageForm
.
getPage
(),
pageForm
.
getSize
());
return
Response
.
success
(
new
PageVO
<>(
topicPage
));
}
}
...
...
src/main/java/cn/meteor/beyondclouds/modules/topic/service/ITopicService.java
View file @
fe5474b3
...
@@ -6,8 +6,6 @@ import cn.meteor.beyondclouds.modules.user.entity.User;
...
@@ -6,8 +6,6 @@ import cn.meteor.beyondclouds.modules.user.entity.User;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
java.util.List
;
/**
/**
* <p>
* <p>
* 话题表 服务类
* 话题表 服务类
...
@@ -28,8 +26,10 @@ public interface ITopicService extends IService<Topic> {
...
@@ -28,8 +26,10 @@ public interface ITopicService extends IService<Topic> {
/**
/**
* 检索话题
* 检索话题
* @param keywords
* @param keywords
* @param pageNumber
* @param pageSize
*/
*/
List
<
Topic
>
searchTopics
(
String
keywords
);
IPage
<
Topic
>
searchTopics
(
String
keywords
,
Integer
pageNumber
,
Integer
pageSize
);
/**
/**
* 关注话题
* 关注话题
...
...
src/main/java/cn/meteor/beyondclouds/modules/topic/service/impl/TopicServiceImpl.java
View file @
fe5474b3
...
@@ -55,9 +55,11 @@ public class TopicServiceImpl extends ServiceImpl<TopicMapper, Topic> implements
...
@@ -55,9 +55,11 @@ public class TopicServiceImpl extends ServiceImpl<TopicMapper, Topic> implements
}
}
@Override
@Override
public
List
<
Topic
>
searchTopics
(
String
keywords
)
{
public
IPage
<
Topic
>
searchTopics
(
String
keywords
,
Integer
pageNumber
,
Integer
pageSize
)
{
IPage
<
Topic
>
page
=
new
Page
<>(
pageNumber
,
pageSize
);
return
topicMapper
.
searchTopics
(
keywords
);
QueryWrapper
<
Topic
>
topicQueryWrapper
=
new
QueryWrapper
<>();
topicQueryWrapper
.
like
(
"topic_name"
,
keywords
);
return
page
(
page
,
topicQueryWrapper
);
}
}
...
...
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