燕山石化溯源三维电子沙盘-【后端】-服务
1
13693261870
2024-11-13 2f55cebbad3dea187a5f91d16ec80a9677dab699
src/main/java/com/yssh/utils/Result.java
@@ -8,13 +8,6 @@
import java.io.Serializable;
/**
 * @author wMeng
 * @ClassName Result
 * @Description TODO
 * @date 2022/10/30 13:29
 * @Version 1.0
 */
@Data
@ApiModel(value = "通用结果集",description = "通用结果集")
public class Result<T> implements Serializable {
@@ -44,6 +37,9 @@
    @ApiModelProperty(value = "数据对象")
    private T result;
    @ApiModelProperty(value = "记录数")
    private Integer count = 0;
    /**
     * 时间戳
     */
@@ -72,7 +68,7 @@
    @Deprecated
    public static Result<Object> ok(String msg) {
        Result<Object> r = new Result<Object>();
        Result<Object> r = new Result<>();
        r.setSuccess(true);
        r.setCode(CommonConstant.SC_OK_200);
        r.setMessage(msg);
@@ -81,14 +77,21 @@
    @Deprecated
    public static Result<Object> ok(Object data) {
        Result<Object> r = new Result<Object>();
        Result<Object> r = new Result<>();
        r.setSuccess(true);
        r.setCode(CommonConstant.SC_OK_200);
        r.setResult(data);
        return r;
    }
    public static<T> Result<T> OK() {
    public static Result<Object> OK(Integer count, Object data) {
        Result<Object> r = ok(data);
        r.setCount(count);
        return r;
    }
    public static <T> Result<T> OK() {
        Result<T> r = new Result<T>();
        r.setSuccess(true);
        r.setCode(CommonConstant.SC_OK_200);
@@ -96,7 +99,7 @@
        return r;
    }
    public static<T> Result<T> OK(T data) {
    public static <T> Result<T> OK(T data) {
        Result<T> r = new Result<T>();
        r.setSuccess(true);
        r.setCode(CommonConstant.SC_OK_200);
@@ -104,7 +107,7 @@
        return r;
    }
    public static<T> Result<T> OK(String msg, T data) {
    public static <T> Result<T> OK(String msg, T data) {
        Result<T> r = new Result<T>();
        r.setSuccess(true);
        r.setCode(CommonConstant.SC_OK_200);
@@ -113,7 +116,7 @@
        return r;
    }
    public static<T> Result<T> error(String msg, T data) {
    public static <T> Result<T> error(String msg, T data) {
        Result<T> r = new Result<T>();
        r.setSuccess(false);
        r.setCode(CommonConstant.SC_INTERNAL_SERVER_ERROR_500);
@@ -140,6 +143,7 @@
        this.success = false;
        return this;
    }
    /**
     * 无权限访问返回结果
     */
@@ -147,8 +151,51 @@
        return error(CommonConstant.SC_JEECG_NO_AUTHZ, msg);
    }
    @JsonIgnore
    private String onlTable;
    public boolean isSuccess() {
        return success;
    }
    public void setSuccess(boolean success) {
        this.success = success;
    }
    public String getMessage() {
        return message;
    }
    public void setMessage(String message) {
        this.message = message;
    }
    public Integer getCode() {
        return code;
    }
    public void setCode(Integer code) {
        this.code = code;
    }
    public T getResult() {
        return result;
    }
    public void setResult(T result) {
        this.result = result;
    }
    public Integer getCount() {
        return count;
    }
    public void setCount(Integer count) {
        this.count = count;
    }
    public long getTimestamp() {
        return timestamp;
    }
    public void setTimestamp(long timestamp) {
        this.timestamp = timestamp;
    }
}