优化:基于阿里巴巴 Java 开发手册(黄山版)优化常量

1.编程规约>常量定义>第1条:
【强制】不允许任何魔法值(即未经预先定义的常量)直接出现在代码中。
This commit is contained in:
2023-03-04 14:35:45 +08:00
parent c4d9bd3a75
commit 89a327920e
11 changed files with 65 additions and 26 deletions

View File

@@ -19,16 +19,16 @@ package top.charles7c.cnadmin.common.constant;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
import cn.hutool.core.text.CharPool;
import cn.hutool.core.text.StrPool;
/**
* 字符相关常量
* 字符相关常量
*
* @author Charles7c
* @since 2023/2/10 20:14
*/
@NoArgsConstructor(access = AccessLevel.PRIVATE)
public class CharConsts implements CharPool {
public class StringConsts implements StrPool {
/**
* 分号
@@ -39,4 +39,29 @@ public class CharConsts implements CharPool {
* 空字符串
*/
public static final String EMPTY = "";
/**
* 标准日期时间格式
*/
public static final String NORM_DATE_TIME_PATTERN = "yyyy-MM-dd HH:mm:ss";
/**
* 标准日期时间格式紧凑
*/
public static final String PURE_DATE_TIME_PATTERN = "yyyyMMddHHmmss";
/**
* 标准日期时间格式紧凑带毫秒
*/
public static final String PURE_DATE_TIME_MS_PATTERN = "yyyyMMddHHmmssSSS";
/**
* 标准日期格式
*/
public static final String NORM_DATE_PATTERN = "yyyy-MM-dd";
/**
* 标准时间格式
*/
public static final String NORM_TIME_PATTERN = "HH:mm:ss";
}

View File

@@ -42,4 +42,14 @@ public class SysConsts {
* 默认密码
*/
public static final String DEFAULT_PASSWORD = "123456";
/**
* 登录 URI
*/
public static final String LOGIN_URI = "/auth/login";
/**
* 退出登录 URI
*/
public static final String LOGOUT_URI = "/auth/logout";
}