修复分类,文章级联删除,部分页面展示

master
barney 2 years ago
parent 901a6ee8a5
commit 2146682e53
  1. 32
      pom.xml
  2. 7
      src/main/java/cc/bnblogs/common/DefaultImages.java
  3. 13
      src/main/java/cc/bnblogs/controller/ArticleController.java
  4. 19
      src/main/java/cc/bnblogs/controller/CategoryController.java
  5. 4
      src/main/java/cc/bnblogs/controller/CommentController.java
  6. 17
      src/main/java/cc/bnblogs/mapper/ArticleMapper.java
  7. 17
      src/main/java/cc/bnblogs/mapper/CategoryMapper.java
  8. 20
      src/main/java/cc/bnblogs/mapper/CommentMapper.java
  9. 17
      src/main/java/cc/bnblogs/service/ArticleService.java
  10. 10
      src/main/java/cc/bnblogs/service/CategoryService.java
  11. 17
      src/main/java/cc/bnblogs/service/CommentService.java
  12. 4
      src/main/java/cc/bnblogs/utils/CookieUtil.java
  13. 7
      src/main/resources/application.yml
  14. 3
      src/main/resources/static/css/style.css
  15. 9
      src/main/resources/templates/admin/category.html
  16. 16
      src/main/resources/templates/admin/comment.html
  17. 6
      src/main/resources/templates/admin/index.html
  18. 5
      src/main/resources/templates/category.html
  19. 9
      src/main/resources/templates/common.html
  20. 11
      src/main/resources/templates/detail.html
  21. 5
      src/main/resources/templates/index.html
  22. 2
      src/main/resources/templates/list.html
  23. 6
      src/main/resources/templates/tags.html

@ -4,8 +4,8 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>cn.kevinlu98</groupId>
<artifactId>blog-project</artifactId>
<groupId>cc.bnblogs</groupId>
<artifactId>SpringBootProject</artifactId>
<version>1.0-SNAPSHOT</version>
<parent>
@ -105,6 +105,34 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>3.2.0</version>
<executions>
<execution>
<id>copy-resources</id>
<phase>package</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<resources>
<resource>
<directory>src/main/resources</directory>
<includes>
<include>*.properties</include>
<include>*.yml</include>
<include>*/*.properties</include>
<include>*/*.yml</include>
</includes>
</resource>
</resources>
<outputDirectory>${project.build.directory}</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>

