yonge 5 년 전
부모
커밋
826c50f4ee
1개의 변경된 파일9개의 추가작업 그리고 9개의 파일을 삭제
  1. 9 9
      mec-common/common-core/src/main/java/com/ym/mec/common/controller/BaseController.java

+ 9 - 9
mec-common/common-core/src/main/java/com/ym/mec/common/controller/BaseController.java

@@ -15,7 +15,7 @@ import javax.servlet.http.HttpServletRequest;
 
 @ControllerAdvice
 public class BaseController {
-	
+
 	private final static Logger logger = LoggerFactory.getLogger(BaseController.class);
 
 	public static <T> HttpResponseResult<T> succeed(T object) {
@@ -30,19 +30,19 @@ public class BaseController {
 		return getResponseData(true, HttpStatus.OK, obj, "操作成功");
 	}
 
-	public static HttpResponseResult<String> warned(String message) {
+	public static <T> HttpResponseResult<T> warned(String message) {
 		return failed(HttpStatus.MULTI_STATUS, message);
 	}
 
-	public static HttpResponseResult<String> failed() {
+	public static <T> HttpResponseResult<T> failed() {
 		return failed("");
 	}
 
-	public static HttpResponseResult<String> failed(String msg) {
+	public static <T> HttpResponseResult<T> failed(String msg) {
 		return failed(HttpStatus.INTERNAL_SERVER_ERROR, msg);
 	}
 
-	public static HttpResponseResult<String> failed(HttpStatus statusCode, String msg) {
+	public static <T> HttpResponseResult<T> failed(HttpStatus statusCode, String msg) {
 		return getResponseData(false, statusCode, null, msg);
 	}
 
@@ -54,7 +54,7 @@ public class BaseController {
 		obj.setMsg(message);
 		return obj;
 	}
-	
+
 	/**
 	 * 处理一般异常
 	 * 
@@ -69,10 +69,10 @@ public class BaseController {
 			e = ex;
 		}
 		logger.error("System Error", ex);
-//		return failed(e.getMessage());
-		if(e instanceof BizException || e instanceof ThirdpartyException){
+		// return failed(e.getMessage());
+		if (e instanceof BizException || e instanceof ThirdpartyException) {
 			return failed(e.getMessage());
-		}else if(e instanceof AccessDeniedException){
+		} else if (e instanceof AccessDeniedException) {
 			return failed("禁止访问");
 		}
 		return failed("系统繁忙");