JAVA 自定义状态码
返回信息类(ResponseInfo):
1 public class ResponseInfo { 2 3 public static final String Status = "status"; 4 public static final String Info = "info"; 5 6 private String status; 7 private String info; 8 9 public String getStatus() { 10 return status; 11 } 12 public void setStatus(String status) { 13 14 this.status = status; 15 } 16 public String getInfo() { 17 return info; 18 } 19 public void setInfo(String info) { 20 this.info = info; 21 } 22 }
状态类(Status):
1 public class Status { 2 public static final String RESPONSE_OK = "success"; 3 public static final String RESPONSE_ERR = "failed"; 4 }
提示信息类(Info):
1 public class Info { 2 3 public static final String PARAMS_ERR = "参数异常"; 4 public static final String SERVER_ERR = "服务器端错误"; 5 public static final String DATABASE_ERR = "数据库错误"; 6 public static final String UNKNOWN_ERR = "未知错误"; 7 public static final String NODATA = "无数据"; 8 9 public static final String DATAEXISTS = "记录已存在"; 10 public static final String DELETEERR = "删除失败"; 11 public static final String UPDATEERR = "修改失败"; 12 13 public static final String NOTLOGIN = "未登录"; 14 public static final String LOGIN = "已登录"; 15 public static final String REGISTER = "注册成功"; 16 17 public static final String NORIGHT = "未通过审核"; 18 public static final String RIGHT = "已通过审核"; 19 public static final String NOEXAMINE = "仍未审核"; 20 }