BaseResultModel.java 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. package com.yihu.iot.model;
  2. import io.swagger.annotations.ApiModel;
  3. import io.swagger.annotations.ApiModelProperty;
  4. /**
  5. * Created by chenweida on 2017/8/17.
  6. */
  7. @ApiModel("返回实体")
  8. public class BaseResultModel {
  9. @ApiModelProperty(value = "状态", required = false, access = "response")
  10. protected Integer status = statusEm.success.getCode();
  11. @ApiModelProperty(value = "信息", required = false, access = "response")
  12. protected String message = "成功";
  13. public Integer getStatus() {
  14. return status;
  15. }
  16. public void setStatus(Integer status) {
  17. this.status = status;
  18. }
  19. public String getMessage() {
  20. return message;
  21. }
  22. public void setMessage(String message) {
  23. this.message = message;
  24. }
  25. public enum statusEm {
  26. success(10000, "请求成功"),//请求成功
  27. error_Appid(-9000, "appid不存在"),//appid不存在
  28. error_AppSecret(-9001, "AppSecret不存在"),//AppSecret不存在
  29. token_out_effect(-9002, "无效的token"),//token无效
  30. token_no_power(-9003, "用户没权限"),// 没权限 包括未授权 或者uri错误
  31. token_out_time(-9004, "accesstoken已过期"),//token无效
  32. token_null(-9005, "accesstoken为空"),// 没权限 包括未授权 或者uri错误
  33. error_params(-10000, "请求失败 参数错误"),//请求失败 参数错误
  34. error_no_ip(-10010, "请求失败,获取IP失败"),//请求失败,获取IP失败
  35. login_system_error(-10020, "系统异常"),
  36. login_publickey_error(-10030, "获取公钥失败"),
  37. file_upload_error(-10040, "文件上传失败"),
  38. find_error(-10050, "查询失败"),
  39. opera_error(-10060, "操作失败"),
  40. no_openid(-30000,"用户openId为空无法发送"),
  41. login_account_error(-20010, "账号不存在"),
  42. login_password_error(-20020, "密码错误"),
  43. login_IMEI_error(-20030, "获取imei失败");
  44. ;
  45. statusEm(Integer code, String message) {
  46. this.code = code;
  47. this.message = message;
  48. }
  49. private Integer code;
  50. private String message;
  51. public Integer getCode() {
  52. return code;
  53. }
  54. public void setCode(Integer code) {
  55. this.code = code;
  56. }
  57. public String getMessage() {
  58. return message;
  59. }
  60. public void setMessage(String message) {
  61. this.message = message;
  62. }
  63. }
  64. public BaseResultModel() {
  65. }
  66. public BaseResultModel(String message) {
  67. this.message = message;
  68. }
  69. public BaseResultModel(Integer status, String message) {
  70. this.status = status;
  71. this.message = message;
  72. }
  73. }