
package org.springblade.message.model;

import java.io.Serializable;

import lombok.AllArgsConstructor;
import lombok.Data;

/**
 * 消息返回集合
 *
 * @author 
 */
@Data
@AllArgsConstructor
public class MsgResponse implements Serializable {

	private static final long serialVersionUID = 1L;

	/**
	 * 是否成功
	 */
	private boolean success;

	/**
	 * 状态码
	 */
	private Integer code;

	/**
	 * 返回消息
	 */
	private String msg;
	
	/**
	 * 
	 * @param msg
	 * @return
	 */
	public static MsgResponse failure(String msg) {
		return new MsgResponse(false, 500, msg);
	}

	/**
	 * 
	 * @param code
	 * @param msg
	 * @return
	 */
	public static MsgResponse success(Integer code, String msg) {
		return new MsgResponse(true, code, msg);
	}
	
}
