/*
 * Copyright (c) 2023 codvision.com All Rights Reserved.
 */

package com.codvision.commoncore.utils;

import com.codvision.commoncore.common.ResponseEntity;
import org.apache.commons.lang3.ObjectUtils;

/**
 * 响应工具类
 *
 * @author lingee
 * @date 2023/7/18
 */
public class ResponseUtil {

    /**
     * 判断请求是否成功
     *
     * @param response
     * @return
     */
    public static boolean isSuccess(ResponseEntity response) {
        if (ObjectUtils.isNotEmpty(response)
                && response.getCode() == 200
                && ObjectUtils.isNotEmpty(response.getData())) {
            return true;
        }
        return false;
    }

    public static boolean isSuccessNotData(ResponseEntity response) {
        if (ObjectUtils.isNotEmpty(response)
                && response.getCode() == 200) {
            return true;
        }
        return false;
    }
}
