From 7ef4892f9f24f941aca37e6b3991b808a0aca619 Mon Sep 17 00:00:00 2001 From: zhanghua <314079846@qq.com> Date: 星期五, 08 九月 2023 11:16:35 +0800 Subject: [PATCH] 优化 --- ycl-common/src/main/java/com/ycl/api/CommonResult.java | 15 +++++++++++++++ 1 files changed, 15 insertions(+), 0 deletions(-) diff --git a/ycl-common/src/main/java/com/ycl/api/CommonResult.java b/ycl-common/src/main/java/com/ycl/api/CommonResult.java index 793afa4..6e210ec 100644 --- a/ycl-common/src/main/java/com/ycl/api/CommonResult.java +++ b/ycl-common/src/main/java/com/ycl/api/CommonResult.java @@ -13,11 +13,17 @@ protected CommonResult() { } + public CommonResult(long code, String message) { + this.code = code; + this.message = message; + } + protected CommonResult(long code, String message, T data) { this.code = code; this.message = message; this.data = data; } + /** * 鎴愬姛杩斿洖缁撴灉 @@ -29,6 +35,15 @@ } /** + * @Description api鑾峰彇鎴愬姛 + * @Param [data] + * @return com.ycl.api.CommonResult<T> + **/ + public static <T> CommonResult<T> successApi(T data) { + return new CommonResult<T>(ResultCode.API_SUCCESS.getCode(), ResultCode.API_SUCCESS.getMessage(), data); + } + + /** * 鎴愬姛杩斿洖缁撴灉 * * @param data 鑾峰彇鐨勬暟鎹� -- Gitblit v1.8.0