package com.xxl.job.executor.utils;

import java.util.Map;

/**
 * @author jeecg-boot
 * 2019年12月5日19:57:58
 */
public class ResultMapUtils {
    private static final String MAP_CODE = "code";
    private static final String MAP_MESSAGE = "message";
    private static final String MAP_SUCCESS = "success";

    public static void setResultMap(Map<String, Object> map, Integer statusCode) {
        map.put(MAP_CODE, statusCode);
        map.put(MAP_MESSAGE, StatusCode.getDesc(statusCode));
        map.put(MAP_SUCCESS, StatusCode.getFlag(statusCode));
    }

    public static void setResultMap(Map<String, Object> map, StatusCode statusCode) {
        map.put(MAP_CODE, statusCode.getCode());
        map.put(MAP_MESSAGE, statusCode.getDesc());
        map.put(MAP_SUCCESS, statusCode.getFlag());
    }

    public static void setResultMap(Map<String, Object> map, int statusCode,String message,boolean flag) {
        map.put(MAP_CODE, statusCode);
        map.put(MAP_MESSAGE, message);
        map.put(MAP_SUCCESS, flag);
    }
}
