This commit is contained in:
@@ -8,7 +8,7 @@ package com.wentch.redkale.service;
|
|||||||
import com.wentch.redkale.convert.json.*;
|
import com.wentch.redkale.convert.json.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通用的结果对象
|
* 通用的结果对象,在常见的HTTP+JSON接口中返回的结果需要含结果码,错误信息,和实体对象。
|
||||||
*
|
*
|
||||||
* @author zhangjx
|
* @author zhangjx
|
||||||
* @param <T>
|
* @param <T>
|
||||||
@@ -63,10 +63,20 @@ public class RetResult<T> {
|
|||||||
this.result = result;
|
this.result = result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 判断结果是否成功返回, retcode = 0 视为成功, 否则视为错误码
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
public boolean isSuccess() {
|
public boolean isSuccess() {
|
||||||
return retcode == 0;
|
return retcode == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 结果码 0表示成功、 非0表示错误
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
public int getRetcode() {
|
public int getRetcode() {
|
||||||
return retcode;
|
return retcode;
|
||||||
}
|
}
|
||||||
@@ -83,6 +93,11 @@ public class RetResult<T> {
|
|||||||
this.retinfo = retinfo;
|
this.retinfo = retinfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 结果对象, 通常只有在retcode = 0时值才有效
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
public T getResult() {
|
public T getResult() {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user