package com.liang.common.utils;

import lombok.Data;

/**
 * @Author ly 定义返回类型
 * @Date 2024/11/3 21:10
 * @Version 1.0
 */
@Data
public class ResponseData {  

    private int code;
    private String message;
    private Object data;

    // 构造方法、getter和setter等

    public static ResponseData success(String message) {
        ResponseData responseData = new ResponseData();
        responseData.setCode(0);
        responseData.setMessage(message);
        return responseData;
    }

    public static ResponseData failure(int code, String message) {
        ResponseData responseData = new ResponseData();
        responseData.setCode(code);
        responseData.setMessage(message);
        return responseData;
    }

}
