The front end sends a request, but the back end receives an empty parameter

The front end sends a request, but the back end receives an empty parameter

1. Wrong time format

2. It may be due to keywords, such as pId, the background receiving parameter is an object, there is a field pId in the object, the pId is passed from the front desk, and the background is always empty

3. The entity class is related to the parameters passed by the front end. If the entity class is inherited, the parameters passed by the front end encapsulate the object into the object, which will cause the back end to receive empty

Now use the code to explain the third case:
1. The following is the case where the reception is empty. I put the passed object in the custom param. The
insert image description here
saveWorkList interface is post request.
insert image description here
I can see in the console that I have sent the request and successfully passed the parameters

Back- insert image description here
end The back-end breakpoint debugging found that all the received parameters are empty.
insert image description here
The reason is that the parameters passed by my front-end are object wrapping objects, and the back-end is only a layer of objects because it inherits the entity class. Therefore, the parameters received by the back-end are all empty.
insert image description here
Now that the problem is known, the solution is easy
1. Modify the front end, pass workList directly, and change the parameter passed by editWorkList/saveWorkList to this.workList
insert image description here

2. Modify the back-end entity class, instead of inheriting, define WorkList as an attribute
insert image description here

Guess you like

Origin blog.csdn.net/qq_45158026/article/details/126998350