package com.pannk.demo.controller;

import lombok.Data;

import java.util.HashMap;

/**
 * Created by wolf on 20-11-9.
 */
@Data
public class Result extends HashMap<String, Object> {


    private Result() {
        put("code", 0);
        put("msg", "执行成功");
    }

    public static Result success() {
        Result result = new Result();

        return result;
    }

    public static Result fail() {
        Result result = new Result();
        result.put("code", 1);
        result.put("msg", "执行失败");
        return result;
    }

    public static Result success(Object data) {
        Result result = success();
        result.put("data", data);
        return result;
    }
}

