@JsonFormat(shape = JsonFormat.Shape.STRING)

An unexpected error was logged: the Long type primary key passed from the front end back to the back end lost precision.

This is the id
Insert picture description here
view entity class of the database.
Insert picture description here
Start the project directly, click to modify and call the getById method.
Insert picture description here
At first, I wondered why this field is undefined.
Insert picture description here
I will break the breakpoint and
Insert picture description here
take the value returned by the front end to the database and check it. Why can't find the data
Insert picture description here
Insert picture description here

A closer look at the accuracy is suspected to be lost, so I understand the reason here. Add @JsonFormat(shape = JsonFormat.Shape.STRING) to the Vo entity class and start it again, and it will be no problem. The full value is obtained.

@JsonFormat is used to represent a format or type of json serialization, and shap represents a type after serialization

I 'm just wondering how to report "xxxCode" of undefined every time I get multiple views Vo

Stepped on the pit for the second time! Take this to record! So as not to go for the third time.

Guess you like

Origin blog.csdn.net/weixin_46099269/article/details/109350266