package cn.hanghui.outapi.platform.common.utils;

import cn.hanghui.outapi.platform.common.exception.BusinessException;
import cn.hanghui.outapi.platform.common.exception.CommonException;
import cn.hutool.core.util.ObjectUtil;

/**
 * @description:
 * @ClassName ClassUtil
 * @Author WXG
 * @Date 2023/5/18 17:18
 */
public class ClassUtil {

    public static void checkData(Object o, String throwString) {
        if (ObjectUtil.isNull(o)) {
            throw new CommonException(throwString);
        }
    }

    public static void throwBusinessException(Boolean o, String throwString) {
        if (o) {
            throw new CommonException(throwString);
        }
    }

    public static void throwBusinessException(Boolean o, int code, String throwString) {
        if (o) {
            throw new BusinessException(code, throwString);
        }
    }

}