@ -1,6 +1,8 @@
package cc.bnblogs.common;
import cc.bnblogs.config.WebConfig;
import lombok.Data;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
import org.thymeleaf.util.StringUtils;
@ -25,6 +27,11 @@ public class DefaultImages {
* 默认评论头像
*/
private List<String> avatars;
private final WebSite webSite;
public DefaultImages(WebSite webSite) {
this.webSite = webSite;
}
public String cover(String imgUrl) {
if (StringUtils.isEmptyOrWhitespace(imgUrl)) {

@ -6,6 +6,7 @@ import cc.bnblogs.common.Result;
import cc.bnblogs.enums.ResultEnum;
import cc.bnblogs.pojo.Article;
import cc.bnblogs.service.ArticleService;
import cc.bnblogs.service.CommentService;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@ -19,9 +20,11 @@ import java.util.Objects;
@RequestMapping("/admin/article")
public class ArticleController {
private final ArticleService articleService;
private final CommentService commentService;
public ArticleController(ArticleService articleService) {
public ArticleController(ArticleService articleService, CommentService commentService) {
this.articleService = articleService;
this.commentService = commentService;
}
/**
@ -61,12 +64,18 @@ public class ArticleController {
}
/**
* 删除一文章
* 删除一文章
* @param id 删除的文章id
* @return 删除结果
*/
@DeleteMapping("/{id}")
public Result<String> delete(@PathVariable Integer id) {
// 删除文章前验证该文章中是否有评论
Long number = commentService.countCommentByArticleId(id);
if ( number != 0) {
// 先删除文章下的所有评论
commentService.deleteCommentByArticleId(id);
}
articleService.delete(id);
return Result.success();
}

@ -3,6 +3,7 @@ package cc.bnblogs.controller;
import cc.bnblogs.common.Result;
import cc.bnblogs.enums.ResultEnum;
import cc.bnblogs.pojo.Category;
import cc.bnblogs.service.ArticleService;
import cc.bnblogs.service.CategoryService;
import org.springframework.web.bind.annotation.*;
@ -17,9 +18,11 @@ import java.util.Objects;
@RequestMapping("/admin/category")
public class CategoryController {
private final CategoryService categoryService;
private final ArticleService articleService;
public CategoryController(CategoryService categoryService) {
public CategoryController(CategoryService categoryService, ArticleService articleService) {
this.categoryService = categoryService;
this.articleService = articleService;
}
/**
@ -64,7 +67,19 @@ public class CategoryController {
*/
@DeleteMapping("/{id}")
public Result<String> delete(@PathVariable Integer id) {
categoryService.delete(id);
// 查询分类下的文章数
long number = articleService.countByCategoryId(id);
if (number == 0) {
// 没有文章使用了该分类直接删除
categoryService.delete(id);
}else {
System.out.println("使用该分类的文章数:" + number);
// 插入一个默认分类(已存在则忽略)
categoryService.insertDefaultValue();
// 更新该分类下的所有文章为默认分类
articleService.updateToDefaultCategory(id);
categoryService.delete(id);
}
return Result.success();
}
}

@ -7,12 +7,8 @@ import cc.bnblogs.enums.ResultEnum;
import cc.bnblogs.pojo.Article;
import cc.bnblogs.pojo.Comment;
import cc.bnblogs.service.CommentService;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Objects;
/**

@ -25,7 +25,8 @@ public interface ArticleMapper extends JpaRepository<Article,Integer>, JpaSpecif
List<Article> hotList(int limit);
/**
* 统计分类文章数
* 统计该分类文章数
* todo 应该减去页面数
* @param category 分类
* @return 文章个数
*/
@ -47,4 +48,18 @@ public interface ArticleMapper extends JpaRepository<Article,Integer>, JpaSpecif
@Modifying
@Query(value = "update blog_article set views=views+1 where id=?1",nativeQuery = true)
void updateArticleViews(Integer id);
/**
* 删除某个分类时如果有文章使用了该分类
* 更新文章的分类id为默认分类的id
* @param articleCategoryId 文章分类id
*/
@Modifying
@Transactional(rollbackFor = {Exception.class})
@Query(value = "update blog_article ba, blog_category bc\n" +
"set ba.category_id = bc.id\n" +
"where bc.name='默认分类' and ba.category_id=?1", nativeQuery = true)
void updateToDefaultCategory(Integer articleCategoryId);
}

@ -2,10 +2,25 @@ package cc.bnblogs.mapper;
import cc.bnblogs.pojo.Category;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
/**
* @author zfp@bnblogs.cc
* @createTime: 2022/10/16
*/
public interface CategoryMapper extends JpaRepository<Category,Integer> {
public interface CategoryMapper extends JpaRepository<Category,Integer>, JpaSpecificationExecutor<Category> {
/**
* 插入一个默认分类
* 如果已存在则忽略
*/
@Modifying
@Transactional(rollbackFor = {Exception.class})
@Query(value = "insert ignore blog_category(`name`,`summary`) values('默认分类','未设置分类')",nativeQuery = true)
void insertDefaultCategory();
}

@ -61,4 +61,24 @@ public interface CommentMapper extends JpaRepository<Comment,Integer> {
* @return 评论个数
*/
Long countCommentByView(Boolean view);
/**
* 统计该文章下有多少评论
* @param article_id 文章id
* @return
*/
Long countCommentByArticleId(Integer article_id);
/**
* 根据文章id删除该文章下所有文章
*
*/
/**
* 根据文章id删除其所有评论
* @param id 文章id
*/
@Modifying
@Transactional(rollbackFor = {Exception.class})
void deleteCommentsByArticleId(Integer id);
}

@ -3,6 +3,7 @@ package cc.bnblogs.service;
import cc.bnblogs.common.ArticleSearch;
import cc.bnblogs.common.PageHelper;
import cc.bnblogs.mapper.ArticleMapper;
import cc.bnblogs.mapper.CategoryMapper;
import cc.bnblogs.mapper.CommentMapper;
import cc.bnblogs.mapper.TagMapper;
import cc.bnblogs.pojo.Article;
@ -42,11 +43,13 @@ public class ArticleService {
private final TagMapper tagMapper;
private final ArticleMapper articleMapper;
private final CommentMapper commentMapper;
private final CategoryMapper categoryMapper;
public ArticleService(ArticleMapper articleMapper, TagMapper tagMapper, CommentMapper commentMapper) {
public ArticleService(ArticleMapper articleMapper, TagMapper tagMapper, CommentMapper commentMapper, CategoryMapper categoryMapper) {
this.articleMapper = articleMapper;
this.tagMapper = tagMapper;
this.commentMapper = commentMapper;
this.categoryMapper = categoryMapper;
}
/**
@ -64,6 +67,14 @@ public class ArticleService {
public long count() {
return articleMapper.count();
}
/**
* 获取该分类下的文章数
* @param id 分类id
* @return 文章数
*/
public long countByCategoryId(Integer id){
return articleMapper.countByCategory(categoryMapper.getOne(id));
}
/**
* 根据id查询文章对象
@ -212,4 +223,8 @@ public class ArticleService {
articleMapper.updateArticleViews(id);
}
public void updateToDefaultCategory(Integer articleCategoryId){
articleMapper.updateToDefaultCategory(articleCategoryId);
}
}

@ -81,6 +81,14 @@ public class CategoryService {
// 返回该分类下的文章总数
category.setArticleCount(articleMapper.countByCategory(category));
category.setLastUpdated(articleMapper.lastUpdated(category.getId()));
}).filter(category -> category.getArticleCount() > 0).collect(Collectors.toList());
}).filter(category -> category.getArticleCount() > 0)
.collect(Collectors.toList());
}
/**
* 插入一条默认分类有则忽略
*/
public void insertDefaultValue() {
categoryMapper.insertDefaultCategory();
}
}

@ -185,4 +185,21 @@ public class CommentService {
.total(page.getTotalElements())
.build();
}
/**
* 返回该id对应的文章的评论个数
* @param id 文章id
* @return 评论个数
*/
public Long countCommentByArticleId(Integer id) {
return commentMapper.countCommentByArticleId(id);
}
/**
* 根据文章id删除所有评论
* @param id 文章id
*/
public void deleteCommentByArticleId(Integer id) {
commentMapper.deleteCommentsByArticleId(id);
}
}

@ -31,8 +31,8 @@ public class CookieUtil {
}
public static void setCookie(HttpServletResponse response, String cookieName, String value) {
// 有效期为1
setCookie(response, cookieName, value, 24 * 60 * 60);
// 有效期为1小时
setCookie(response, cookieName, value, 60 * 60);
}
public static void deleteCookie(HttpServletResponse response, String cookieName) {

@ -1,3 +1,4 @@
spring:
jackson:
date-format: yyyy-MM-dd HH:mm:ss
@ -70,12 +71,13 @@ website:
- SpringBoot
- 学习
description: All the truth is simple!
domain: http://localhost:8080 #域名
domain: http://localhost:8081 #域名
avatar: https://hugo.bnblogs.cc/images/img/20220215001349.png
nickname: barney
username: admin
password: 0192023a7bbd73250516f069df18b500
address: 广东 广州
# 作者头像
tags:
- java
- springboot
@ -113,4 +115,5 @@ default-images:
- /static/image/avatar/12.jpg
- /static/image/avatar/13.jpg
- /static/image/avatar/14.jpg
server:
port: 8081 # 程序启动端口

@ -57,7 +57,6 @@ nav .lw-container.lw-header {
}
nav .lw-container.lw-header span {
text-shadow: 0 0 2px #c2005f, 0 0 4px #c2005f, 0 0 4px #c2005f, 0 0 4px #c2005f;
font-size: 16px;
color: #eee;
}
@ -262,7 +261,7 @@ nav .lw-nav a i {
.lw-left-list {
margin-right: 310px;
padding: 0;
min-height: 1300px;
min-height: 767px;
}
.lw-left-list .lw-swiper {

@ -75,9 +75,9 @@
title: '操作',
align: "center",
width: 180,
formatter: function (value) {
formatter: function (value,row) {
return `<button type="button" style="outline: none;" data-id="${value}" class="btn btn-info btn-sm category-edit-btn"><i class="fa fa-edit"></i> 编辑</button>
<button type="button" style="outline: none;" data-id="${value}" class="btn btn-danger btn-sm category-delete-btn"><i class="fa fa-trash"></i> 删除</button>`
<button type="button" data-name="${row.name}" style="outline: none;" data-id="${value}" class="btn btn-danger btn-sm category-delete-btn"><i class="fa fa-trash"></i> 删除</button>`
}
}
],
@ -118,9 +118,14 @@
// 删除分类
$("#data-table").on("click",".category-delete-btn",function () {
let id = $(this).data('id')
let name = $(this).data('name')
let idx = layer.confirm('是否要删除该数据?', {
btn: ['确认', '取消'] //按钮
}, function () { // 点击确认后删除
if (name === '默认分类') {
layer.msg('默认分类不能删除!', {icon: 2});
return;
}
$.ajax({
url: '/admin/category/' + id,
method: 'delete',

@ -5,7 +5,14 @@
<title>评论管理</title>
<style>
#comment-content {
width: 400px;
width: 200px;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
#comment-article {
width: 200px;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
@ -127,8 +134,13 @@
formatter: value => {
return value ? "已读" : "未读";
}
},{
title: '文章',
field: 'article',
formatter: function (value) {
return `<a target="_blank" href="/${value.id}.html"><p id="comment-article">${value.title}</p></a>`
}
},
{
title: "评论创建时间",
field: "created",

@ -18,7 +18,8 @@
<div class="col-md-6">
<ul class="list-group">
<li class="list-group-item disabled">
<b>最新文章</b>
<b th:if="${ArticleCount > 0}">最新文章</b>
<b th:if="${ArticleCount eq 0}">未发布任何文章</b>
</li>
<li class="list-group-item" th:each="article:${NewArticleList}">
<span class="badge" th:text="${#dates.format(article.created,'yyyy-MM-dd HH:mm')}"></span>
@ -29,7 +30,8 @@
<div class="col-md-6">
<ul class="list-group">
<li class="list-group-item disabled">
<b>最新评论</b>
<b th:if="${CommentAll > 0}">最新评论</b>
<b th:if="${CommentAll eq 0}">未发布任何评论</b>
</li>
<li class="list-group-item" th:each="comment:${NewCommentList}">
<span class="badge" th:text="${#dates.format(comment.created,'yyyy-MM-dd HH:mm')}"></span>

@ -15,6 +15,7 @@
<li class="active">分类云</li>
</ol>
<ul class="lw-category-list">
<div th:if="${categories.size() == 0}" class="lw-tag-list" style="height: 200px; line-height: 200px; text-align: center;font-size: 25px; font-weight: bold; color: red;">未找到任何分类!</div>
<li th:each="category:${categories}">
<a th:href="@{/category/{id}.html(id=${category.id})}">
<i class="fa fa-folder lw-mr5"></i><th:block th:text="${category.name}"></th:block>
@ -51,6 +52,7 @@
</div>
<div class="lw-right-item lw-right-hot">
<h4><i class="fa fa-fire lw-mr5" aria-hidden="true"></i>热门文章</h4>
<ul class="lw-right-item" style="font-size: 20px;padding-left: 5px" th:if="${hots.size()==0}">没有任何文章</ul>
<ul class="lw-hot-list">
<!--/*@thymesVar id="hots" type="java.util.List<cc.bnblogs.pojo.Article>"*/-->
<li th:each="hot,it:${hots}">
@ -72,6 +74,7 @@
</div>
<div class="lw-right-item lw-tag-cloud">
<h4><i class="fa fa-tags lw-mr5" aria-hidden="true"></i>标签云</h4>
<ul class="lw-right-item" style="font-size: 20px;padding-left: 5px" th:if="${tags.size()==0}">没有任何标签</ul>
<!--/*@thymesVar id="tags" type="java.util.List<cc.bnblogs.pojo.Tag>"*/-->
<a th:each="tag:${tags}" th:href="@{/tag/{id}.html(id=${tag.id})}" th:title="${tag.name}" th:text="${tag.name}"></a>
</div>
@ -82,7 +85,7 @@
<th:block th:fragment="footer">
<div class="lw-friend-link">
<div class="lw-container">
<h2>友情链接</h2>
<h2 th:if="${friends.size()>0}">友情链接</h2>
<!--/*@thymesVar id="friends" type="java.util.List<cc.bnblogs.pojo.Friends>"*/-->
<a th:each="friend:${friends}" target="_blank" th:href="${friend.link}" th:text="${friend.title}"></a>
</div>

@ -28,7 +28,8 @@
>
</a>
</div>
<span th:text="${@webSite.getNavDesc()}" style="font-size: 20px;text-shadow:none;color: rgb(22, 18, 9)"></span>
<a th:href="@{/}" title="返回首页" th:text="${@webSite.title}" style="text-decoration: none;padding-left: 16px; float: left;color: #c2005f;font-size: 3rem"></a>
<span style="padding-bottom: 40px">&nbsp;</span>
<div class="lw-fr lw-linkme">
<a target="_blank"
th:href="${T(java.lang.String).format('tencent://message/?uin=%s&amp;Site=&amp;menu=yes',@webSite.qq)}"><i
@ -83,6 +84,7 @@
</div>
<div class="lw-right-item lw-right-hot">
<h4><i class="fa fa-fire lw-mr5" aria-hidden="true"></i>热门文章</h4>
<ul class="lw-right-item" style="font-size: 20px;padding-left: 5px" th:if="${hots.size()==0}">没有热门文章</ul>
<ul class="lw-hot-list">
<!--/*@thymesVar id="hots" type="java.util.List<cc.bnblogs.pojo.Article>"*/-->
<li th:each="hot,it:${hots}">
@ -105,12 +107,14 @@
</div>
<div class="lw-right-item lw-tag-cloud">
<h4><i class="fa fa-tags lw-mr5" aria-hidden="true"></i>标签云</h4>
<ul class="lw-right-item" style="font-size: 20px;padding-left: 5px" th:if="${tags.size()==0}">没有任何标签</ul>
<!--/*@thymesVar id="tags" type="java.util.List<cc.bnblogs.pojo.Tag>"*/-->
<a th:each="tag:${tags}" th:href="@{/tag/{id}.html(id=${tag.id})}" th:title="${tag.name}"
th:text="${tag.name}"></a>
</div>
</th:block>
<th:block th:fragment="article(articleList)">
<article th:each="article:${articleList}" class="lw-article-item lw-posr">
<div class="lw-article-cover lw-posa lw-xs-hidden">
@ -136,13 +140,12 @@
<a th:each="tag:${article.tags}" th:href="@{/tag/{id}.html(id=${tag.id})}" class="lw-mr5"
th:title="${tag.name}" th:text="${tag.name +' '}"></a>
</th:block>
</p>
</div>
</article>
</th:block>
<th:block th:fragment="footer">
<div class="lw-friend-link">
<div class="lw-friend-link" style="margin-top: 50px">
<div class="lw-container">
<h2>友情链接</h2>
<!--/*@thymesVar id="friends" type="java.util.List<cc.bnblogs.pojo.Friends>"*/-->

@ -140,13 +140,16 @@
</div>
<div style="margin-top: 20px"></div>
<h2 id="comment-number" style="text-align: center;margin-bottom: 10px">评论 (
<h2 th:if="${article.allowComment eq T(cc.bnblogs.pojo.Article).COMMENT_ENABLE}" id="comment-number" style="text-align: center;margin-bottom: 10px">评论 (
<th:block th:text="${article.getCommentCount() > 0 ? article.getCommentCount() : 0}"></th:block>
)
</h2>
<div class="lw-comment-box row lw-m0">
<div th:if="${article.allowComment eq T(cc.bnblogs.pojo.Article).COMMENT_DISABLE}" style="padding: 15px; color: red; font-size: 18px; background-color: #fff;text-align: center">
<p>对不起,此页面站长设置了不允许评论</p>
</div>
<div th:if="${article.allowComment eq T(cc.bnblogs.pojo.Article).COMMENT_ENABLE}" class="lw-comment-box row lw-m0">
<form id="lw-comment-form">
<input type="hidden" id="article-id" name="article.id" th:value="${article.id}">
<input type="hidden" name="pid" value="0">
@ -174,7 +177,7 @@
</div>
</div>
<div id="comment-list">
<div id="comment-list" th:if="${article.allowComment eq T(cc.bnblogs.pojo.Article).COMMENT_ENABLE}">
<th:block th:fragment="comments">
<div class="lw-comment-list">
<ul>
@ -297,7 +300,7 @@
<div class="lw-friend-link">
<div class="lw-container">
<h2>友情链接</h2>
<h2 th:if="${friends.size()>0}">友情链接</h2>
<!--/*@thymesVar id="friends" type="java.util.List<cc.bnblogs.pojo.Friends>"*/-->
<a th:each="friend:${friends}" target="_blank" th:href="${friend.link}" th:text="${friend.title}"></a>
</div>

@ -40,7 +40,7 @@
<div class="lw-container lw-main lw-posr">
<div class="lw-left-list">
<div class="swiper mySwiper lw-swiper">
<div class="swiper mySwiper lw-swiper" th:if="${banners.size() > 0}">
<div class="swiper-wrapper">
<div class="swiper-slide lw-posr" th:each="banner:${banners}">
<img th:src="${banner.cover}" th:alt="${banner.title}" srcset="">
@ -60,6 +60,7 @@
</div>
<div class="lw-article-list">
<th:block th:include="common::article(${articlePage.rows})"></th:block>
<div class="lw-tag-list" th:if="${articlePage.rows.size() == 0}" style="font-size: 25px;height: 300px;line-height: 300px;color: red;font-weight: bold;text-align: center" th:text="没有找到任何文章"></div>
</div>
<ul th:if="${articlePage.totalPages >1}" class="lw-pagenation">
<li th:if="${articlePage.currentPage != 1}"><a th:href="@{/}">首页</a></li>
@ -81,7 +82,7 @@
<th:block th:fragment="footer">
<div class="lw-friend-link">
<div class="lw-container">
<h2>友情链接</h2>
<h2 th:if="${friends.size() != 0}">友情链接</h2>
<!--/*@thymesVar id="friends" type="java.util.List<cc.bnblogs.pojo.Friends>"*/-->
<a th:each="friend:${friends}" target="_blank" th:href="${friend.link}" th:text="${friend.title}"></a>
</div>

@ -120,7 +120,7 @@
<th:block th:fragment="footer">
<div class="lw-friend-link">
<div class="lw-container">
<h2>友情链接</h2>
<h2 th:if="${friends.size()>0}">友情链接</h2>
<!--/*@thymesVar id="friends" type="java.util.List<cc.bnblogs.pojo.Friends>"*/-->
<a th:each="friend:${friends}" target="_blank" th:href="${friend.link}" th:text="${friend.title}"></a>
</div>

@ -14,6 +14,7 @@
<li class="active">标签云</li>
</ol>
<div class="lw-tag-list">
<div th:if="${tags.size() == 0}" style="height: 200px; line-height: 200px; text-align: center;font-size: 25px; font-weight: bold; color: red;">未找到标签!</div>
<a th:each="tag:${tagList}" th:title="${tag.name}" th:href="@{/tag/{id}.html(id=${tag.getId()})}">
<th:block th:text="${tag.name}"></th:block>
<span><th:block th:text="${tag.getArticleCount()}"></th:block></span></a>
@ -42,6 +43,7 @@
</div>
<div class="lw-right-item lw-right-hot">
<h4><i class="fa fa-fire lw-mr5" aria-hidden="true"></i>热门文章</h4>
<ul class="lw-right-item" style="font-size: 20px;padding-left: 5px" th:if="${hots.size()==0}">没有任何文章</ul>
<ul class="lw-hot-list">
<!--/*@thymesVar id="hots" type="java.util.List<cc.bnblogs.pojo.Article>"*/-->
<li th:each="hot,it:${hots}">
@ -64,9 +66,11 @@
</div>
<div class="lw-right-item lw-tag-cloud">
<h4><i class="fa fa-tags lw-mr5" aria-hidden="true"></i>标签云</h4>
<ul class="lw-right-item" style="font-size: 20px;padding-left: 5px" th:if="${tags.size()==0}">没有任何标签</ul>
<!--/*@thymesVar id="tags" type="java.util.List<cc.bnblogs.pojo.Tag>"*/-->
<a th:each="tag:${tags}" th:href="@{/tag/{id}.html(id=${tag.id})}" th:title="${tag.name}"
th:text="${tag.name}"></a>
</div>
</th:block>
</div>
@ -75,7 +79,7 @@
<th:block th:fragment="footer">
<div class="lw-friend-link">
<div class="lw-container">
<h2>友情链接</h2>
<h2 th:if="${friends.size()>0}">友情链接</h2>
<!--/*@thymesVar id="friends" type="java.util.List<cc.bnblogs.pojo.Friends>"*/-->
<a th:each="friend:${friends}" target="_blank" th:href="${friend.link}" th:text="${friend.title}"></a>
</div>

Loading…
Cancel
Save