zoukankan      html  css  js  c++  java
  • ResultVO 返回前端实体类

    package com.aaa.controller.vm;

    import lombok.Data;

    import java.io.Serializable;

    /**

    • Created by cws

    • @author Administrator
      */
      @Data
      public class ResultVO implements Serializable {
      private static final long serialVersionUID = 1L;

      public static final Integer CODE = 0;

      private Integer code;

      private String msg;

      private Object result;

      public ResultVO() {

      }

      public ResultVO(Integer code) {
      this.code = code;
      }

      public ResultVO(Integer code, String msg) {
      this.code = code;
      this.msg = msg;
      }

      public ResultVO(Integer code, Object result) {
      this.code = code;
      this.result = result;
      }

      public ResultVO(Integer code, String msg, Object result) {
      this.code = code;
      this.msg = msg;
      this.result = result;
      }

      public ResultVO(Object result) {
      this.result = result;
      }

      public static ResultVO error() {
      return error(500, "未知异常,请联系管理员");
      }

      public static ResultVO error(String msg) {
      return error(500, msg);
      }

      public static ResultVO error(Integer code, String msg) {
      return new ResultVO(code, msg);
      }

      /**

      • 带通用返回数据
      • @param msg
      • @param result
      • @return
        */
        public static ResultVO ok(String msg, Object result) {
        return new ResultVO(CODE, msg, result);
        }

      /**

      • 不带数据
      • @param msg
      • @return
        */
        public static ResultVO ok(String msg) {
        return new ResultVO(CODE, msg);
        }

      /**

      • 带数据
      • @param result
      • @return
        */
        public static ResultVO ok(Object result) {
        return new ResultVO(CODE, result);
        }

      /**

      • 只带状态码
      • @return
        */
        public static ResultVO ok() {
        return new ResultVO(CODE);
        }
        }
  • 相关阅读:
    MVC设置默认页面
    MySQL_DBA整理
    解决git提交敏感信息(回退git版本库到某一个commit)
    并发数计算
    高并发下的 Nginx 优化与负载均衡
    PassengerNginxdebian快速部署Rails
    Linux+postfix+extmail+dovecot打造基于web页面的邮件系统
    2018.11.30软件更新公告
    2018.10.11软件更新公告
    2018.09.25软件更新公告
  • 原文地址:https://www.cnblogs.com/cwshuo/p/13885665.html
Copyright © 2011-2022 走看看