修改id自增问题 显示问题 分页问题
This commit is contained in:
@@ -1,25 +0,0 @@
|
||||
package com.ruoyi.common.config;
|
||||
|
||||
import com.fasterxml.jackson.databind.DeserializationFeature;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.module.SimpleModule;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Configuration
|
||||
public class JacksonConfig {
|
||||
@Bean
|
||||
public ObjectMapper jacksonObjectMapper() {
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
// 将 Long 类型序列化为 String
|
||||
SimpleModule module = new SimpleModule();
|
||||
module.addSerializer(Long.class, new ToStringSerializer());
|
||||
module.addSerializer(long.class, new ToStringSerializer());
|
||||
mapper.registerModule(module);
|
||||
|
||||
// 忽略实体中没有的字段(不抛出异常)
|
||||
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
|
||||
return mapper;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user