首页>代码>ssm整合bootstrap开发网站用户信息管理系统(增删改查)>/ManagementSystem/src/main/Java/com/wrq/manage/common/Msg.java
package com.wrq.manage.common;

/**
 * Created by 王乾 on 2018/1/9.
 */

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

/**
 * 返回json通用的数据
 */
public class Msg {
    //状态码 100-成功 200-失败
    private int code;

    //提示信息
    private String msg;

    //用户要返回给浏览器的数据
    private Map<String,Object> data = 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.getData().put(key,value);
        return this;
    }


    public int getCode() {
        return code;
    }

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

    public Map<String, Object> getData() {
        return data;
    }

    public void setData(Map<String, Object> data) {
        this.data = data;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }
}
最近下载更多
李亮  LV19 2023年3月5日
梓柔12345  LV1 2023年1月4日
最代码-宋家辉  LV61 2023年1月2日
mikyfx  LV4 2022年11月30日
MaiMaiMaimei  LV7 2022年6月28日
second  LV5 2021年12月5日
1308530161  LV4 2021年12月1日
543666826  LV33 2021年11月18日
38735466  LV11 2021年8月19日
tutuhero  LV8 2021年5月13日
最近浏览更多
WBelong  LV7 3月8日
暂无贡献等级
black8angel  LV4 2023年12月22日
1914539700  LV1 2023年12月12日
DilotXYY  LV1 2023年12月11日
shuangfu  LV24 2023年12月2日
gsr19960422  LV1 2023年12月2日
fff2003  LV6 2023年11月18日
sunshine9920  LV12 2023年11月6日
政政123456  LV3 2023年10月22日
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友