|
@@ -1,5 +1,6 @@
|
|
|
package com.ruoyi.common.core.domain;
|
|
|
|
|
|
+import com.ruoyi.common.constant.HttpStatus;
|
|
|
import lombok.Data;
|
|
|
import lombok.NoArgsConstructor;
|
|
|
|
|
@@ -67,6 +68,27 @@ public class R<T> implements Serializable {
|
|
|
return restResult(null, code, msg);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 返回警告消息
|
|
|
+ *
|
|
|
+ * @param msg 返回内容
|
|
|
+ * @return 警告消息
|
|
|
+ */
|
|
|
+ public static <T> R<T> warn(String msg) {
|
|
|
+ return restResult(null, HttpStatus.WARN, msg);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 返回警告消息
|
|
|
+ *
|
|
|
+ * @param msg 返回内容
|
|
|
+ * @param data 数据对象
|
|
|
+ * @return 警告消息
|
|
|
+ */
|
|
|
+ public static <T> R<T> warn(String msg, T data) {
|
|
|
+ return restResult(data, HttpStatus.WARN, msg);
|
|
|
+ }
|
|
|
+
|
|
|
private static <T> R<T> restResult(T data, int code, String msg) {
|
|
|
R<T> r = new R<>();
|
|
|
r.setCode(code);
|