package com.ruoyi.web.modules.goods.support;

import java.util.HashMap;
import java.util.Map;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.web.modules.goods.exception.GoodsBatchOperationException;

/**
 * 商品批量操作错误响应
 */
public final class GoodsBatchResponseSupport
{
    private GoodsBatchResponseSupport()
    {
    }

    public static AjaxResult toAjaxResult(GoodsBatchOperationException e)
    {
        Map<String, Object> data = new HashMap<>();
        data.put("reasons", e.getReasons());
        AjaxResult result = AjaxResult.error(e.getMessage());
        result.put(AjaxResult.DATA_TAG, data);
        return result;
    }
}
