From 00a4c4bf70755aa10080676250ddb32b5773a739 Mon Sep 17 00:00:00 2001 From: ronger Date: Sat, 27 Aug 2022 22:15:41 +0800 Subject: [PATCH] =?UTF-8?q?:art:=20=E4=BB=A3=E7=A0=81=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/rymcu/forest/config/MybatisConfigurer.java | 3 +-- src/main/java/com/rymcu/forest/entity/ForestFile.java | 8 ++++++-- src/main/resources/application.yml | 2 +- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/rymcu/forest/config/MybatisConfigurer.java b/src/main/java/com/rymcu/forest/config/MybatisConfigurer.java index 9aa708d..73aede7 100644 --- a/src/main/java/com/rymcu/forest/config/MybatisConfigurer.java +++ b/src/main/java/com/rymcu/forest/config/MybatisConfigurer.java @@ -40,12 +40,11 @@ public class MybatisConfigurer { pageHelper.setProperties(properties); //添加插件 - factory.setPlugins(new Interceptor[]{pageHelper}); + factory.setPlugins(pageHelper); //添加XML目录 ResourcePatternResolver resolver = new PathMatchingResourcePatternResolver(); factory.setMapperLocations(resolver.getResources("classpath:mapper/**/*.xml")); -// factory.setTypeHandlersPackage("com.rymcu.forest.util.handlers"); return factory.getObject(); } diff --git a/src/main/java/com/rymcu/forest/entity/ForestFile.java b/src/main/java/com/rymcu/forest/entity/ForestFile.java index 58a8dfa..bcb7aee 100644 --- a/src/main/java/com/rymcu/forest/entity/ForestFile.java +++ b/src/main/java/com/rymcu/forest/entity/ForestFile.java @@ -1,5 +1,6 @@ package com.rymcu.forest.entity; +import com.fasterxml.jackson.annotation.JsonFormat; import lombok.Data; import javax.persistence.Column; @@ -21,13 +22,15 @@ public class ForestFile { @Id @GeneratedValue(generator = "JDBC") @Column(name = "id") + @JsonFormat(shape = JsonFormat.Shape.STRING) private Long id; /** * 文件大小 */ @Column(name = "file_size") - private long fileSize; + @JsonFormat(shape = JsonFormat.Shape.STRING) + private Long fileSize; /** * 文件类型-文件后缀 @@ -68,7 +71,8 @@ public class ForestFile { * 创建人 */ @Column(name = "created_by") - private long createdBy; + @JsonFormat(shape = JsonFormat.Shape.STRING) + private Long createdBy; } diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index b28d3ae..1f0ad51 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -4,7 +4,7 @@ spring: thymeleaf: prefix: classpath:/templates/ suffix: .html - mode: LEGACYHTML5 + mode: HTML encoding: UTF-8 servlet: content-type: text/html