feat:
1. 修正分类页下拉 2. 隐藏移动端手机阅读量 3. 更新SpringBoot版本为2.3.0 4. 修正版本更新后JPA语法失效问题
This commit is contained in:
parent
fdc65c125f
commit
809a753e18
82
pom.xml
82
pom.xml
@ -14,7 +14,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-parent</artifactId>
|
<artifactId>spring-boot-starter-parent</artifactId>
|
||||||
<version>1.5.7.RELEASE</version>
|
<version>2.3.0.RELEASE</version>
|
||||||
<relativePath/> <!-- lookup parent from repository -->
|
<relativePath/> <!-- lookup parent from repository -->
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
@ -47,45 +47,54 @@
|
|||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||||
<java.version>1.8</java.version>
|
<java.version>1.8</java.version>
|
||||||
<!--设置tymeleaf的版本-->
|
|
||||||
<thymeleaf.version>3.0.2.RELEASE</thymeleaf.version>
|
|
||||||
<thymeleaf-layout-dialect.version>2.1.1</thymeleaf-layout-dialect.version>
|
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<!--jpa-->
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-starter-aop</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-data-jpa</artifactId>
|
<artifactId>spring-boot-starter-data-jpa</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<!--thymeleaf-->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-thymeleaf</artifactId>
|
<artifactId>spring-boot-starter-thymeleaf</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<!--web-->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-web</artifactId>
|
<artifactId>spring-boot-starter-web</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<!--devtools-->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-devtools</artifactId>
|
<artifactId>spring-boot-devtools</artifactId>
|
||||||
<scope>runtime</scope>
|
<scope>runtime</scope>
|
||||||
|
<optional>true</optional>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<!--mysql-->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>mysql</groupId>
|
<groupId>mysql</groupId>
|
||||||
<artifactId>mysql-connector-java</artifactId>
|
<artifactId>mysql-connector-java</artifactId>
|
||||||
<scope>runtime</scope>
|
<scope>runtime</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<!--lombok-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.projectlombok</groupId>
|
||||||
|
<artifactId>lombok</artifactId>
|
||||||
|
<optional>true</optional>
|
||||||
|
</dependency>
|
||||||
|
<!--test-->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-test</artifactId>
|
<artifactId>spring-boot-starter-test</artifactId>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<!--aop-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-aop</artifactId>
|
||||||
|
</dependency>
|
||||||
<!--引入Markdown转HTML的插件-->
|
<!--引入Markdown转HTML的插件-->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.atlassian.commonmark</groupId>
|
<groupId>com.atlassian.commonmark</groupId>
|
||||||
@ -105,8 +114,19 @@
|
|||||||
<version>0.10.0</version>
|
<version>0.10.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.projectlombok</groupId>
|
<groupId>org.hibernate</groupId>
|
||||||
<artifactId>lombok</artifactId>
|
<artifactId>hibernate-validator</artifactId>
|
||||||
|
<version>5.3.5.Final</version>
|
||||||
|
</dependency>
|
||||||
|
<!--配置文件:注解-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-configuration-processor</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<!--服务监控-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-actuator</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
@ -116,37 +136,15 @@
|
|||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||||
|
<version>2.3.0.RELEASE</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<goals>
|
||||||
|
<goal>repackage</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
</plugin>
|
</plugin>
|
||||||
<!-- <plugin>-->
|
|
||||||
<!-- <groupId>com.spotify</groupId>-->
|
|
||||||
<!-- <artifactId>docker-maven-plugin</artifactId>-->
|
|
||||||
<!-- <version>1.2.0</version>-->
|
|
||||||
<!-- <executions>-->
|
|
||||||
<!-- <execution>-->
|
|
||||||
<!-- <id>build-image</id>-->
|
|
||||||
<!-- <phase>package</phase>-->
|
|
||||||
<!-- <goals>-->
|
|
||||||
<!-- <goal>build</goal>-->
|
|
||||||
<!-- </goals>-->
|
|
||||||
<!-- </execution>-->
|
|
||||||
<!-- </executions>-->
|
|
||||||
<!-- <configuration>-->
|
|
||||||
<!-- <dockerHost>http://103.153.100.47:2375</dockerHost>-->
|
|
||||||
<!-- <imageName>mx/${project.artifactId}</imageName>-->
|
|
||||||
<!-- <imageTags>-->
|
|
||||||
<!-- <imageTag>${project.version}</imageTag>-->
|
|
||||||
<!-- </imageTags>-->
|
|
||||||
<!-- <forceTags>true</forceTags>-->
|
|
||||||
<!-- <dockerDirectory>${project.basedir}</dockerDirectory>-->
|
|
||||||
<!-- <resources>-->
|
|
||||||
<!-- <resource>-->
|
|
||||||
<!-- <targetPath>/</targetPath>-->
|
|
||||||
<!-- <directory>${project.build.directory}</directory>-->
|
|
||||||
<!-- <include>${project.build.finalName}.jar</include>-->
|
|
||||||
<!-- </resource>-->
|
|
||||||
<!-- </resources>-->
|
|
||||||
<!-- </configuration>-->
|
|
||||||
<!-- </plugin>-->
|
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
</project>
|
</project>
|
||||||
|
|||||||
@ -37,12 +37,12 @@ public class BlogServiceImpl implements BlogService
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Blog getBlog(Long id) {
|
public Blog getBlog(Long id) {
|
||||||
return blogRepository.findOne(id);
|
return blogRepository.findById(id).orElse(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Blog getAadConvertBlog(Long id) {
|
public Blog getAadConvertBlog(Long id) {
|
||||||
Blog blog = blogRepository.findOne(id);
|
Blog blog = blogRepository.findById(id).orElse(null);
|
||||||
if (blog == null){
|
if (blog == null){
|
||||||
throw new NotFoundException("该博客不存在!");
|
throw new NotFoundException("该博客不存在!");
|
||||||
}
|
}
|
||||||
@ -105,8 +105,8 @@ public class BlogServiceImpl implements BlogService
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Blog> listRecommendBlogTop(Integer size) {
|
public List<Blog> listRecommendBlogTop(Integer size) {
|
||||||
Sort sort = new Sort(Sort.Direction.DESC,"updateTime");
|
Sort sort = Sort.by(Sort.Direction.DESC,"updateTime");
|
||||||
Pageable pageable = new PageRequest(0,size,sort);
|
Pageable pageable = PageRequest.of(0,size,sort);
|
||||||
return blogRepository.findTop(pageable);
|
return blogRepository.findTop(pageable);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -148,7 +148,7 @@ public class BlogServiceImpl implements BlogService
|
|||||||
@Transactional
|
@Transactional
|
||||||
@Override
|
@Override
|
||||||
public Blog updateBlog(Long id, Blog blog) {
|
public Blog updateBlog(Long id, Blog blog) {
|
||||||
Blog b = blogRepository.findOne(id);
|
Blog b = blogRepository.findById(id).orElse(null);
|
||||||
//判断是否存在这条数据
|
//判断是否存在这条数据
|
||||||
if(b == null){
|
if(b == null){
|
||||||
throw new NotFoundException("该博客不存在");
|
throw new NotFoundException("该博客不存在");
|
||||||
@ -159,9 +159,9 @@ public class BlogServiceImpl implements BlogService
|
|||||||
return blogRepository.save(b);
|
return blogRepository.save(b);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional
|
@Transactional(rollbackFor = Exception.class)
|
||||||
@Override
|
@Override
|
||||||
public void deleteBlog(Long id) {
|
public void deleteBlog(Long id) {
|
||||||
blogRepository.delete(id);
|
blogRepository.deleteById(id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -26,7 +26,7 @@ public class CommentServiceImpl implements CommentService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Comment> listCommentByBlogId(Long blogId) {
|
public List<Comment> listCommentByBlogId(Long blogId) {
|
||||||
Sort sort = new Sort("createTime");
|
Sort sort = Sort.by("createTime");
|
||||||
List<Comment> comments = commentRepository.findByBlogIdAndParentCommentNull(blogId,sort);
|
List<Comment> comments = commentRepository.findByBlogIdAndParentCommentNull(blogId,sort);
|
||||||
return CommentUtil.eachComment(comments);
|
return CommentUtil.eachComment(comments);
|
||||||
}
|
}
|
||||||
@ -38,7 +38,7 @@ public class CommentServiceImpl implements CommentService {
|
|||||||
Long parentCommentId = comment.getParentComment().getId();
|
Long parentCommentId = comment.getParentComment().getId();
|
||||||
System.out.println(parentCommentId);
|
System.out.println(parentCommentId);
|
||||||
if(parentCommentId != -1){
|
if(parentCommentId != -1){
|
||||||
comment.setParentComment(commentRepository.findOne(parentCommentId));
|
comment.setParentComment(commentRepository.findById(parentCommentId).orElse(null));
|
||||||
} else {
|
} else {
|
||||||
//发布评论:
|
//发布评论:
|
||||||
comment.setParentComment(null);
|
comment.setParentComment(null);
|
||||||
|
|||||||
@ -35,7 +35,7 @@ public class TagServiceImpl implements TagService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Tag getTag(Long id) {
|
public Tag getTag(Long id) {
|
||||||
return tagRepository.findOne(id);
|
return tagRepository.findById(id).orElse(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -45,8 +45,8 @@ public class TagServiceImpl implements TagService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Tag> ListTagTop(Integer size) {
|
public List<Tag> ListTagTop(Integer size) {
|
||||||
Sort sort = new Sort(Sort.Direction.DESC,"blogs.size");
|
Sort sort = Sort.by(Sort.Direction.DESC,"blogs.size");
|
||||||
Pageable pageable = new PageRequest(0,size,sort);
|
Pageable pageable = PageRequest.of(0,size,sort);
|
||||||
return tagRepository.findTop(pageable);
|
return tagRepository.findTop(pageable);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -57,12 +57,13 @@ public class TagServiceImpl implements TagService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Tag> ListTag(String ids) {
|
public List<Tag> ListTag(String ids) {
|
||||||
return tagRepository.findAll(convertToList(ids));
|
// todo
|
||||||
|
return tagRepository.findAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Tag updateTag(Long id, Tag tag) {
|
public Tag updateTag(Long id, Tag tag) {
|
||||||
Tag t = tagRepository.findOne(id);
|
Tag t = tagRepository.findById(id).orElse(null);
|
||||||
if(t==null){
|
if(t==null){
|
||||||
throw new NotFoundException("不存在该标签");
|
throw new NotFoundException("不存在该标签");
|
||||||
}
|
}
|
||||||
@ -73,7 +74,7 @@ public class TagServiceImpl implements TagService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void deleteTag(Long id) {
|
public void deleteTag(Long id) {
|
||||||
tagRepository.delete(id);
|
tagRepository.deleteById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -38,7 +38,7 @@ public class TypeServiceImpl implements TypeService {
|
|||||||
@Transactional
|
@Transactional
|
||||||
@Override
|
@Override
|
||||||
public Type getType(Long id) {
|
public Type getType(Long id) {
|
||||||
return typeRepository.findOne(id);
|
return typeRepository.findById(id).orElse(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
@ -54,15 +54,15 @@ public class TypeServiceImpl implements TypeService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Type> listTypeTop(Integer size) {
|
public List<Type> listTypeTop(Integer size) {
|
||||||
Sort sort = new Sort(Sort.Direction.DESC, "blogs.size");
|
Sort sort = Sort.by(Sort.Direction.DESC, "blogs.size");
|
||||||
Pageable pageable = new PageRequest(0, size, sort);
|
Pageable pageable = PageRequest.of(0, size, sort);
|
||||||
return typeRepository.findTop(pageable);
|
return typeRepository.findTop(pageable);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
@Override
|
@Override
|
||||||
public Type updateType(Long id, Type type) {
|
public Type updateType(Long id, Type type) {
|
||||||
Type t = typeRepository.findOne(id);
|
Type t = typeRepository.findById(id).orElse(null);
|
||||||
if(t == null){
|
if(t == null){
|
||||||
throw new NotFoundException("不存在该类型");
|
throw new NotFoundException("不存在该类型");
|
||||||
}
|
}
|
||||||
@ -70,10 +70,10 @@ public class TypeServiceImpl implements TypeService {
|
|||||||
return typeRepository.save(t);
|
return typeRepository.save(t);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional
|
@Transactional(rollbackFor = Exception.class)
|
||||||
@Override
|
@Override
|
||||||
public void deleteType(Long id) {
|
public void deleteType(Long id) {
|
||||||
typeRepository.delete(id);
|
typeRepository.deleteById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
#thymeleaf模板
|
#thymeleaf模板
|
||||||
spring:
|
spring:
|
||||||
datasource:
|
datasource:
|
||||||
driver-class-name: com.mysql.jdbc.Driver
|
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||||
url: jdbc:mysql://localhost:3306/blog?useUnicode=true&characterEncoding=utf-8
|
url: jdbc:mysql://localhost:3306/blog?useUnicode=true&characterEncoding=utf-8
|
||||||
username: root
|
username: root
|
||||||
password: 123456
|
password: 123456
|
||||||
@ -16,5 +16,7 @@ logging:
|
|||||||
root: warn
|
root: warn
|
||||||
com.yrp: info
|
com.yrp: info
|
||||||
file: log/-blogpro.log
|
file: log/-blogpro.log
|
||||||
|
|
||||||
|
# 服务端口
|
||||||
server:
|
server:
|
||||||
port: 9420
|
port: 9420
|
||||||
|
|||||||
@ -50,7 +50,7 @@
|
|||||||
<div class="item">
|
<div class="item">
|
||||||
<i class="calendar icon"></i><span th:text="${#dates.format(blog.updateTime,'yyyy-MM-dd')}">2019-10-01</span>
|
<i class="calendar icon"></i><span th:text="${#dates.format(blog.updateTime,'yyyy-MM-dd')}">2019-10-01</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="item">
|
<div class="item m-mobile-hide">
|
||||||
<i class="eye icon"></i><span th:text="${blog.views}">7437</span>
|
<i class="eye icon"></i><span th:text="${blog.views}">7437</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -31,7 +31,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!--分类列表区域-->
|
<!--分类列表区域-->
|
||||||
<div class="ui attached segment m-padded-tb-large ">
|
<div class="ui attached segment m-padded-tb-large " style="display: none">
|
||||||
<a href="" class="ui teal basic center pointing large label ">
|
<a href="" class="ui teal basic center pointing large label ">
|
||||||
JavaEE
|
JavaEE
|
||||||
<div class="detail">23</div>
|
<div class="detail">23</div>
|
||||||
|
|||||||
@ -18,7 +18,7 @@
|
|||||||
<h2 class="ui teal header item">浅枫沐雪</h2>
|
<h2 class="ui teal header item">浅枫沐雪</h2>
|
||||||
<a href="#" class="m-item item m-mobile-hide" ><i class="small home icon"></i>首页</a>
|
<a href="#" class="m-item item m-mobile-hide" ><i class="small home icon"></i>首页</a>
|
||||||
<a href="#" class="m-item item m-mobile-hide " ><i class="small idea icon"></i>分类</a>
|
<a href="#" class="m-item item m-mobile-hide " ><i class="small idea icon"></i>分类</a>
|
||||||
<a href="#" class="m-item item m-mobile-hide active"><i class="small tags icon"></i>标签</a>
|
<a href="#" class="m-item item m-mobile-hide"><i class="small tags icon"></i>标签</a>
|
||||||
<a href="#" class="m-item item m-mobile-hide"><i class="small clone icon"></i>归档</a>
|
<a href="#" class="m-item item m-mobile-hide"><i class="small clone icon"></i>归档</a>
|
||||||
<a href="#" class="m-item item m-mobile-hide"><i class="small info icon"></i>站长信息</a>
|
<a href="#" class="m-item item m-mobile-hide"><i class="small info icon"></i>站长信息</a>
|
||||||
<div class="right m-item item m-mobile-hide">
|
<div class="right m-item item m-mobile-hide">
|
||||||
@ -203,6 +203,8 @@
|
|||||||
<!--引入所需要的JS-->
|
<!--引入所需要的JS-->
|
||||||
<th:block th:replace="_fragments :: script">
|
<th:block th:replace="_fragments :: script">
|
||||||
|
|
||||||
|
</th:block>
|
||||||
|
|
||||||
<!--声明行内js代码域-->
|
<!--声明行内js代码域-->
|
||||||
<script>
|
<script>
|
||||||
$('.menu.toggle').click(function () {
|
$('.menu.toggle').click(function () {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user