✨ 专题管理功能
This commit is contained in:
parent
5fe3140873
commit
cca01aaf13
@ -22,11 +22,9 @@ public interface TopicService extends Service<Topic> {
|
|||||||
/**
|
/**
|
||||||
* 根据 topicUri 获取主题信息及旗下标签数据
|
* 根据 topicUri 获取主题信息及旗下标签数据
|
||||||
* @param topicUri 主题 URI
|
* @param topicUri 主题 URI
|
||||||
* @param page
|
|
||||||
* @param rows
|
|
||||||
* @return
|
* @return
|
||||||
* */
|
* */
|
||||||
Map findTopicByTopicUri(String topicUri, Integer page, Integer rows);
|
Topic findTopicByTopicUri(String topicUri);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增/更新主题信息
|
* 新增/更新主题信息
|
||||||
@ -56,4 +54,13 @@ public interface TopicService extends Service<Topic> {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
Map unbindTopicTag(TopicTagDTO topicTag);
|
Map unbindTopicTag(TopicTagDTO topicTag);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取主题下标签列表
|
||||||
|
* @param topicUri
|
||||||
|
* @param page
|
||||||
|
* @param rows
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
Map findTagsByTopicUri(String topicUri, Integer page, Integer rows);
|
||||||
}
|
}
|
||||||
|
@ -37,23 +37,10 @@ public class TopicServiceImpl extends AbstractService<Topic> implements TopicSer
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map findTopicByTopicUri(String topicUri, Integer page, Integer rows) {
|
public Topic findTopicByTopicUri(String topicUri) {
|
||||||
Map map = new HashMap(2);
|
Topic searchTopic = new Topic();
|
||||||
TopicDTO topic = topicMapper.selectTopicByTopicUri(topicUri);
|
searchTopic.setTopicUri(topicUri);
|
||||||
if (topic == null) {
|
return topicMapper.selectOne(searchTopic);
|
||||||
return map;
|
|
||||||
}
|
|
||||||
PageHelper.startPage(page, rows);
|
|
||||||
List<TagDTO> list = topicMapper.selectTopicTag(topic.getIdTopic());
|
|
||||||
PageInfo pageInfo = new PageInfo(list);
|
|
||||||
topic.setTags(pageInfo.getList());
|
|
||||||
map.put("topic", topic);
|
|
||||||
Map pagination = new HashMap(3);
|
|
||||||
pagination.put("pageSize",pageInfo.getPageSize());
|
|
||||||
pagination.put("total",pageInfo.getTotal());
|
|
||||||
pagination.put("currentPage",pageInfo.getPageNum());
|
|
||||||
map.put("pagination", pagination);
|
|
||||||
return map;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -133,4 +120,23 @@ public class TopicServiceImpl extends AbstractService<Topic> implements TopicSer
|
|||||||
}
|
}
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map findTagsByTopicUri(String topicUri, Integer page, Integer rows) {
|
||||||
|
Map map = new HashMap(2);
|
||||||
|
TopicDTO topic = topicMapper.selectTopicByTopicUri(topicUri);
|
||||||
|
if (topic == null) {
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
PageHelper.startPage(page, rows);
|
||||||
|
List<TagDTO> list = topicMapper.selectTopicTag(topic.getIdTopic());
|
||||||
|
PageInfo pageInfo = new PageInfo(list);
|
||||||
|
map.put("tags", pageInfo.getList());
|
||||||
|
Map pagination = new HashMap(3);
|
||||||
|
pagination.put("pageSize",pageInfo.getPageSize());
|
||||||
|
pagination.put("total",pageInfo.getTotal());
|
||||||
|
pagination.put("currentPage",pageInfo.getPageNum());
|
||||||
|
map.put("pagination", pagination);
|
||||||
|
return map;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -109,11 +109,20 @@ public class AdminController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/topic/{topicUri}")
|
@GetMapping("/topic/{topicUri}")
|
||||||
public GlobalResult topic(@RequestParam(defaultValue = "0") Integer page, @RequestParam(defaultValue = "10") Integer rows,@PathVariable String topicUri){
|
public GlobalResult topic(@PathVariable String topicUri){
|
||||||
if (StringUtils.isBlank(topicUri)) {
|
if (StringUtils.isBlank(topicUri)) {
|
||||||
return GlobalResultGenerator.genErrorResult("数据异常!");
|
return GlobalResultGenerator.genErrorResult("数据异常!");
|
||||||
}
|
}
|
||||||
Map map = topicService.findTopicByTopicUri(topicUri,page,rows);
|
Topic topic = topicService.findTopicByTopicUri(topicUri);
|
||||||
|
return GlobalResultGenerator.genSuccessResult(topic);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/topic/{topicUri}/tags")
|
||||||
|
public GlobalResult topicTags(@RequestParam(defaultValue = "0") Integer page, @RequestParam(defaultValue = "10") Integer rows,@PathVariable String topicUri){
|
||||||
|
if (StringUtils.isBlank(topicUri)) {
|
||||||
|
return GlobalResultGenerator.genErrorResult("数据异常!");
|
||||||
|
}
|
||||||
|
Map map = topicService.findTagsByTopicUri(topicUri,page,rows);
|
||||||
return GlobalResultGenerator.genSuccessResult(map);
|
return GlobalResultGenerator.genSuccessResult(map);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -73,7 +73,7 @@
|
|||||||
<select id="selectUnbindTagsById" resultMap="TagResultMap">
|
<select id="selectUnbindTagsById" resultMap="TagResultMap">
|
||||||
select * from vertical_tag vt where not exists(select * from vertical_topic_tag vtt where vtt.id_topic = #{idTopic} and vtt.id_tag = vt.id)
|
select * from vertical_tag vt where not exists(select * from vertical_topic_tag vtt where vtt.id_topic = #{idTopic} and vtt.id_tag = vt.id)
|
||||||
<if test="tagTitle != '' and tagTitle != null">
|
<if test="tagTitle != '' and tagTitle != null">
|
||||||
and vt.tag_title = #{tagTitle}
|
and LOCATE(#{tagTitle}, vt.tag_title) > 0
|
||||||
</if>
|
</if>
|
||||||
order by vt.created_time desc
|
order by vt.created_time desc
|
||||||
</select>
|
</select>
|
||||||
|
BIN
src/main/resources/static/jetbrains.png
Normal file
BIN
src/main/resources/static/jetbrains.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 164 KiB |
Loading…
Reference in New Issue
Block a user