diff --git a/blade-core-tool/src/main/java/org/springblade/core/tool/api/R.java b/blade-core-tool/src/main/java/org/springblade/core/tool/api/R.java index 0f04315..6a9e513 100644 --- a/blade-core-tool/src/main/java/org/springblade/core/tool/api/R.java +++ b/blade-core-tool/src/main/java/org/springblade/core/tool/api/R.java @@ -130,6 +130,16 @@ public class R implements Serializable { return new R<>(code, data, data == null ? BladeConstant.DEFAULT_NULL_MESSAGE : msg); } + /** + * 返回成功 + * + * @param 泛型标记 + * @return Result + */ + public static R success() { + return new R<>(ResultCode.SUCCESS); + } + /** * 返回R * @@ -222,4 +232,16 @@ public class R implements Serializable { return flag ? success(BladeConstant.DEFAULT_SUCCESS_MESSAGE) : fail(BladeConstant.DEFAULT_FAILURE_MESSAGE); } + /** + * 根据状态返回成功或者失败 + * + * @param status 状态 + * @param msg 异常msg + * @param 泛型标记 + * @return Result + */ + public static R status(boolean status, String msg) { + return status ? R.success() : R.fail(msg); + } + }