package com.ruoyi.common.core.domain;

import lombok.Data;

/**
 * 业务校验结果
 * @author qzz
 * 2024/4/16
 */
@Data
public class ValidateResult {

    private int code;
    private String msg;

    public boolean isSuccess() {
        return this.code == 200;
    }

    public boolean isError() {
        return !isSuccess();
    }

    private ValidateResult(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public static ValidateResult success() {
        return new ValidateResult(200, "success");
    }

    public static ValidateResult error(String msg) {
        return new ValidateResult(500, msg);
    }

    public static ValidateResult error(int code, String msg) {
        return new ValidateResult(code, msg);
    }

}
