This commit is contained in:
Redkale
2020-05-04 20:02:18 +08:00
parent 16b3dab600
commit e2fb7935f6

View File

@@ -91,16 +91,6 @@ public class RetResult<T> {
return new RetResult(Utility.ofMap(items)); return new RetResult(Utility.ofMap(items));
} }
/**
* 判断结果是否成功返回, retcode = 0 视为成功, 否则视为错误码
*
* @return 是否成功
*/
@ConvertColumn(index = 3)
public boolean isSuccess() {
return retcode == 0;
}
/** /**
* 同 setRetcode * 同 setRetcode
* *
@@ -211,23 +201,13 @@ public class RetResult<T> {
} }
/** /**
* 结果对象, 通常只有在retcode = 0时值才有效 * 判断结果是否成功返回, retcode = 0 视为成功, 否则视为错误码
* *
* @return 结果对象 * @return 是否成功
*/ */
@ConvertColumn(index = 4) @ConvertColumn(index = 3)
public T getResult() { public boolean isSuccess() {
return result; return retcode == 0;
}
/**
* 设置结果对象
*
* @param result T
*/
@ConvertColumn(index = 4)
public void setResult(T result) {
this.result = result;
} }
/** /**
@@ -235,11 +215,21 @@ public class RetResult<T> {
* *
* @return 结果附件 * @return 结果附件
*/ */
@ConvertColumn(index = 5) @ConvertColumn(index = 4)
public Map<String, String> getAttach() { public Map<String, String> getAttach() {
return attach; return attach;
} }
/**
* 设置结果附件
*
* @param attach Map
*/
@ConvertColumn(index = 4)
public void setAttach(Map<String, String> attach) {
this.attach = attach;
}
/** /**
* 获取附件元素值 * 获取附件元素值
* *
@@ -248,18 +238,28 @@ public class RetResult<T> {
* *
* @return 结果值 * @return 结果值
*/ */
@ConvertColumn(index = 5)
public String getAttach(String name, String defValue) { public String getAttach(String name, String defValue) {
return attach == null ? defValue : attach.getOrDefault(name, defValue); return attach == null ? defValue : attach.getOrDefault(name, defValue);
} }
/** /**
* 设置结果附件 * 结果对象, 通常只有在retcode = 0时值才有效
* *
* @param attach Map * @return 结果对象
*/ */
public void setAttach(Map<String, String> attach) { @ConvertColumn(index = 5)
this.attach = attach; public T getResult() {
return result;
}
/**
* 设置结果对象
*
* @param result T
*/
@ConvertColumn(index = 5)
public void setResult(T result) {
this.result = result;
} }
@Override @Override