Files
gitea-test/src/main/java/cn/rensijin/cchs/util/IdUtils.java
2026-01-02 10:08:57 +08:00

58 lines
1.2 KiB
Java
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package cn.rensijin.cchs.util;
import cn.hutool.core.lang.UUID;
import org.apache.commons.lang3.StringUtils;
/**
* ID生成器工具类
*/
public class IdUtils {
/**
* 功能说明 获取随机UUID数去掉了 -
*/
public static String getSimpleUUID() {
return StringUtils.replace(java.util.UUID.randomUUID().toString(), "-", "");
}
/**
* 获取随机UUID
*
* @return 随机UUID
*/
public static String randomUUID()
{
return UUID.randomUUID().toString();
}
/**
* 简化的UUID去掉了横线
*
* @return 简化的UUID去掉了横线
*/
public static String simpleUUID()
{
return UUID.randomUUID().toString(true);
}
/**
* 获取随机UUID使用性能更好的ThreadLocalRandom生成UUID
*
* @return 随机UUID
*/
public static String fastUUID()
{
return UUID.fastUUID().toString();
}
/**
* 简化的UUID去掉了横线使用性能更好的ThreadLocalRandom生成UUID
*
* @return 简化的UUID去掉了横线
*/
public static String fastSimpleUUID()
{
return UUID.fastUUID().toString(true);
}
}