首页>代码>基于SpringBoot+Vue实现的学生宿舍管理系统>/最代码/服务端代码/springboot/src/main/java/com/example/springboot/common/Result.java
package com.example.springboot.common;


import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class Result<T> {
    private String code;
    private String msg;
    private T data;

    public Result(T data) {
        this.data = data;
    }

    public static Result success() {
        Result result = new Result<>();
        result.setCode("0");
        result.setMsg("成功");
        return result;
    }

    public static <T> Result<T> success(T data) {
        Result<T> result = new Result<>(data);
        result.setCode("0");
        result.setMsg("成功");
        result.setData(data);
        return result;
    }

    public static Result error(String code, String msg) {
        Result result = new Result<>();
        result.setCode(code);
        result.setMsg(msg);
        return result;
    }

}
最近下载更多
zhanghao943  LV2 4月12日
jc121140  LV3 3月29日
xiaozhi丶  LV14 3月24日
zolscy  LV12 3月24日
wanglinddad  LV54 3月3日
renyong  LV3 3月1日
zhengmianwei  LV3 2月22日
周青松  LV3 2月20日
taoshen95  LV14 2月18日
最近浏览更多
JQY123  LV3 5月5日
1941549176 4月29日
暂无贡献等级
slf123 4月29日
暂无贡献等级
sadselect  LV8 4月19日
qianhui1  LV3 4月18日
zhangtian1997  LV10 4月15日
zhanghao943  LV2 4月12日
IT小牛  LV3 4月11日
诺一啊啊啊啊啊  LV3 4月7日
dapeng0011  LV13 4月6日
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友