Commit cb371819 by guojuxing

如果为空判断

parent 3519770d
...@@ -7,6 +7,8 @@ import com.gic.api.base.commons.ServiceResponse; ...@@ -7,6 +7,8 @@ import com.gic.api.base.commons.ServiceResponse;
import com.gic.commons.util.EntityUtil; import com.gic.commons.util.EntityUtil;
import com.gic.commons.webapi.reponse.RestResponse; import com.gic.commons.webapi.reponse.RestResponse;
import com.gic.enterprise.exception.CommonException; import com.gic.enterprise.exception.CommonException;
import org.apache.commons.collections.CollectionUtils;
/** /**
* controller统一返回结果 * controller统一返回结果
* @ClassName: ResultControllerUtils
 * @ClassName: ResultControllerUtils

...@@ -112,7 +114,12 @@ public class ResultControllerUtils { ...@@ -112,7 +114,12 @@ public class ResultControllerUtils {

 */ 
 */
public static RestResponse commonResult(ServiceResponse response, Class<?> clazz) { public static RestResponse commonResult(ServiceResponse response, Class<?> clazz) {
if (response.isSuccess()) { if (response.isSuccess()) {
return RestResponse.success(EntityUtil.changeEntityListNew(clazz, (List<?>) response.getResult())); if (CollectionUtils.isNotEmpty((List<?>) response.getResult())) {
return RestResponse.success(EntityUtil.changeEntityListNew(clazz, (List<?>) response.getResult()));
} else {
return RestResponse.success();
}
} else { } else {
return RestResponse.failure(response.getCode(), response.getMessage()); return RestResponse.failure(response.getCode(), response.getMessage());
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment