From ade1c182689c1124629b5d28092502d09c0d9010 Mon Sep 17 00:00:00 2001 From: "hengming.lhm" Date: Thu, 21 Dec 2017 13:49:45 +0800 Subject: [PATCH] update > for close #40 --- src/main/java/com/company/project/core/Result.java | 7 +------ src/main/java/com/company/project/core/ResultCode.java | 6 +++++- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/company/project/core/Result.java b/src/main/java/com/company/project/core/Result.java index 02714eb..a8b9ada 100644 --- a/src/main/java/com/company/project/core/Result.java +++ b/src/main/java/com/company/project/core/Result.java @@ -11,7 +11,7 @@ public class Result { private Object data; public Result setCode(ResultCode resultCode) { - this.code = resultCode.code; + this.code = resultCode.code(); return this; } @@ -19,11 +19,6 @@ public class Result { return code; } - public Result setCode(int code) { - this.code = code; - return this; - } - public String getMessage() { return message; } diff --git a/src/main/java/com/company/project/core/ResultCode.java b/src/main/java/com/company/project/core/ResultCode.java index 16e2e0d..7768df9 100644 --- a/src/main/java/com/company/project/core/ResultCode.java +++ b/src/main/java/com/company/project/core/ResultCode.java @@ -10,9 +10,13 @@ public enum ResultCode { NOT_FOUND(404),//接口不存在 INTERNAL_SERVER_ERROR(500);//服务器内部错误 - public int code; + private final int code; ResultCode(int code) { this.code = code; } + + public int code() { + return code; + } }