RetResult增加Map<String, String> attach成员变量
This commit is contained in:
@@ -5,6 +5,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.redkale.service;
|
package org.redkale.service;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
import org.redkale.convert.json.*;
|
import org.redkale.convert.json.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -28,6 +29,8 @@ public class RetResult<T> {
|
|||||||
|
|
||||||
protected T result;
|
protected T result;
|
||||||
|
|
||||||
|
protected Map<String, String> attach;
|
||||||
|
|
||||||
public RetResult() {
|
public RetResult() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -99,6 +102,32 @@ public class RetResult<T> {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 同 setAttach
|
||||||
|
*
|
||||||
|
* @param attach attach
|
||||||
|
*
|
||||||
|
* @return RetResult
|
||||||
|
*/
|
||||||
|
public RetResult<T> attach(Map<String, String> attach) {
|
||||||
|
this.attach = attach;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* attach添加元素
|
||||||
|
*
|
||||||
|
* @param key String
|
||||||
|
* @param value String
|
||||||
|
*
|
||||||
|
* @return RetResult
|
||||||
|
*/
|
||||||
|
public RetResult<T> attach(String key, Object value) {
|
||||||
|
if (this.attach == null) this.attach = new HashMap<>();
|
||||||
|
this.attach.put(key, value == null ? null : String.valueOf(value));
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 结果码 0表示成功、 非0表示错误
|
* 结果码 0表示成功、 非0表示错误
|
||||||
*
|
*
|
||||||
@@ -148,6 +177,24 @@ public class RetResult<T> {
|
|||||||
this.result = result;
|
this.result = result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 结果附件
|
||||||
|
*
|
||||||
|
* @return 结果附件
|
||||||
|
*/
|
||||||
|
public Map<String, String> getAttach() {
|
||||||
|
return attach;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置结果附件
|
||||||
|
*
|
||||||
|
* @param attach Map
|
||||||
|
*/
|
||||||
|
public void setAttach(Map<String, String> attach) {
|
||||||
|
this.attach = attach;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return JsonConvert.root().convertTo(this);
|
return JsonConvert.root().convertTo(this);
|
||||||
|
|||||||
Reference in New Issue
Block a user