k.e.book.common.utils.RespBean Maven / Gradle / Ivy
package k.e.book.common.utils;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class RespBean {
private Integer code;
private String msg;
private T data;
public static RespBean build() {
return new RespBean();
}
public static RespBean ok(String msg, T data) {
return new RespBean(200, msg, data);
}
public static RespBean ok(String msg) {
return new RespBean(200, msg, null);
}
public static RespBean error(String msg, T data) {
return new RespBean(500, msg, data);
}
public static RespBean error(String msg) {
return new RespBean(500, msg, null);
}
}