使用Layui的时间选择器 前台传递到后台的值是String类型引发的错误
ConversionFailedException
Failed to convert from type [java.lang.String] to type [@com.baomidou.mybatisplus.annotation.TableField java.util.Date] for value ''
前台
后台
controller
实体类
原因是接收参数用这个这个对象,而这个对象的这个字段是Date类型,两个类型无法匹配就出现这个错误
解决: @JsonFormat 后台返回数据到前端的数据格式 @DateTimeFormat 前台传递参数到后台的数据格式@JsonFormat(pattern = "yyyy-MM-dd") @DateTimeFormat(pattern = "yyyy-MM-dd")
@TableField("BIRTH_DATE")
@JsonFormat(pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern = "yyyy-MM-dd")
private Date birthDate;


![用layui的报Failed to convert from type [java.lang.String] 用layui的报Failed to convert from type [java.lang.String]](http://www.mshxw.com/aiimages/31/769110.png)
