主题管理

This commit is contained in:
x ronger 2019-12-05 17:30:24 +08:00
parent 3284137e68
commit 37c81c5b60
4 changed files with 36 additions and 5 deletions

View File

@ -1,5 +1,6 @@
package com.rymcu.vertical.dto.admin; package com.rymcu.vertical.dto.admin;
import com.rymcu.vertical.dto.Author;
import lombok.Data; import lombok.Data;
/** /**
@ -7,4 +8,19 @@ import lombok.Data;
*/ */
@Data @Data
public class TagDTO { public class TagDTO {
private Integer idTag;
private String tagTitle;
private String tagUri;
private String tagDescription;
private String tagIconPath;
private Integer tagAuthorId;
private Author tagAuthor;
} }

View File

@ -1,5 +1,6 @@
package com.rymcu.vertical.dto.admin; package com.rymcu.vertical.dto.admin;
import com.rymcu.vertical.dto.Author;
import lombok.Data; import lombok.Data;
import java.util.List; import java.util.List;

View File

@ -1,10 +1,10 @@
package com.rymcu.vertical.service; package com.rymcu.vertical.service;
import com.rymcu.vertical.core.service.Service; import com.rymcu.vertical.core.service.Service;
import com.rymcu.vertical.dto.admin.TopicDTO;
import com.rymcu.vertical.entity.Topic; import com.rymcu.vertical.entity.Topic;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* @author ronger * @author ronger
@ -24,5 +24,5 @@ public interface TopicService extends Service<Topic> {
* @param rows * @param rows
* @return * @return
* */ * */
TopicDTO findTopicByTopicUri(String topicUri, Integer page, Integer rows); Map findTopicByTopicUri(String topicUri, Integer page, Integer rows);
} }

View File

@ -1,5 +1,7 @@
package com.rymcu.vertical.service.impl; package com.rymcu.vertical.service.impl;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.rymcu.vertical.core.service.AbstractService; import com.rymcu.vertical.core.service.AbstractService;
import com.rymcu.vertical.dto.admin.TagDTO; import com.rymcu.vertical.dto.admin.TagDTO;
import com.rymcu.vertical.dto.admin.TopicDTO; import com.rymcu.vertical.dto.admin.TopicDTO;
@ -9,7 +11,9 @@ import com.rymcu.vertical.service.TopicService;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* @author ronger * @author ronger
@ -27,12 +31,22 @@ public class TopicServiceImpl extends AbstractService<Topic> implements TopicSer
} }
@Override @Override
public TopicDTO findTopicByTopicUri(String topicUri, Integer page, Integer rows) { public Map findTopicByTopicUri(String topicUri, Integer page, Integer rows) {
Map map = new HashMap(2);
TopicDTO topic = topicMapper.selectTopicByTopicUri(topicUri); TopicDTO topic = topicMapper.selectTopicByTopicUri(topicUri);
if (topic == null) { if (topic == null) {
return new TopicDTO(); return map;
} }
PageHelper.startPage(page, rows);
List<TagDTO> list = topicMapper.selectTopicTag(topic.getIdTopic()); List<TagDTO> list = topicMapper.selectTopicTag(topic.getIdTopic());
return topic; 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;
} }
} }