This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL) | |
/* | |
JsonSerialize 注解的作用就是:保证序列化 json 的时候,如果是 null 的对象,key 也会消失。 | |
部分响应对象不需要将字段全部返回前端,例如‘失败’的时候只需要返回 status 和 msg ,Data 是不需要返回的, | |
此时返回前端时,只有一个 key ,而 value 为空,所以需要进行配置,将 value 为空的字段进行忽略 | |
*/ | |
public class ServerResponse<T> implements Serializable { | |
private int status; | |
private String msg; | |
private T Data; |