From 34981c30a78e8bbd7791131059a9210f9928b62c Mon Sep 17 00:00:00 2001
From: 刘光辉 <347230014@qq.com>
Date: 星期四, 17 九月 2026 09:24:09 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master' into master
---
jnpf-lims/jnpf-lims-biz/src/main/java/jnpf/util/R.java | 98 +++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 98 insertions(+), 0 deletions(-)
diff --git a/jnpf-lims/jnpf-lims-biz/src/main/java/jnpf/util/R.java b/jnpf-lims/jnpf-lims-biz/src/main/java/jnpf/util/R.java
new file mode 100644
index 0000000..ff33d4f
--- /dev/null
+++ b/jnpf-lims/jnpf-lims-biz/src/main/java/jnpf/util/R.java
@@ -0,0 +1,98 @@
+package jnpf.util;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * 閫氱敤杩斿洖缁撴灉绫�
+ */
+@Data
+public class R<T> implements Serializable {
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * 鐘舵�佺爜
+ */
+ private int code;
+
+ /**
+ * 娑堟伅
+ */
+ private String msg;
+
+ /**
+ * 鏁版嵁
+ */
+ private T data;
+
+ /**
+ * 鎴愬姛
+ */
+ private boolean success;
+
+ /**
+ * 鏋勯�犳柟娉�
+ */
+ private R() {
+ }
+
+ /**
+ * 鏋勯�犳柟娉�
+ */
+ private R(int code, String msg, T data, boolean success) {
+ this.code = code;
+ this.msg = msg;
+ this.data = data;
+ this.success = success;
+ }
+
+ /**
+ * 鎴愬姛杩斿洖
+ */
+ public static <T> R<T> success() {
+ return new R<>(200, "鎿嶄綔鎴愬姛", null, true);
+ }
+
+ /**
+ * 鎴愬姛杩斿洖甯︽暟鎹�
+ */
+ public static <T> R<T> success(T data) {
+ return new R<>(200, "鎿嶄綔鎴愬姛", data, true);
+ }
+
+ /**
+ * 鎴愬姛杩斿洖甯︽秷鎭拰鏁版嵁
+ */
+ public static <T> R<T> success(String msg, T data) {
+ return new R<>(200, msg, data, true);
+ }
+
+ /**
+ * 澶辫触杩斿洖
+ */
+ public static <T> R<T> error() {
+ return new R<>(500, "鎿嶄綔澶辫触", null, false);
+ }
+
+ /**
+ * 澶辫触杩斿洖甯︽秷鎭�
+ */
+ public static <T> R<T> error(String msg) {
+ return new R<>(500, msg, null, false);
+ }
+
+ /**
+ * 澶辫触杩斿洖甯︾姸鎬佺爜鍜屾秷鎭�
+ */
+ public static <T> R<T> error(int code, String msg) {
+ return new R<>(code, msg, null, false);
+ }
+
+ /**
+ * 澶辫触杩斿洖甯︾姸鎬佺爜銆佹秷鎭拰鏁版嵁
+ */
+ public static <T> R<T> error(int code, String msg, T data) {
+ return new R<>(code, msg, data, false);
+ }
+}
--
Gitblit v1.8.0