xiejun
2024-11-01 80b6cbfc9c861469146318d0b3dd5f8b8b525b8a
Source/BladeX-Tool/blade-core-tool/src/main/java/org/springblade/core/tool/api/ResultCode.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,113 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill åº„骞 (smallchill@163.com)
 */
package org.springblade.core.tool.api;
import lombok.AllArgsConstructor;
import lombok.Getter;
import javax.servlet.http.HttpServletResponse;
/**
 * ä¸šåŠ¡ä»£ç æžšä¸¾
 *
 * @author Chill
 */
@Getter
@AllArgsConstructor
public enum ResultCode implements IResultCode {
   /**
    * æ“ä½œæˆåŠŸ
    */
   SUCCESS(HttpServletResponse.SC_OK, "操作成功"),
   /**
    * ä¸šåС异叏
    */
   FAILURE(HttpServletResponse.SC_BAD_REQUEST, "业务异常"),
   /**
    * è¯·æ±‚未授权
    */
   UN_AUTHORIZED(HttpServletResponse.SC_UNAUTHORIZED, "请求未授权"),
   /**
    * å®¢æˆ·ç«¯è¯·æ±‚未授权
    */
   CLIENT_UN_AUTHORIZED(HttpServletResponse.SC_UNAUTHORIZED, "客户端请求未授权"),
   /**
    * 404 æ²¡æ‰¾åˆ°è¯·æ±‚
    */
   NOT_FOUND(HttpServletResponse.SC_NOT_FOUND, "404 æ²¡æ‰¾åˆ°è¯·æ±‚"),
   /**
    * æ¶ˆæ¯ä¸èƒ½è¯»å–
    */
   MSG_NOT_READABLE(HttpServletResponse.SC_BAD_REQUEST, "消息不能读取"),
   /**
    * ä¸æ”¯æŒå½“前请求方法
    */
   METHOD_NOT_SUPPORTED(HttpServletResponse.SC_METHOD_NOT_ALLOWED, "不支持当前请求方法"),
   /**
    * ä¸æ”¯æŒå½“前媒体类型
    */
   MEDIA_TYPE_NOT_SUPPORTED(HttpServletResponse.SC_UNSUPPORTED_MEDIA_TYPE, "不支持当前媒体类型"),
   /**
    * è¯·æ±‚被拒绝
    */
   REQ_REJECT(HttpServletResponse.SC_FORBIDDEN, "请求被拒绝"),
   /**
    * æœåС噍异叏
    */
   INTERNAL_SERVER_ERROR(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "服务器异常"),
   /**
    * ç¼ºå°‘必要的请求参数
    */
   PARAM_MISS(HttpServletResponse.SC_BAD_REQUEST, "缺少必要的请求参数"),
   /**
    * è¯·æ±‚参数类型错误
    */
   PARAM_TYPE_ERROR(HttpServletResponse.SC_BAD_REQUEST, "请求参数类型错误"),
   /**
    * è¯·æ±‚参数绑定错误
    */
   PARAM_BIND_ERROR(HttpServletResponse.SC_BAD_REQUEST, "请求参数绑定错误"),
   /**
    * å‚数校验失败
    */
   PARAM_VALID_ERROR(HttpServletResponse.SC_BAD_REQUEST, "参数校验失败"),
   ;
   /**
    * code编码
    */
   final int code;
   /**
    * ä¸­æ–‡ä¿¡æ¯æè¿°
    */
   final String message;
}