ResultCode.java 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. package com.example.onlinejudge.model.entity.result;
  2. public enum ResultCode {
  3. /* 成功状态码 */
  4. SUCCESS(1, "成功"),
  5. /* 参数错误 */
  6. PARAM_IS_INVALID(1001, "参数无效"),
  7. PARAM_IS_BLANK(1002, "参数为空"),
  8. PARAM_TYPE_BIND_ERROR(1003, "参数类型错误"),
  9. PARAM_NOT_COMPLETE(1004, "参数缺失"),
  10. /* 用户错误 2001-2999*/
  11. USER_NOTLOGGED_IN(2001, "用户未登录"),
  12. USER_LOGIN_ERROR(2002, "账号不存在或密码错误"),
  13. USER_HAS_EXISTED(2003, "用户已存在"),
  14. USER_NOT_EXIST(2004, "用户不存在"),
  15. PERMISSION_DENIED(2005,"用户权限不够"),
  16. /* 数据库异常 3001-3999*/
  17. DATABASE_ERROR(3001, "数据库异常"),
  18. DATABASE_DUPLICATE_INSERT(3002,"重复插入"),
  19. NOT_FOUND_ERROR(3003,"请求的参数不存在"),
  20. /* 系统错误 10001-19999 */
  21. SYSTEM_ERROR(10000, "系统异常,请稍后重试")
  22. ;
  23. private final Integer code;
  24. private final String message;
  25. private ResultCode(Integer code, String message) {
  26. this.code = code;
  27. this.message = message;
  28. }
  29. public Integer getCode() {
  30. return this.code;
  31. }
  32. public String getMessage() {
  33. return this.message;
  34. }
  35. }