Commit a841e101 authored by yanzg's avatar yanzg

接口文档的支持

parent 61769a83
package com.yanzuoguang.util.vo;
import com.yanzuoguang.util.contants.ResultConstants;
import com.yanzuoguang.util.exception.CodeException;
import com.yanzuoguang.util.helper.StringHelper;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
......@@ -38,6 +39,16 @@ public class ResponseResult<T> extends BaseVo {
@ApiModelProperty(value = "异常数据", notes = "当抛出异常时的数据,通常和code进行组合", required = true)
private Object target;
/**
* 检查数据是否合法,不合法则抛出异常
*/
public void check() {
if (StringHelper.compare(code, ResultConstants.SUCCESS)) {
return;
}
throw new CodeException(this.code, this.message, this.target);
}
/**
* 获取结果状态码
*
......
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