Home > Back-end >  Springboot return fixed columns of data
Springboot return fixed columns of data

Time:01-15

Suppose that there are now a user list, including id, name, PWD, four field area, there are two interfaces:

- user list
- the user details

1. In the user list, only show ` id `, ` name `, ` area ` three fields;
2. In details, and show all fields,

Environment: springboot project,

Now I configuration ` spring. Jackson. Default - property - the inclusion=NON_NULL `,

P1: in the list interface, once ` area ` field is empty, return to the field is uneven, some returned two fields, some return to the three fields, could you tell me how to solve this problem?

P2: in details in the interface, also can appear such problem, when ` area for ` ` null `, details returned three fields; Otherwise returns four fields,

-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

Q: can you tell me how to make the interface returns the fixed field, for example, a list of interface, the fixed return three fields, even ` area ` is empty, also want to keep the field, by the same token, the details in the interface, a fixed return four fields, even have fields blank to keep the field,

# # # problem of environmental background and own tried which methods


I try to change configuration ` spring. Jackson. Default - property - the inclusion `,
Changed a lot but they did not meet my requirements,

The desired result is a list of returned parts field, regardless of whether the null keep field, so is details

  • Related