方法一:在类字段上加注解import com.fasterxml.jackson.annotation.JsonInclude;@JsonInclude(JsonInclude.Include.
@JsonInclude(JsonInclude.Include.