tsurumure il y a 2 mois
Parent
commit
be77516838

+ 0 - 38
src/main/java/com/backendsys/config/Mybatis/JacksonConfig.java

@@ -1,38 +0,0 @@
-//package com.backendsys.config.Mybatis;
-//
-//import com.fasterxml.jackson.databind.ObjectMapper;
-//import com.fasterxml.jackson.databind.SerializationFeature;
-//import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
-//import org.springframework.beans.factory.annotation.Autowired;
-//import org.springframework.context.annotation.Configuration;
-//import org.springframework.http.converter.HttpMessageConverter;
-//import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
-//import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
-//
-//import javax.annotation.PostConstruct;
-//import java.util.List;
-//
-//@Configuration
-//public class JacksonConfig implements WebMvcConfigurer {
-//
-//    @Autowired
-//    private ObjectMapper objectMapper;
-//
-//    @PostConstruct
-//    public void init() {
-//        // 强制注册 JavaTimeModule
-//        objectMapper.registerModule(new JavaTimeModule());
-//        // 禁用时间戳格式
-//        objectMapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
-//
-//        System.out.println("强制注册后的模块: " + objectMapper.getRegisteredModuleIds());
-//    }
-//
-//    @Override
-//    public void configureMessageConverters(List<HttpMessageConverter<?>> converters) {
-//        // 确保使用配置后的 ObjectMapper
-//        converters.stream()
-//                .filter(converter -> converter instanceof MappingJackson2HttpMessageConverter)
-//                .forEach(converter -> ((MappingJackson2HttpMessageConverter) converter).setObjectMapper(objectMapper));
-//    }
-//}

+ 0 - 23
src/main/java/com/backendsys/config/Mybatis/MyBatisConfig.java

@@ -1,23 +0,0 @@
-//package com.backendsys.config.Mybatis;
-//
-//import com.backendsys.config.Mybatis.handler.timezone.LocalDateTimeHandler;
-//import com.baomidou.mybatisplus.autoconfigure.ConfigurationCustomizer;
-//import org.springframework.context.annotation.Bean;
-//import org.springframework.context.annotation.Configuration;
-//
-//import java.time.LocalDateTime;
-//
-//@Configuration
-//public class MyBatisConfig {
-//
-//    /**
-//     * 全部设置时区时间
-//     * @return
-//     */
-//    @Bean
-//    public ConfigurationCustomizer configurationCustomizer() {
-//        return configuration -> {
-//            configuration.getTypeHandlerRegistry().register(LocalDateTime.class, new LocalDateTimeHandler());
-//        };
-//    }
-//}

+ 0 - 1
src/main/java/com/backendsys/modules/cms/article/entity/Article.java

@@ -57,7 +57,6 @@ public class Article {
     private Integer status;
     private Integer is_top;
 
-
     private String create_time;
     private String update_time;
 

+ 1 - 4
src/main/java/com/backendsys/modules/common/interceptor/TimezoneInterceptor.java

@@ -1,6 +1,6 @@
 package com.backendsys.modules.common.interceptor;
+
 import com.backendsys.config.Mybatis.handler.timezone.TimezoneContextHolder;
-import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Component;
 import org.springframework.web.servlet.HandlerInterceptor;
@@ -15,9 +15,6 @@ public class TimezoneInterceptor implements HandlerInterceptor {
     @Value("${DEFAULT_TIME_ZONE}")
     private String DEFAULT_TIME_ZONE;
 
-    /**
-     * 如果没有传递 timezone,则默认使用 (默认时区)
-     */
     @Override
     public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) {
         String timezone = request.getHeader("timezone");