浏览代码

update 常量类 接口化

疯狂的狮子li 3 年之前
父节点
当前提交
5322f5f707

+ 27 - 26
ruoyi-common/src/main/java/com/ruoyi/common/constant/Constants.java

@@ -6,130 +6,131 @@ package com.ruoyi.common.constant;
  *
  * @author ruoyi
  */
-public class Constants {
+public interface Constants {
+
     /**
      * UTF-8 字符集
      */
-    public static final String UTF8 = "UTF-8";
+    String UTF8 = "UTF-8";
 
     /**
      * GBK 字符集
      */
-    public static final String GBK = "GBK";
+    String GBK = "GBK";
 
     /**
      * http请求
      */
-    public static final String HTTP = "http://";
+    String HTTP = "http://";
 
     /**
      * https请求
      */
-    public static final String HTTPS = "https://";
+    String HTTPS = "https://";
 
     /**
      * 通用成功标识
      */
-    public static final String SUCCESS = "0";
+    String SUCCESS = "0";
 
     /**
      * 通用失败标识
      */
-    public static final String FAIL = "1";
+    String FAIL = "1";
 
     /**
      * 登录成功
      */
-    public static final String LOGIN_SUCCESS = "Success";
+    String LOGIN_SUCCESS = "Success";
 
     /**
      * 注销
      */
-    public static final String LOGOUT = "Logout";
+    String LOGOUT = "Logout";
 
     /**
      * 注册
      */
-    public static final String REGISTER = "Register";
+    String REGISTER = "Register";
 
     /**
      * 登录失败
      */
-    public static final String LOGIN_FAIL = "Error";
+    String LOGIN_FAIL = "Error";
 
     /**
      * 验证码 redis key
      */
-    public static final String CAPTCHA_CODE_KEY = "captcha_codes:";
+    String CAPTCHA_CODE_KEY = "captcha_codes:";
 
     /**
      * 登录用户 redis key
      */
-    public static final String LOGIN_TOKEN_KEY = "login_tokens:";
+    String LOGIN_TOKEN_KEY = "login_tokens:";
 
     /**
      * 防重提交 redis key
      */
-    public static final String REPEAT_SUBMIT_KEY = "repeat_submit:";
+    String REPEAT_SUBMIT_KEY = "repeat_submit:";
 
     /**
      * 限流 redis key
      */
-    public static final String RATE_LIMIT_KEY = "rate_limit:";
+    String RATE_LIMIT_KEY = "rate_limit:";
 
     /**
      * 验证码有效期(分钟)
      */
-    public static final Integer CAPTCHA_EXPIRATION = 2;
+    Integer CAPTCHA_EXPIRATION = 2;
 
     /**
      * 令牌
      */
-    public static final String TOKEN = "token";
+    String TOKEN = "token";
 
     /**
      * 令牌前缀
      */
-    public static final String TOKEN_PREFIX = "Bearer ";
+    String TOKEN_PREFIX = "Bearer ";
 
     /**
      * 令牌前缀
      */
-    public static final String LOGIN_USER_KEY = "login_user_key";
+    String LOGIN_USER_KEY = "login_user_key";
 
     /**
      * 用户ID
      */
-    public static final String JWT_USERID = "userid";
+    String JWT_USERID = "userid";
 
     /**
      * 用户名称
      */
-    public static final String JWT_USERNAME = "sub";
+    String JWT_USERNAME = "sub";
 
     /**
      * 用户头像
      */
-    public static final String JWT_AVATAR = "avatar";
+    String JWT_AVATAR = "avatar";
 
     /**
      * 创建时间
      */
-    public static final String JWT_CREATED = "created";
+    String JWT_CREATED = "created";
 
     /**
      * 用户权限
      */
-    public static final String JWT_AUTHORITIES = "authorities";
+    String JWT_AUTHORITIES = "authorities";
 
     /**
      * 参数管理 cache key
      */
-    public static final String SYS_CONFIG_KEY = "sys_config:";
+    String SYS_CONFIG_KEY = "sys_config:";
 
     /**
      * 字典管理 cache key
      */
-    public static final String SYS_DICT_KEY = "sys_dict:";
+    String SYS_DICT_KEY = "sys_dict:";
 
 }

+ 41 - 41
ruoyi-common/src/main/java/com/ruoyi/common/constant/GenConstants.java

@@ -5,184 +5,184 @@ package com.ruoyi.common.constant;
  *
  * @author ruoyi
  */
-public class GenConstants {
+public interface GenConstants {
     /**
      * 单表(增删改查)
      */
-    public static final String TPL_CRUD = "crud";
+    String TPL_CRUD = "crud";
 
     /**
      * 树表(增删改查)
      */
-    public static final String TPL_TREE = "tree";
+    String TPL_TREE = "tree";
 
     /**
      * 主子表(增删改查)
      */
-    public static final String TPL_SUB = "sub";
+    String TPL_SUB = "sub";
 
     /**
      * 树编码字段
      */
-    public static final String TREE_CODE = "treeCode";
+    String TREE_CODE = "treeCode";
 
     /**
      * 树父编码字段
      */
-    public static final String TREE_PARENT_CODE = "treeParentCode";
+    String TREE_PARENT_CODE = "treeParentCode";
 
     /**
      * 树名称字段
      */
-    public static final String TREE_NAME = "treeName";
+    String TREE_NAME = "treeName";
 
     /**
      * 上级菜单ID字段
      */
-    public static final String PARENT_MENU_ID = "parentMenuId";
+    String PARENT_MENU_ID = "parentMenuId";
 
     /**
      * 上级菜单名称字段
      */
-    public static final String PARENT_MENU_NAME = "parentMenuName";
+    String PARENT_MENU_NAME = "parentMenuName";
 
     /**
      * 数据库字符串类型
      */
-    public static final String[] COLUMNTYPE_STR = {"char", "varchar", "nvarchar", "varchar2"};
+    String[] COLUMNTYPE_STR = {"char", "varchar", "nvarchar", "varchar2"};
 
     /**
      * 数据库文本类型
      */
-    public static final String[] COLUMNTYPE_TEXT = {"tinytext", "text", "mediumtext", "longtext"};
+    String[] COLUMNTYPE_TEXT = {"tinytext", "text", "mediumtext", "longtext"};
 
     /**
      * 数据库时间类型
      */
-    public static final String[] COLUMNTYPE_TIME = {"datetime", "time", "date", "timestamp"};
+    String[] COLUMNTYPE_TIME = {"datetime", "time", "date", "timestamp"};
 
     /**
      * 数据库数字类型
      */
-    public static final String[] COLUMNTYPE_NUMBER = {"tinyint", "smallint", "mediumint", "int", "number", "integer",
-            "bit", "bigint", "float", "double", "decimal"};
+    String[] COLUMNTYPE_NUMBER = {"tinyint", "smallint", "mediumint", "int", "number", "integer",
+        "bit", "bigint", "float", "double", "decimal"};
 
     /**
      * BO对象 不需要添加字段
      */
-    public static final String[] COLUMNNAME_NOT_ADD = {"create_by", "create_time", "del_flag", "update_by",
-            "update_time", "version"};
+    String[] COLUMNNAME_NOT_ADD = {"create_by", "create_time", "del_flag", "update_by",
+        "update_time", "version"};
 
     /**
      * BO对象 不需要编辑字段
      */
-    public static final String[] COLUMNNAME_NOT_EDIT = {"create_by", "create_time", "del_flag", "update_by",
-            "update_time", "version"};
+    String[] COLUMNNAME_NOT_EDIT = {"create_by", "create_time", "del_flag", "update_by",
+        "update_time", "version"};
 
     /**
      * VO对象 不需要返回字段
      */
-    public static final String[] COLUMNNAME_NOT_LIST = {"create_by", "create_time", "del_flag", "update_by",
-            "update_time", "version"};
+    String[] COLUMNNAME_NOT_LIST = {"create_by", "create_time", "del_flag", "update_by",
+        "update_time", "version"};
 
     /**
      * BO对象 不需要查询字段
      */
-    public static final String[] COLUMNNAME_NOT_QUERY = {"id", "create_by", "create_time", "del_flag", "update_by",
-            "update_time", "remark", "version"};
+    String[] COLUMNNAME_NOT_QUERY = {"id", "create_by", "create_time", "del_flag", "update_by",
+        "update_time", "remark", "version"};
 
     /**
      * Entity基类字段
      */
-    public static final String[] BASE_ENTITY = {"createBy", "createTime", "updateBy", "updateTime"};
+    String[] BASE_ENTITY = {"createBy", "createTime", "updateBy", "updateTime"};
 
     /**
      * Tree基类字段
      */
-    public static final String[] TREE_ENTITY = {"parentName", "parentId", "children"};
+    String[] TREE_ENTITY = {"parentName", "parentId", "children"};
 
     /**
      * 文本框
      */
-    public static final String HTML_INPUT = "input";
+    String HTML_INPUT = "input";
 
     /**
      * 文本域
      */
-    public static final String HTML_TEXTAREA = "textarea";
+    String HTML_TEXTAREA = "textarea";
 
     /**
      * 下拉框
      */
-    public static final String HTML_SELECT = "select";
+    String HTML_SELECT = "select";
 
     /**
      * 单选框
      */
-    public static final String HTML_RADIO = "radio";
+    String HTML_RADIO = "radio";
 
     /**
      * 复选框
      */
-    public static final String HTML_CHECKBOX = "checkbox";
+    String HTML_CHECKBOX = "checkbox";
 
     /**
      * 日期控件
      */
-    public static final String HTML_DATETIME = "datetime";
+    String HTML_DATETIME = "datetime";
 
     /**
      * 图片上传控件
      */
-    public static final String HTML_IMAGE_UPLOAD = "imageUpload";
+    String HTML_IMAGE_UPLOAD = "imageUpload";
 
     /**
      * 文件上传控件
      */
-    public static final String HTML_FILE_UPLOAD = "fileUpload";
+    String HTML_FILE_UPLOAD = "fileUpload";
 
     /**
      * 富文本控件
      */
-    public static final String HTML_EDITOR = "editor";
+    String HTML_EDITOR = "editor";
 
     /**
      * 字符串类型
      */
-    public static final String TYPE_STRING = "String";
+    String TYPE_STRING = "String";
 
     /**
      * 整型
      */
-    public static final String TYPE_INTEGER = "Integer";
+    String TYPE_INTEGER = "Integer";
 
     /**
      * 长整型
      */
-    public static final String TYPE_LONG = "Long";
+    String TYPE_LONG = "Long";
 
     /**
      * 浮点型
      */
-    public static final String TYPE_DOUBLE = "Double";
+    String TYPE_DOUBLE = "Double";
 
     /**
      * 高精度计算类型
      */
-    public static final String TYPE_BIGDECIMAL = "BigDecimal";
+    String TYPE_BIGDECIMAL = "BigDecimal";
 
     /**
      * 时间类型
      */
-    public static final String TYPE_DATE = "Date";
+    String TYPE_DATE = "Date";
 
     /**
      * 模糊查询
      */
-    public static final String QUERY_LIKE = "LIKE";
+    String QUERY_LIKE = "LIKE";
 
     /**
      * 需要
      */
-    public static final String REQUIRE = "1";
+    String REQUIRE = "1";
 }

+ 24 - 24
ruoyi-common/src/main/java/com/ruoyi/common/constant/UserConstants.java

@@ -5,108 +5,108 @@ package com.ruoyi.common.constant;
  *
  * @author ruoyi
  */
-public class UserConstants {
+public interface UserConstants {
 
     /**
      * 平台内系统用户的唯一标志
      */
-    public static final String SYS_USER = "SYS_USER";
+    String SYS_USER = "SYS_USER";
 
     /**
      * 正常状态
      */
-    public static final String NORMAL = "0";
+    String NORMAL = "0";
 
     /**
      * 异常状态
      */
-    public static final String EXCEPTION = "1";
+    String EXCEPTION = "1";
 
     /**
      * 用户封禁状态
      */
-    public static final String USER_DISABLE = "1";
+    String USER_DISABLE = "1";
 
     /**
      * 角色封禁状态
      */
-    public static final String ROLE_DISABLE = "1";
+    String ROLE_DISABLE = "1";
 
     /**
      * 部门正常状态
      */
-    public static final String DEPT_NORMAL = "0";
+    String DEPT_NORMAL = "0";
 
     /**
      * 部门停用状态
      */
-    public static final String DEPT_DISABLE = "1";
+    String DEPT_DISABLE = "1";
 
     /**
      * 字典正常状态
      */
-    public static final String DICT_NORMAL = "0";
+    String DICT_NORMAL = "0";
 
     /**
      * 是否为系统默认(是)
      */
-    public static final String YES = "Y";
+    String YES = "Y";
 
     /**
      * 是否菜单外链(是)
      */
-    public static final String YES_FRAME = "0";
+    String YES_FRAME = "0";
 
     /**
      * 是否菜单外链(否)
      */
-    public static final String NO_FRAME = "1";
+    String NO_FRAME = "1";
 
     /**
      * 菜单类型(目录)
      */
-    public static final String TYPE_DIR = "M";
+    String TYPE_DIR = "M";
 
     /**
      * 菜单类型(菜单)
      */
-    public static final String TYPE_MENU = "C";
+    String TYPE_MENU = "C";
 
     /**
      * 菜单类型(按钮)
      */
-    public static final String TYPE_BUTTON = "F";
+    String TYPE_BUTTON = "F";
 
     /**
      * Layout组件标识
      */
-    public final static String LAYOUT = "Layout";
+    String LAYOUT = "Layout";
 
     /**
      * ParentView组件标识
      */
-    public final static String PARENT_VIEW = "ParentView";
+    String PARENT_VIEW = "ParentView";
 
     /**
      * InnerLink组件标识
      */
-    public final static String INNER_LINK = "InnerLink";
+    String INNER_LINK = "InnerLink";
 
     /**
      * 校验返回结果码
      */
-    public final static String UNIQUE = "0";
-    public final static String NOT_UNIQUE = "1";
+    String UNIQUE = "0";
+    String NOT_UNIQUE = "1";
 
     /**
      * 用户名长度限制
      */
-    public static final int USERNAME_MIN_LENGTH = 2;
-    public static final int USERNAME_MAX_LENGTH = 20;
+    int USERNAME_MIN_LENGTH = 2;
+    int USERNAME_MAX_LENGTH = 20;
 
     /**
      * 密码长度限制
      */
-    public static final int PASSWORD_MIN_LENGTH = 5;
-    public static final int PASSWORD_MAX_LENGTH = 20;
+    int PASSWORD_MIN_LENGTH = 5;
+    int PASSWORD_MAX_LENGTH = 20;
 }