这是model:
public class EChartsVO {
private String code;
private String name;
private Integer value;
public ToolTotalEChartsVO() {
}
public String getAttachCode() {
return code;
}
public void setAttachCode(String code) {
this.code = code;
}
public String getAttachName() {
return name;
}
public void setAttachName(String name) {
this.name = name;
}
public Integer getValue() {
return value;
}
public void setValue(Integer value) {
this.value = value;
}
}
返回到前台的数据如下:
{attachCode: "T00001", attachName: "测试1", value: 20}
感觉很奇怪: model的属性是code和name,为什么返回到前台是attachCode和attachName?
排查了半天,基本所有可能的方法都试过了。最后发现:跟set和get方法的名字有关系。。。。(因为某些原因,修改了属性名,懒得没修改set、get的方法名)
卧槽!!!!!!
修改之前的set、get方法名是:
public String getAttachCode() {
return code;
}
public void setAttachCode(String code) {
this.code = code;
}
public String getAttachName() {
return name;
}
public void setAttachName(String name) {
this.name = name;
}
把方法名修改成了:
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
这下返回到前台的正常了。