All Downloads are FREE. Search and download functionalities are using the official Maven repository.

titan.lightbatis.common.BaseController Maven / Gradle / Ivy

There is a newer version: 1.2.0
Show newest version
package titan.lightbatis.common;

public class BaseController {

    protected  CommonResult success(T data) {
        return CommonResult.success(data);
    }
    protected  CommonResult success(T data, String message) {
        return CommonResult.success(data, message);
    }


    /**
     * 失败返回结果
     * @param errorCode 错误码
     */
    protected  CommonResult failed(IErrorCode errorCode) {
        return new CommonResult(errorCode.getCode(), errorCode.getMessage(), null);
    }

    /**
     * 失败返回结果
     * @param errorCode 错误码
     * @param message 错误信息
     */
    protected  CommonResult failed(IErrorCode errorCode, String message) {
        return new CommonResult(errorCode.getCode(), message, null);
    }

    /**
     * 失败返回结果
     * @param message 提示信息
     */
    protected  CommonResult failed(String message) {
        return new CommonResult(ResultCode.FAILED.getCode(), message, null);
    }

    /**
     * 失败返回结果
     */
    protected  CommonResult failed() {
        return failed(ResultCode.FAILED);
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy