@JsonFormat(shape = JsonFormat.Shape.STRING
记录个意外的错误:Long类型主键从前端传回后端丢失精度。
这是数据库的id
视图实体类
直接启动项目,点击修改调用getById方法
一开始非常纳闷怎么会说我这个字段未定义呢
烦躁一会打起断点
拿着前端传回的值去数据库一查看呆了怎么查不到数据
定睛一看精度疑似丢失了,到这里就明白缘由了,给Vo实体类加上@JsonFormat(shape = JsonFormat.Shape.STRING)然后再启动就没问题了,取到了全值。
@JsonFormat 用来表示json序列化的一种格式或者类型,shap表示序列化后的一种类型
就说纳闷了怎么每次弄多个视图Vo都要报’xxxCode’ of undefined"
第二次踩坑了!以此记录一下!免得走上第三次。