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
16b2a3e9
Commit
16b2a3e9
authored
Feb 13, 2020
by
段启岩
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增热搜话题接口
parent
67e537bc
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
42 additions
and
0 deletions
+42
-0
src/main/java/cn/meteor/beyondclouds/modules/topic/api/TopicApi.java
+11
-0
src/main/java/cn/meteor/beyondclouds/modules/topic/mapper/TopicMapper.java
+9
-0
src/main/java/cn/meteor/beyondclouds/modules/topic/mapper/xml/TopicMapper.xml
+8
-0
src/main/java/cn/meteor/beyondclouds/modules/topic/service/ITopicService.java
+9
-0
src/main/java/cn/meteor/beyondclouds/modules/topic/service/impl/TopicServiceImpl.java
+5
-0
No files found.
src/main/java/cn/meteor/beyondclouds/modules/topic/api/TopicApi.java
View file @
16b2a3e9
...
...
@@ -205,4 +205,15 @@ public class TopicApi {
}
}
@Anonymous
@ApiOperation
(
"热搜话题"
)
@GetMapping
(
"/topic/hotSearch"
)
public
Response
<?>
hotSearchTopics
(
@Valid
PageForm
pageForm
,
BindingResult
bindingResult
)
{
if
(
bindingResult
.
hasErrors
())
{
return
Response
.
fieldError
(
bindingResult
.
getFieldError
());
}
PageDTO
<
TopicDTO
>
topicDTOPage
=
topicService
.
getHotSearchTopics
(
pageForm
.
getPage
(),
pageForm
.
getSize
());
return
Response
.
success
(
topicDTOPage
);
}
}
src/main/java/cn/meteor/beyondclouds/modules/topic/mapper/TopicMapper.java
View file @
16b2a3e9
...
...
@@ -2,6 +2,8 @@ package cn.meteor.beyondclouds.modules.topic.mapper;
import
cn.meteor.beyondclouds.modules.topic.entity.Topic
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
org.springframework.stereotype.Component
;
import
java.util.List
;
...
...
@@ -23,4 +25,11 @@ public interface TopicMapper extends BaseMapper<Topic> {
* @return
*/
List
<
Topic
>
searchTopics
(
String
keywords
);
/**
* 热搜话题
* @param topicPage
* @return
*/
IPage
<
Topic
>
selectHotSearchPage
(
Page
<
Topic
>
topicPage
);
}
src/main/java/cn/meteor/beyondclouds/modules/topic/mapper/xml/TopicMapper.xml
View file @
16b2a3e9
...
...
@@ -5,4 +5,12 @@
<select
id=
"searchTopics"
resultType=
"cn.meteor.beyondclouds.modules.topic.entity.Topic"
>
select * from topic where topic_name like CONCAT('%',#{keywords},'%')
</select>
<select
id=
"selectHotSearchPage"
resultType=
"cn.meteor.beyondclouds.modules.topic.entity.Topic"
>
SELECT t.*
FROM topic t, search_degree sd
WHERE t.topic_id = sd.item_id
AND sd.item_type = 'TOPIC'
ORDER BY sd.degree DESC;
</select>
</mapper>
src/main/java/cn/meteor/beyondclouds/modules/topic/service/ITopicService.java
View file @
16b2a3e9
...
...
@@ -153,4 +153,13 @@ public interface ITopicService extends IService<Topic> {
* @return
*/
List
<
Topic
>
queryAndCreateByTopicNames
(
List
<
String
>
topicNames
,
String
userId
);
/**
* 获取热搜话题
* @return
* @param pageNumber
* @param pageSize
*/
PageDTO
<
TopicDTO
>
getHotSearchTopics
(
Integer
pageNumber
,
Integer
pageSize
);
}
src/main/java/cn/meteor/beyondclouds/modules/topic/service/impl/TopicServiceImpl.java
View file @
16b2a3e9
...
...
@@ -546,6 +546,11 @@ public class TopicServiceImpl extends ServiceImpl<TopicMapper, Topic> implements
return
topics
;
}
@Override
public
PageDTO
<
TopicDTO
>
getHotSearchTopics
(
Integer
pageNumber
,
Integer
pageSize
)
{
IPage
<
Topic
>
topicPage
=
topicMapper
.
selectHotSearchPage
(
new
Page
<
Topic
>(
pageNumber
,
pageSize
));
return
toPageDTO
(
topicPage
);
}
}
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