123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- package com.diagbot.dto;
- import java.io.Serializable;
- /**
- * @Description: 通用返回格式
- * @author: gaodm
- * @time: 2018/8/1 14:55
- */
- public class RespDTO<T> implements Serializable {
- public String code = "0";
- public String msg = "";
- public T data;
- public static RespDTO onSuc(Object data) {
- RespDTO resp = new RespDTO();
- resp.data = data;
- return resp;
- }
- public static RespDTO onSucBoth(String code,String msg,Object data) {
- RespDTO resp = new RespDTO();
- resp.code = code;
- resp.msg = msg;
- resp.data = data;
- return resp;
- }
- public static RespDTO onError(String errMsg) {
- RespDTO resp = new RespDTO();
- resp.code = "-1";
- resp.msg = errMsg;
- return resp;
- }
- @Override
- public String toString() {
- return "RespDTO{" +
- "code='" + code + '\'' +
- ", msg='" + msg + '\'' +
- ", data=" + data +
- '}';
- }
- }
|