锋哥原创的Springboot+Layui python222网站实战:
create table `t_tag` (
`id` int (11),
`name` varchar (300),
`sort` int (11)
);
insert into `t_tag` (`id`, `name`, `sort`) values('1','Python视频教程','1');
insert into `t_tag` (`id`, `name`, `sort`) values('2','PDF','2');
insert into `t_tag` (`id`, `name`, `sort`) values('3','爬虫','3');
insert into `t_tag` (`id`, `name`, `sort`) values('4','数据分析','4');
insert into `t_tag` (`id`, `name`, `sort`) values('5','机器学习','5');
insert into `t_tag` (`id`, `name`, `sort`) values('6','大数据','6');
insert into `t_tag` (`id`, `name`, `sort`) values('7','大数据分析','7');
insert into `t_tag` (`id`, `name`, `sort`) values('8','人工智能','8');
insert into `t_tag` (`id`, `name`, `sort`) values('10','cc','111');
MybatisX插件生成代码;
获取数据,放到application缓存里面;
index.html
<div class="tag">
<h4 class="tag_title">热门标签推荐</h4>
<ul class="item_list">
<li th:each="tag:${application.tagList}">
<a th:href="@{'/search/1?keyWord='+${tag.name}}" target="_blank"><button type="button" class="layui-btn layui-btn-sm" th:text="${tag.name}"></button></a>
</li>
</ul>
</div>