在对接前端的DTO实体类中,所有日期Date类型属性必须加上
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat注解是一个时间格式化注解,比如我们存储在mysql中的数据是date类型的,但是我们前端传递过来的是字符串String类型,因此我们需要用到JsonFormat注解来格式化我们的时间。
所以@JsonFormat注解是将前端传递的String类型的时间格式化为指定格式(例:yyyy-MM-dd HdateH:mm:ss)