package com.bicloud.common.result;

import lombok.Data;
import java.io.Serializable; // 1. 导入Serializable包

@Data
public class Result<T> implements Serializable {
    // 注意：添加序列化版本号
    private static final long serialVersionUID = 1L;

    private Integer code; // 200成功，500失败
    private String msg;
    private T data;

    // 原有方法完全保留
    public static <T> Result<T> success(T data) {
        Result<T> result = new Result<>();
        result.setCode(200);
        result.setMsg("操作成功");
        result.setData(data);
        return result;
    }

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