java 注解Long转String、LocalDateTime转String 指定时间格式

1、LocalDateTime转String (选其一注解)

@JsonFormat(shape=JsonFormat.Shape.STRING, pattern="yyyy-MM-dd")
@DateTimeFormat(pattern = "yyyy-MM-dd")
private LocalDateTime startTime;

2、Long转String

@JsonSerialize(using = ToStringSerializer.class)
private Long id;

3、BigDecimal 转String

@JsonFormat(shape = JsonFormat.Shape.STRING)

private BigDecimal applyPrice;

猜你喜欢

转载自blog.csdn.net/qq_33767353/article/details/127978332
今日推荐