首页>代码>SSM+bootstrap员工部门经典demo开发实例>/ssm-crud/src/main/java/com/atguigu/crud/bean/Msg.java
package com.atguigu.crud.bean;

import java.util.HashMap;
import java.util.Map;

/**
 * 通用的返回的类
 * 
 * @author lfy
 * 
 */
public class Msg {
	//状态码   100-成功    200-失败
	private int code;
	//提示信息
	private String msg;
	
	//用户要返回给浏览器的数据
	private Map<String, Object> extend = new HashMap<String, Object>();

	public static Msg success(){
		Msg result = new Msg();
		result.setCode(100);
		result.setMsg("处理成功!");
		return result;
	}
	
	public static Msg fail(){
		Msg result = new Msg();
		result.setCode(200);
		result.setMsg("处理失败!");
		return result;
	}
	
	public Msg add(String key,Object value){
		this.getExtend().put(key, value);
		return this;
	}
	
	public int getCode() {
		return code;
	}

	public void setCode(int code) {
		this.code = code;
	}

	public String getMsg() {
		return msg;
	}

	public void setMsg(String msg) {
		this.msg = msg;
	}

	public Map<String, Object> getExtend() {
		return extend;
	}

	public void setExtend(Map<String, Object> extend) {
		this.extend = extend;
	}
	
	
}
最近下载更多
爱吃红薯的金狸  LV2 4月12日
HANCW  LV8 3月11日
李亮  LV19 2023年8月28日
donnyine  LV3 2023年6月19日
LITIANYU084414  LV11 2023年1月1日
wanglinddad  LV54 2022年12月8日
jlmarket  LV22 2022年12月2日
sczyhtg  LV5 2022年10月19日
dragon Sir  LV3 2022年4月26日
zhizu123  LV1 2022年4月13日
最近浏览更多
爱吃红薯的金狸  LV2 4月12日
zolscy  LV12 4月1日
2131234536546  LV7 3月31日
HANCW  LV8 3月11日
WBelong  LV7 2023年12月25日
哈哈ha zhh  LV2 2023年11月16日
kisooo 2023年11月8日
暂无贡献等级
内心向阳  LV4 2023年11月7日
liuxiao2  LV16 2023年10月25日
jiemomo  LV12 2023年10月19日
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友