Prerequisite description: The date defined by layui is passed to the background to return the error in the title, and spring boot is used in the background.
Solution: add @DateTimeFormat (pattern = “yyyy-MM-dd hh: mm: ss”) to the entity class
The controller must add: @Valid and BindingResult BindingResult
data format passed to the background: kfRepairDate: 2018-10-22 10:55:32
Controller:
@ResponseBody
@RequestMapping(value = "/update", method = RequestMethod.POST)
public Boolean update(@Valid TKfRepair em,BindingResult BindingResult) {
return t.updateById(em);
}
front end:
var ins22 = laydate.render({
elem : '#kfRepairDate',
min : '2016-10-14',
max : '2080-10-14',
type : 'datetime'
});
Entity class:
@DateTimeFormat(pattern="yyyy-MM-dd hh:mm:ss")
@TableField(value="kf_repair_date")
private Date kfRepairDate;
Thanks https://q.cnblogs.com/q/93720/ Chen Wuwen