forked from fanruan/finekit
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
64 lines
1.4 KiB
64 lines
1.4 KiB
package com.fanruan.api.web; |
|
|
|
import com.fr.decision.webservice.Response; |
|
|
|
/** |
|
* @author richie |
|
* @version 10.0 |
|
* Created by richie on 2019-09-19 |
|
* 响应工具类 |
|
*/ |
|
public class ResponseKit { |
|
|
|
/** |
|
* 成功的响应,关注结果 |
|
* |
|
* @param obj 响应结果 |
|
* @return 响应 |
|
*/ |
|
public static Object ok(Object obj) { |
|
return Response.ok(obj); |
|
} |
|
|
|
/** |
|
* 成功的响应,不关注结果 |
|
* |
|
* @return 响应 |
|
*/ |
|
public static Object success() { |
|
return Response.success(); |
|
} |
|
|
|
/** |
|
* 成功的响应,关注操作成功条目数 |
|
* |
|
* @param successNum 操作成功的条目数 |
|
* @return 响应 |
|
*/ |
|
public static Object success(int successNum) { |
|
return Response.success(successNum); |
|
} |
|
|
|
/** |
|
* 失败的响应 |
|
* |
|
* @param errorCode 错误码 |
|
* @param errorMsg 错误信息 |
|
* @return 响应 |
|
*/ |
|
public static Object error(String errorCode, String errorMsg) { |
|
return Response.error(errorCode, errorMsg); |
|
} |
|
|
|
/** |
|
* 失败的响应 |
|
* |
|
* @param status 状态码 |
|
* @param errorCode 错误码 |
|
* @param errorMsg 错误信息 |
|
* @return 响应 |
|
*/ |
|
public static Object error(int status, String errorCode, String errorMsg) { |
|
return Response.error(status, errorCode, errorMsg); |
|
} |
|
}
|
|
|