Unverified Commit cb68b22b by bianxin Committed by GitHub

Update README.md

parent 4fd0c971
...@@ -410,8 +410,10 @@ public class UserController { ...@@ -410,8 +410,10 @@ public class UserController {
import java.io.Serializable; import java.io.Serializable;
import java.net.ConnectException; import java.net.ConnectException;
import java.sql.SQLException; import java.sql.SQLException;
import org.slf4j.Logger; import lombok.Data;
import org.slf4j.LoggerFactory; import lombok.extern.slf4j.Slf4j;
/** /**
* Copyright: Copyright (c) 2019 * Copyright: Copyright (c) 2019
* *
...@@ -424,9 +426,10 @@ import org.slf4j.LoggerFactory; ...@@ -424,9 +426,10 @@ import org.slf4j.LoggerFactory;
*---------------------------------------------------------* *---------------------------------------------------------*
* 2019/4/9 flying-cattle V1.0 initialize * 2019/4/9 flying-cattle V1.0 initialize
*/ */
@Slf4j
@Data
public class JsonResult<T> implements Serializable{ public class JsonResult<T> implements Serializable{
Logger logger = LoggerFactory.getLogger(this.getClass());
private static final long serialVersionUID = 1071681926787951549L; private static final long serialVersionUID = 1071681926787951549L;
/** /**
...@@ -449,36 +452,7 @@ public class JsonResult<T> implements Serializable{ ...@@ -449,36 +452,7 @@ public class JsonResult<T> implements Serializable{
* <p>返回数据</p> * <p>返回数据</p>
*/ */
private T data; private T data;
public Boolean getTrue() {
return isTrue;
}
public void setTrue(Boolean aTrue) {
isTrue = aTrue;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public T getData() {
return data;
}
public void setData(T data) {
this.data = data;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
/** /**
* <p>返回成功</p> * <p>返回成功</p>
* @param type 业务码 * @param type 业务码
...@@ -497,7 +471,7 @@ public class JsonResult<T> implements Serializable{ ...@@ -497,7 +471,7 @@ public class JsonResult<T> implements Serializable{
this.code ="0000"; this.code ="0000";
} }
public JsonResult(Throwable throwable) { public JsonResult(Throwable throwable) {
logger.error(throwable+"tt"); log.error(throwable+"tt");
this.isTrue=false; this.isTrue=false;
if(throwable instanceof NullPointerException){ if(throwable instanceof NullPointerException){
this.code= "1001"; this.code= "1001";
...@@ -530,7 +504,7 @@ public class JsonResult<T> implements Serializable{ ...@@ -530,7 +504,7 @@ public class JsonResult<T> implements Serializable{
this.code= "1010"; this.code= "1010";
this.message="运行时异常:"+throwable; this.message="运行时异常:"+throwable;
}else if(throwable instanceof Exception){ }else if(throwable instanceof Exception){
logger.error("未知异常:"+throwable); log.error("未知异常:"+throwable);
this.code= "9999"; this.code= "9999";
this.message="未知异常"+throwable; this.message="未知异常"+throwable;
} }
......
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