diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..8e2211d --- /dev/null +++ b/.gitignore @@ -0,0 +1,7 @@ +**/target/ +.idea +*.iml +*.class +*Test.java +**/test/ +logs \ No newline at end of file diff --git a/pom.xml b/pom.xml index 3800150..e518e0a 100644 --- a/pom.xml +++ b/pom.xml @@ -26,7 +26,7 @@ 17 UTF-8 8.0.32 - 2.0.21 + 2.0.47 1.18.20 3.0.1 2.1.0 diff --git a/spzx-common/common-service/pom.xml b/spzx-common/common-service/pom.xml index 9d8c274..26539f1 100644 --- a/spzx-common/common-service/pom.xml +++ b/spzx-common/common-service/pom.xml @@ -24,6 +24,11 @@ spzx-model 1.0-SNAPSHOT + + com.atguigu + common-util + 1.0-SNAPSHOT + org.springframework.boot @@ -34,11 +39,10 @@ org.springframework.boot spring-boot-starter-data-redis + - com.atguigu - common-util - 1.0-SNAPSHOT - compile + org.springframework.boot + spring-boot-configuration-processor diff --git a/spzx-common/common-service/src/main/java/com/atguigu/config/RedisConfiguration.java b/spzx-common/common-service/src/main/java/com/atguigu/config/RedisConfiguration.java index 155eee0..bc4da51 100644 --- a/spzx-common/common-service/src/main/java/com/atguigu/config/RedisConfiguration.java +++ b/spzx-common/common-service/src/main/java/com/atguigu/config/RedisConfiguration.java @@ -35,15 +35,16 @@ public class RedisConfiguration { * 使用StringRedisSerializer序列化为字符串 */ @Bean - public RedisTemplate redisTemplate(LettuceConnectionFactory factory) { + public RedisTemplate redisTemplate(LettuceConnectionFactory connectionFactory) { RedisTemplate redisTemplate = new RedisTemplate<>(); - redisTemplate.setConnectionFactory(factory); - // 设置key序列化为String + redisTemplate.setConnectionFactory(connectionFactory); + // 设置key序列化为string redisTemplate.setKeySerializer(new StringRedisSerializer()); - redisTemplate.setHashKeySerializer(new StringRedisSerializer()); - // 设置value序列化为JSON,使用GenericJackson2JsonRedisSerializer替换默认的序列化 + // 设置value序列化为JSON,使用GenericJackson2JsonRedisSerializer替换默认序列化 redisTemplate.setValueSerializer(new GenericJackson2JsonRedisSerializer()); + redisTemplate.setHashKeySerializer(new StringRedisSerializer()); redisTemplate.setHashValueSerializer(new GenericJackson2JsonRedisSerializer()); + return redisTemplate; } @@ -62,29 +63,31 @@ public class RedisConfiguration { .serializeKeysWith(RedisSerializationContext.SerializationPair.fromSerializer(redisSerializer)) .serializeValuesWith(RedisSerializationContext.SerializationPair.fromSerializer(serializer)); - return RedisCacheManager.builder(factory).cacheDefaults(redisCacheConfiguration).build(); + RedisCacheManager cacheManager = RedisCacheManager.builder(factory) + .cacheDefaults(redisCacheConfiguration).build(); + return cacheManager; } /** * 指定的日期模式 */ public Jackson2JsonRedisSerializer jsonRedisSerializer() { - // LocalDatetime序列化,默认不兼容jdk8日期序列化 - JavaTimeModule javaTimeModule = new JavaTimeModule(); - javaTimeModule.addDeserializer(LocalDate.class, new LocalDateDeserializer(DateTimeFormatter.ofPattern("yyyy-MM-dd"))); - javaTimeModule.addSerializer(LocalDate.class, new LocalDateSerializer(DateTimeFormatter.ofPattern("yyyy-MM-dd"))); - javaTimeModule.addDeserializer(LocalDateTime.class, new LocalDateTimeDeserializer(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))); - javaTimeModule.addSerializer(LocalDateTime.class, new LocalDateTimeSerializer(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))); - ObjectMapper mapper = new ObjectMapper(); - // 设置Object访问权限 + // 设置ObjectMapper访问权限 mapper.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY); // 记录序列化之后的数据类型,方便反序列化 mapper.activateDefaultTyping(LaissezFaireSubTypeValidator.instance, ObjectMapper.DefaultTyping.NON_FINAL); // 关闭默认的日期格式化方式,默认UTC日期格式 yyyy-MM-dd’T’HH:mm:ss.SSS mapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS); - mapper.registerModule(javaTimeModule); + // LocalDatetime序列化,默认不兼容jdk8日期序列化 + JavaTimeModule timeModule = new JavaTimeModule(); + timeModule.addDeserializer(LocalDate.class, new LocalDateDeserializer(DateTimeFormatter.ofPattern("yyyy-MM-dd"))); + timeModule.addSerializer(LocalDate.class, new LocalDateSerializer(DateTimeFormatter.ofPattern("yyyy-MM-dd"))); + timeModule.addDeserializer(LocalDateTime.class, new LocalDateTimeDeserializer(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))); + timeModule.addSerializer(LocalDateTime.class, new LocalDateTimeSerializer(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))); + + mapper.registerModule(timeModule); return new Jackson2JsonRedisSerializer<>(mapper, Object.class); } } \ No newline at end of file diff --git a/spzx-common/common-service/src/main/java/com/atguigu/config/ResourceConfiguration.java b/spzx-common/common-service/src/main/java/com/atguigu/config/ResourceConfiguration.java index af41f00..7559018 100644 --- a/spzx-common/common-service/src/main/java/com/atguigu/config/ResourceConfiguration.java +++ b/spzx-common/common-service/src/main/java/com/atguigu/config/ResourceConfiguration.java @@ -7,9 +7,9 @@ import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry @Configuration @Slf4j public class ResourceConfiguration extends WebMvcConfiguration { - protected void addResourceHandlers(ResourceHandlerRegistry registry) { - log.info("ResourceConfiguration===>设置静态资源映射..."); + public void addResourceHandlers(ResourceHandlerRegistry registry) { + log.info("设置静态资源映射"); registry.addResourceHandler("/doc.html").addResourceLocations("classpath:/META-INF/resources/"); registry.addResourceHandler("/webjars/**").addResourceLocations("classpath:/META-INF/resources/webjars/"); } -} +} \ No newline at end of file diff --git a/spzx-common/common-service/src/main/java/com/atguigu/config/WebMvcConfiguration.java b/spzx-common/common-service/src/main/java/com/atguigu/config/WebMvcConfiguration.java index 0998452..34b8283 100644 --- a/spzx-common/common-service/src/main/java/com/atguigu/config/WebMvcConfiguration.java +++ b/spzx-common/common-service/src/main/java/com/atguigu/config/WebMvcConfiguration.java @@ -1,21 +1,14 @@ package com.atguigu.config; -import com.atguigu.constant.LocalDateTimeConstant; import com.atguigu.interceptor.LoginAuthInterceptor; -import com.atguigu.json.JacksonObjectMapper; import com.atguigu.properties.InterceptorsProperties; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.converter.HttpMessageConverter; -import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; import org.springframework.stereotype.Component; import org.springframework.web.servlet.config.annotation.CorsRegistry; import org.springframework.web.servlet.config.annotation.InterceptorRegistry; import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport; -import java.text.SimpleDateFormat; -import java.util.List; - @Component @Slf4j public class WebMvcConfiguration extends WebMvcConfigurationSupport { @@ -48,22 +41,4 @@ public class WebMvcConfiguration extends WebMvcConfigurationSupport { registry.addInterceptor(loginAuthInterceptor).addPathPatterns("/**") .excludePathPatterns(interceptorsProperties.getNoAuthUrls()); } - - /** - * 扩展Spring MVC框架的消息转化器 - * - * @param converters 转换器 - */ - public void extendMessageConverters(List> converters) { - log.info("WebMvcConfiguration===>扩展消息转换器..."); - // 创建一个消息转换器对象 - MappingJackson2HttpMessageConverter converter = new MappingJackson2HttpMessageConverter(); - // 需要为消息转换器设置一个对象转换器,对象转换器可以将Java对象序列化为json数据 - converter.setObjectMapper(new JacksonObjectMapper()); - // 添加条件判断,只应用于特定的请求路径 - converter.getObjectMapper().setDateFormat(new SimpleDateFormat(LocalDateTimeConstant.DEFAULT_DATE_TIME_SECOND_FORMAT)); - - // 将自己的消息转化器加入容器中 - converters.add(converter); - } } \ No newline at end of file diff --git a/spzx-common/common-service/src/main/java/com/atguigu/handler/GlobalExceptionHandler.java b/spzx-common/common-service/src/main/java/com/atguigu/handler/GlobalExceptionHandler.java index 202e696..3c4d76d 100644 --- a/spzx-common/common-service/src/main/java/com/atguigu/handler/GlobalExceptionHandler.java +++ b/spzx-common/common-service/src/main/java/com/atguigu/handler/GlobalExceptionHandler.java @@ -67,7 +67,7 @@ public class GlobalExceptionHandler { String username = message.split(" ")[2]; // 错误信息 String errorMessage = username + MessageConstant.ALREADY_EXISTS; - return Result.error(exception.getMessage()); + return Result.error(errorMessage); } else { return Result.error(MessageConstant.UNKNOWN_ERROR); } diff --git a/spzx-common/common-service/src/main/java/com/atguigu/interceptor/LoginAuthInterceptor.java b/spzx-common/common-service/src/main/java/com/atguigu/interceptor/LoginAuthInterceptor.java index 73af3e9..6869f7d 100644 --- a/spzx-common/common-service/src/main/java/com/atguigu/interceptor/LoginAuthInterceptor.java +++ b/spzx-common/common-service/src/main/java/com/atguigu/interceptor/LoginAuthInterceptor.java @@ -39,15 +39,15 @@ public class LoginAuthInterceptor implements HandlerInterceptor { } // 获取用户信息不存在 - String userinfoString = (String) redisTemplate.opsForValue().get(token); - if (StringUtils.isEmpty(userinfoString)) { + Object sysUserObject = redisTemplate.opsForValue().get(token); + String sysUserString = JSON.toJSONString(sysUserObject); + if (sysUserObject == null) { InterceptorUtil.unLoginInterceptor(response); return false; } // 将用户信息放到ThreadLocal中 - SysUser sysUser = JSON.parseObject(userinfoString, SysUser.class); - BaseContext.setSysUser(sysUser); + BaseContext.setSysUser(JSON.parseObject(sysUserString, SysUser.class)); // 更新Redis过期时间 redisTemplate.expire(token, 7, TimeUnit.DAYS); diff --git a/spzx-common/common-service/target/classes/com/atguigu/config/RedisConfiguration.class b/spzx-common/common-service/target/classes/com/atguigu/config/RedisConfiguration.class index 7b1ee25..862691f 100644 Binary files a/spzx-common/common-service/target/classes/com/atguigu/config/RedisConfiguration.class and b/spzx-common/common-service/target/classes/com/atguigu/config/RedisConfiguration.class differ diff --git a/spzx-common/common-service/target/classes/com/atguigu/config/ResourceConfiguration.class b/spzx-common/common-service/target/classes/com/atguigu/config/ResourceConfiguration.class index 4f4fcc7..c087841 100644 Binary files a/spzx-common/common-service/target/classes/com/atguigu/config/ResourceConfiguration.class and b/spzx-common/common-service/target/classes/com/atguigu/config/ResourceConfiguration.class differ diff --git a/spzx-common/common-service/target/classes/com/atguigu/config/WebMvcConfiguration.class b/spzx-common/common-service/target/classes/com/atguigu/config/WebMvcConfiguration.class index 8b293ef..ad6465f 100644 Binary files a/spzx-common/common-service/target/classes/com/atguigu/config/WebMvcConfiguration.class and b/spzx-common/common-service/target/classes/com/atguigu/config/WebMvcConfiguration.class differ diff --git a/spzx-common/common-service/target/classes/com/atguigu/handler/GlobalExceptionHandler.class b/spzx-common/common-service/target/classes/com/atguigu/handler/GlobalExceptionHandler.class index 77fa4b2..f255403 100644 Binary files a/spzx-common/common-service/target/classes/com/atguigu/handler/GlobalExceptionHandler.class and b/spzx-common/common-service/target/classes/com/atguigu/handler/GlobalExceptionHandler.class differ diff --git a/spzx-common/common-service/target/classes/com/atguigu/interceptor/LoginAuthInterceptor.class b/spzx-common/common-service/target/classes/com/atguigu/interceptor/LoginAuthInterceptor.class index 09fccf0..810943c 100644 Binary files a/spzx-common/common-service/target/classes/com/atguigu/interceptor/LoginAuthInterceptor.class and b/spzx-common/common-service/target/classes/com/atguigu/interceptor/LoginAuthInterceptor.class differ diff --git a/spzx-common/common-util/src/main/java/com/atguigu/json/JacksonObjectMapper.java b/spzx-common/common-util/src/main/java/com/atguigu/json/JacksonObjectMapper.java deleted file mode 100644 index b1abf54..0000000 --- a/spzx-common/common-util/src/main/java/com/atguigu/json/JacksonObjectMapper.java +++ /dev/null @@ -1,46 +0,0 @@ -package com.atguigu.json; - -import com.fasterxml.jackson.databind.DeserializationFeature; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.module.SimpleModule; -import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateDeserializer; -import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer; -import com.fasterxml.jackson.datatype.jsr310.deser.LocalTimeDeserializer; -import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateSerializer; -import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer; -import com.fasterxml.jackson.datatype.jsr310.ser.LocalTimeSerializer; - -import java.time.LocalDate; -import java.time.LocalDateTime; -import java.time.LocalTime; -import java.time.format.DateTimeFormatter; - -import static com.atguigu.constant.LocalDateTimeConstant.*; -import static com.fasterxml.jackson.databind.DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES; - -/** - * 对象映射器:基于jackson将Java对象转为json,或者将json转为Java对象 - * 将JSON解析为Java对象的过程称为 [从JSON反序列化Java对象] - * 从Java对象生成JSON的过程称为 [序列化Java对象到JSON] - */ -public class JacksonObjectMapper extends ObjectMapper { - public JacksonObjectMapper() { - super(); - // 收到未知属性时不报异常 - this.configure(FAIL_ON_UNKNOWN_PROPERTIES, false); - - // 反序列化时,属性不存在的兼容处理 - this.getDeserializationConfig().withoutFeatures(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES); - - SimpleModule simpleModule = new SimpleModule() - .addDeserializer(LocalDateTime.class, new LocalDateTimeDeserializer(DateTimeFormatter.ofPattern(DEFAULT_DATE_TIME_FORMAT))) - .addDeserializer(LocalDate.class, new LocalDateDeserializer(DateTimeFormatter.ofPattern(DEFAULT_DATE_FORMAT))) - .addDeserializer(LocalTime.class, new LocalTimeDeserializer(DateTimeFormatter.ofPattern(DEFAULT_TIME_FORMAT))) - .addSerializer(LocalDateTime.class, new LocalDateTimeSerializer(DateTimeFormatter.ofPattern(DEFAULT_DATE_TIME_FORMAT))) - .addSerializer(LocalDate.class, new LocalDateSerializer(DateTimeFormatter.ofPattern(DEFAULT_DATE_FORMAT))) - .addSerializer(LocalTime.class, new LocalTimeSerializer(DateTimeFormatter.ofPattern(DEFAULT_TIME_FORMAT))); - - // 注册功能模块 例如,可以添加自定义序列化器和反序列化器 - this.registerModule(simpleModule); - } -} diff --git a/spzx-common/common-util/target/classes/com/atguigu/json/JacksonObjectMapper.class b/spzx-common/common-util/target/classes/com/atguigu/json/JacksonObjectMapper.class deleted file mode 100644 index 5f5fd50..0000000 Binary files a/spzx-common/common-util/target/classes/com/atguigu/json/JacksonObjectMapper.class and /dev/null differ diff --git a/spzx-manager/src/main/java/com/atguigu/spzx/manger/MangerApplication.java b/spzx-manager/src/main/java/com/atguigu/spzx/manger/MangerApplication.java index 74257de..dfd7c12 100644 --- a/spzx-manager/src/main/java/com/atguigu/spzx/manger/MangerApplication.java +++ b/spzx-manager/src/main/java/com/atguigu/spzx/manger/MangerApplication.java @@ -1,15 +1,21 @@ package com.atguigu.spzx.manger; +import lombok.extern.slf4j.Slf4j; +import org.mybatis.spring.annotation.MapperScan; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cache.annotation.EnableCaching; import org.springframework.context.annotation.ComponentScan; import org.springframework.scheduling.annotation.EnableScheduling; +import org.springframework.transaction.annotation.EnableTransactionManagement; @SpringBootApplication -@EnableCaching +@EnableTransactionManagement // 开启注解方式的事务管理 +@EnableCaching// 开启缓存注解 @EnableScheduling @ComponentScan("com.atguigu") +@MapperScan("com.atguigu.spzx.manger.mapper") +@Slf4j public class MangerApplication { public static void main(String[] args) { SpringApplication.run(MangerApplication.class, args); diff --git a/spzx-manager/src/main/java/com/atguigu/spzx/manger/service/impl/SysUserServiceImpl.java b/spzx-manager/src/main/java/com/atguigu/spzx/manger/service/impl/SysUserServiceImpl.java index bcecf18..2ff7b62 100644 --- a/spzx-manager/src/main/java/com/atguigu/spzx/manger/service/impl/SysUserServiceImpl.java +++ b/spzx-manager/src/main/java/com/atguigu/spzx/manger/service/impl/SysUserServiceImpl.java @@ -1,6 +1,5 @@ package com.atguigu.spzx.manger.service.impl; -import com.alibaba.fastjson.JSON; import com.atguigu.constant.ExceptionConstant; import com.atguigu.exception.BunnyException; import com.atguigu.lib.MD5; @@ -66,7 +65,7 @@ public class SysUserServiceImpl implements SysUserService { } // 登录成功 String token = UUID.randomUUID().toString().replaceAll("-", ""); - redisTemplate.opsForValue().set(token, JSON.toJSONString(sysUser), 7, TimeUnit.DAYS); + redisTemplate.opsForValue().set(token, sysUser, 7, TimeUnit.DAYS); // 返回loginVo对象 return LoginVo.builder().token(token).build(); } diff --git a/spzx-manager/src/main/resources/application-dev.yml b/spzx-manager/src/main/resources/application-dev.yml index b494140..b31cc35 100644 --- a/spzx-manager/src/main/resources/application-dev.yml +++ b/spzx-manager/src/main/resources/application-dev.yml @@ -11,12 +11,8 @@ bunny: port: 6379 database: 2 - spzx: noAuthUrls: - /admin/system/index/login - /admin/system/index/generateValidateCode - /v3/** -# jackson: -# date-format: yyyy-MM-dd HH:mm:ss -# time-zone: GMT+8 \ No newline at end of file diff --git a/spzx-manager/src/main/resources/application.yml b/spzx-manager/src/main/resources/application.yml index 6ee6c3b..85506e2 100644 --- a/spzx-manager/src/main/resources/application.yml +++ b/spzx-manager/src/main/resources/application.yml @@ -14,6 +14,7 @@ spring: url: jdbc:mysql://${bunny.datasource.host}:${bunny.datasource.port}/${bunny.datasource.sqlData}?serverTimezone=GMT%2B8&useSSL=false&characterEncoding=utf-8&allowPublicKeyRetrieval=true username: ${bunny.datasource.username} password: "${bunny.datasource.password}" + data: redis: host: ${bunny.redis.host} @@ -28,12 +29,11 @@ logging: pattern: dateformat: HH:mm:ss:SSS file: - path: " logs/${spring.application.name}" + path: "logs/${spring.application.name}" mybatis: type-aliases-package: com.atguigu.spzx.model mapper-locations: classpath:mapper/*.xml - # config-location: classpath:mybatis-config.xml configuration: log-impl: org.apache.ibatis.logging.stdout.StdOutImpl map-underscore-to-camel-case: true diff --git a/spzx-manager/src/main/resources/logback-spring.xml b/spzx-manager/src/main/resources/logback-spring.xml index eb59d34..acce308 100644 --- a/spzx-manager/src/main/resources/logback-spring.xml +++ b/spzx-manager/src/main/resources/logback-spring.xml @@ -4,7 +4,7 @@ logback - + @@ -12,13 +12,14 @@ - + - + - + @@ -45,11 +46,11 @@ - + - - + + diff --git a/spzx-manager/target/classes/application-dev.yml b/spzx-manager/target/classes/application-dev.yml index b494140..b31cc35 100644 --- a/spzx-manager/target/classes/application-dev.yml +++ b/spzx-manager/target/classes/application-dev.yml @@ -11,12 +11,8 @@ bunny: port: 6379 database: 2 - spzx: noAuthUrls: - /admin/system/index/login - /admin/system/index/generateValidateCode - /v3/** -# jackson: -# date-format: yyyy-MM-dd HH:mm:ss -# time-zone: GMT+8 \ No newline at end of file diff --git a/spzx-manager/target/classes/application.yml b/spzx-manager/target/classes/application.yml index 6ee6c3b..85506e2 100644 --- a/spzx-manager/target/classes/application.yml +++ b/spzx-manager/target/classes/application.yml @@ -14,6 +14,7 @@ spring: url: jdbc:mysql://${bunny.datasource.host}:${bunny.datasource.port}/${bunny.datasource.sqlData}?serverTimezone=GMT%2B8&useSSL=false&characterEncoding=utf-8&allowPublicKeyRetrieval=true username: ${bunny.datasource.username} password: "${bunny.datasource.password}" + data: redis: host: ${bunny.redis.host} @@ -28,12 +29,11 @@ logging: pattern: dateformat: HH:mm:ss:SSS file: - path: " logs/${spring.application.name}" + path: "logs/${spring.application.name}" mybatis: type-aliases-package: com.atguigu.spzx.model mapper-locations: classpath:mapper/*.xml - # config-location: classpath:mybatis-config.xml configuration: log-impl: org.apache.ibatis.logging.stdout.StdOutImpl map-underscore-to-camel-case: true diff --git a/spzx-manager/target/classes/com/atguigu/spzx/manger/MangerApplication.class b/spzx-manager/target/classes/com/atguigu/spzx/manger/MangerApplication.class index 9ecda2a..a79aa7a 100644 Binary files a/spzx-manager/target/classes/com/atguigu/spzx/manger/MangerApplication.class and b/spzx-manager/target/classes/com/atguigu/spzx/manger/MangerApplication.class differ diff --git a/spzx-manager/target/classes/com/atguigu/spzx/manger/service/impl/SysUserServiceImpl.class b/spzx-manager/target/classes/com/atguigu/spzx/manger/service/impl/SysUserServiceImpl.class index dcccba8..545b772 100644 Binary files a/spzx-manager/target/classes/com/atguigu/spzx/manger/service/impl/SysUserServiceImpl.class and b/spzx-manager/target/classes/com/atguigu/spzx/manger/service/impl/SysUserServiceImpl.class differ diff --git a/spzx-manager/target/classes/logback-spring.xml b/spzx-manager/target/classes/logback-spring.xml index eb59d34..acce308 100644 --- a/spzx-manager/target/classes/logback-spring.xml +++ b/spzx-manager/target/classes/logback-spring.xml @@ -4,7 +4,7 @@ logback - + @@ -12,13 +12,14 @@ - + - + - + @@ -45,11 +46,11 @@ - + - - + + diff --git a/spzx-model/src/main/java/com/atguigu/spzx/model/entity/base/BaseEntity.java b/spzx-model/src/main/java/com/atguigu/spzx/model/entity/base/BaseEntity.java index 74d2286..0504088 100644 --- a/spzx-model/src/main/java/com/atguigu/spzx/model/entity/base/BaseEntity.java +++ b/spzx-model/src/main/java/com/atguigu/spzx/model/entity/base/BaseEntity.java @@ -1,5 +1,6 @@ package com.atguigu.spzx.model.entity.base; +import com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; @@ -8,15 +9,14 @@ import java.util.Date; @Data public class BaseEntity implements Serializable { - @Schema(description = "唯一标识") private Long id; - // @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") @Schema(description = "创建时间") private Date createTime; - // @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") @Schema(description = "修改时间") private Date updateTime; diff --git a/spzx-model/target/classes/com/atguigu/spzx/model/entity/base/BaseEntity.class b/spzx-model/target/classes/com/atguigu/spzx/model/entity/base/BaseEntity.class index 23bdb8c..5963d82 100644 Binary files a/spzx-model/target/classes/com/atguigu/spzx/model/entity/base/BaseEntity.class and b/spzx-model/target/classes/com/atguigu/spzx/model/entity/base/BaseEntity.class differ