此工具类包含了基础的响应信息。
package com.zkdj.applet.common;import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;/*** 类描述 -> 响应结果工具类** @Author: ywz* @Date: 2024/09/17*/
@Data
@AllArgsConstructor
@ApiModel(description = "响应结果")
public class ResultResp {@ApiModelProperty(value = "响应码")private Integer code;@ApiModelProperty(value = "响应信息")private String msg;@ApiModelProperty(value = "响应数据")private Object data;private static final int SUCCESS_CODE = 200;private static final int ERROR_CODE = 500;public static ResultResp success() {return new ResultResp(SUCCESS_CODE, "成功", null);}public static ResultResp success(Object data) {return new ResultResp(SUCCESS_CODE, "成功", data);}public static ResultResp error() {return new ResultResp(ERROR_CODE, "失败", null);}public static ResultResp error(Object data) {return new ResultResp(ERROR_CODE, "失败", data);}
}