首页>代码>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;
	}
	
	
}
最近下载更多
xiaoaitx  LV8 1月1日
TY0165  LV20 2024年6月18日
爱吃红薯的金狸  LV2 2024年4月12日
HANCW  LV9 2024年3月11日
李亮  LV19 2023年8月28日
hedyyy  LV3 2023年6月19日
LITIANYU084414  LV11 2023年1月1日
wanglinddad  LV55 2022年12月8日
jlmarket  LV22 2022年12月2日
sczyhtg  LV5 2022年10月19日
最近浏览更多
叉烧君  LV3 3月26日
哪里的完整版  LV8 3月1日
xiaoaitx  LV8 1月1日
ma406805131  LV19 2024年12月18日
krispeng  LV14 2024年11月24日
bluerstar  LV1 2024年10月21日
782325418 2024年10月14日
暂无贡献等级
Peny_ZH  LV5 2024年9月21日
微信网友_7151914139078656  LV2 2024年9月4日
897258976  LV8 2024年8月29日
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友