锋哥原创的Springboot+Layui python222网站实战:
create table `t_article` (
`id` int (11),
`title` varchar (600),
`summary` varchar (1500),
`content` longtext ,
`publish_date` datetime ,
`status` int (11),
`download_content` varchar (15000),
`download_btn_content` varchar (300),
`key_words` varchar (3000),
`hot` bit (1),
`hot_date` datetime ,
`download` bit (1)
);
导入数据;
获取一页热门数据:
application.setAttribute("hotArticleList",articleService.page(new Page<>(1,20),new QueryWrapper<Article>().eq("hot",true).orderByDesc("hot_date")).getRecords());
index.html
<div class="main_wrapper">
<div class="w1220 index_content">
<div class="content_left">
左侧
</div>
<div class="content_right">
<div class="card">
<h4 class="card_title">热门帖子推荐</h4>
<ul class="item_list">
<li th:each="hotArticle,status:${application.hotArticleList}"><span class="number" th:text="${status.index+1}+'.'"></span><a th:href="'/article/'+${hotArticle.id}" target="_blank" th:title="${hotArticle.title}" th:text="${hotArticle.title}"></a></li>
</ul>
</div>
</div>
</div>
</div>