仿掘金项目首页文章列表下拉加载更多功能

前台

      

其中,使用到layer组件layer弹窗

后台功能:TopicPageInfoScroll

public class TopicPageInfoScroll {
    private int section_id;
    private int last_topic_id;

    public int getLast_topic_id() {
        return last_topic_id;
    }

    public void setLast_topic_id(int last_topic_id) {
        this.last_topic_id = last_topic_id;
    }

    public int getSection_id() {
        return section_id;
    }

    public void setSection_id(int section_id) {
        this.section_id = section_id;
    }
}

Controller

    @RequestMapping("getpagedtopics")
    public void getPagedTopics(TopicPageInfoScroll topicPageInfoScroll
            ,HttpServletResponse response) throws IOException, InterruptedException {
//        int count = topicService.getTopicsCounts(pageinfo);
        List lstBookInfos = topicService.getPagedTopics(topicPageInfoScroll);

        PageData pageData = new PageData();
        pageData.setList(lstBookInfos);
        pageData.setTotal(0);

        response.setContentType("text/html;charset=utf-8");
        String strJsonString = JSON.toJSONString(pageData);
        PrintWriter pWriter = response.getWriter();
        Thread.sleep(500);//模拟加载速度较慢
        pWriter.println(strJsonString);

Mapper

 

你可能感兴趣的:(仿掘金项目首页文章列表下拉加载更多功能)