导读
一个模块建立一个VO类,通常市VO类有一个或者多条属性,但由于业务需要,对象属性值为null时,不返回该对象属性。
使用
在属性上添加注解 @JsonInclude(JsonInclude.Include.NON_NULL)
import com.fasterxml.jackson.annotation.JsonInclude;
import java.io.Serializable;
/**
* 返回前端VO类
* @create 2020/1/2 16:35
*/
public class OfficeVisualVO implements Serializable {
private static final long serialVersionUID = -3989544016686250349L;
/**
* ---username
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String username;
/**
* --age
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String age;
/**
* --deptName
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String deptName;
/**
* --deptNum
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String deptNum;
public String getDeptName() {
return deptName;
}
public void setDeptName(String deptName) {
this.deptName = deptName;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getAge() {
return age;
}
public void setAge(String age) {
this.age = age;
}
public String getDeptNum() {
return deptNum;
}
public void setDeptNum(String deptNum) {
this.deptNum = deptNum;
}
}