OAuthResult.java 1.48 KB
package com.zteits.oa.report.vo;

import com.zteits.oa.api.base.constants.ErrorType;
import com.zteits.oa.api.dto.asraop.LoginOathRes;

/**
 * Copyright: Copyright (c) 2017  zteits
 *
 * @ClassName: com.zteits.oauth.portal.vo
 * @Description:
 * @version: v1.0.0
 * @author: atao
 * @date: 2017/5/9   下午3:39
 * Modification History:
 * Date         Author          Version      Description
 * ---------------------------------------------------------*
 * 2017/5/9      atao          v1.0.0          创建
 */
public class OAuthResult<T extends LoginOathRes> {

    private String code;
    private String errMsg;
    private T data;

    public OAuthResult(boolean success) {
        if (success) {
            this.code = ErrorType.BIZ_SUCCESS.getCode();
            this.errMsg = ErrorType.BIZ_SUCCESS.getMsg();
        }

    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {

        this.code = code;
    }

    public String getErrMsg() {
        return errMsg;
    }

    public void setErrMsg(String errMsg) {
        this.errMsg = errMsg;
    }

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }

    public void setErrorType(ErrorType errorType) {
        this.code = errorType.getCode();
        this.errMsg = errorType.getMsg();
    }

    public void setErrorType(ErrorType errorType, String errMsg) {
        this.code = errorType.getCode();
        this.errMsg = errMsg;
    }

}