数据库查询的结果是数字,但在页面要求将对应的数值转为文字说明,这里就做一下记录说明:
private String state; //状态,和数据库的字段对应
private String str; //对状态进行文字说明
// 然后在get方法做以下处理:
public String getStr() {
if (this.getState().equals("1")) {
str = "成功";
}
else if (this.getState().equals("2")) {
str = " 进行中";
}
else if (this.getState().equals("3")) {
str = "失败";
}
else if (this.getState().equals("4")) {
str = "过期";
}
return str;
}
大神有更好的方法处理的,欢迎指教呀……