package com.nova.sankuai.domain.api.yangqianguan; import io.swagger.annotations.ApiModelProperty; import lombok.Data; /** * @Description: 洋钱罐响应类 * @Author: Very * @Date: 2022/4/24 19:58 */ @Data public class MoneyPotResultJson { private static final long serialVersionUID = 783015033603078674L; @ApiModelProperty(value = "返回代码") private int code; @ApiModelProperty(value = "返回处理消息") private String message; @ApiModelProperty(value = "返回数据对象") private T data; /** * 成功 * * @param * @return */ public static MoneyPotResultJson success() { MoneyPotResultJson moneyPotResultJson = new MoneyPotResultJson<>(); moneyPotResultJson.setCode(0); moneyPotResultJson.setMessage("ok"); return moneyPotResultJson; } /** * 成功 * * @param * @return */ public static MoneyPotResultJson success(T data) { MoneyPotResultJson moneyPotResultJson = new MoneyPotResultJson<>(); moneyPotResultJson.setCode(0); moneyPotResultJson.setMessage("OK"); moneyPotResultJson.setData(data); return moneyPotResultJson; } /** * 失败 * * @param * @return */ public static MoneyPotResultJson error(int code, String msg) { MoneyPotResultJson moneyPotResultJson = new MoneyPotResultJson<>(); moneyPotResultJson.setCode(code); moneyPotResultJson.setMessage(msg); return moneyPotResultJson; } @Override public String toString() { return "{" + "\"code\":" + code + ", \"msg\":\"" + message + '\"' + ", \"data\":\"" + data + '\"' + '}'; } }