sword前端菜单列表出错,页面加载出错,精度缺失,最后两位为0

Sword 未结 3 6051
好人
好人 剑者 2019-07-02 19:48

image.png



image.png

3条回答
  • 2019-07-03 09:05

    number类型js精度丢失,后端把long类型的字段转成字符串

    image.png

    5 讨论(0)
  • 2020-06-08 14:13

    @JsonSerialize(using = ToStringSerializer.class)

    无法解决所有问题

    需要

    PlanckConfiguration {
       ()
       Jackson2ObjectMapperBuilderCustomizer () {
          Jackson2ObjectMapperBuilderCustomizer customizer = Jackson2ObjectMapperBuilderCustomizer() {
             (Jackson2ObjectMapperBuilder jacksonObjectMapperBuilder) {
                jacksonObjectMapperBuilder.serializerByType(Long.ToStringSerializer.)
                   .serializerByType(Long.ToStringSerializer.)}
          }customizer}
    }

    支持对所有含Long型数据进行全局过滤, 包括HashMap<xx, Long>, LinkedList<Long> ...

    3 讨论(1)
  • 2023-09-19 11:30

    public ObjectMapper objectMapper(Jackson2ObjectMapperBuilder builder) {
       // 自定义大数字序列化
       builder.serializerByType(Long.TYPE, ToStringSerializer.instance);
       builder.serializerByType(Long.class, ToStringSerializer.instance);
       builder.serializerByType(BigInteger.class, ToStringSerializer.instance);
       builder.serializerByType(BigDecimal.class, ToStringSerializer.instance);


    0 讨论(0)
提交回复