mirror of
https://gitee.com/dromara/RuoYi-Vue-Plus.git
synced 2026-09-18 17:38:48 +08:00
update 优化发号器工具类删除前缀
This commit is contained in:
parent
7cd9c4b4e0
commit
4ef13cb9b4
@ -67,7 +67,7 @@ public class SequenceUtils {
|
|||||||
initValue = (initValue == null || initValue <= 0) ? DEFAULT_INIT_VALUE : initValue;
|
initValue = (initValue == null || initValue <= 0) ? DEFAULT_INIT_VALUE : initValue;
|
||||||
stepValue = (stepValue == null || stepValue <= 0) ? DEFAULT_STEP_VALUE : stepValue;
|
stepValue = (stepValue == null || stepValue <= 0) ? DEFAULT_STEP_VALUE : stepValue;
|
||||||
|
|
||||||
RIdGenerator idGenerator = REDISSON_CLIENT.getIdGenerator(key);
|
RIdGenerator idGenerator = REDISSON_CLIENT.getIdGenerator(DEFAULT_PREFIX + key);
|
||||||
try {
|
try {
|
||||||
// 初始化成功后设置过期时间,避免多线程反复设置
|
// 初始化成功后设置过期时间,避免多线程反复设置
|
||||||
if (idGenerator.tryInit(initValue, stepValue)) {
|
if (idGenerator.tryInit(initValue, stepValue)) {
|
||||||
@ -84,7 +84,7 @@ public class SequenceUtils {
|
|||||||
* 构建标准的业务 key:加上默认前缀
|
* 构建标准的业务 key:加上默认前缀
|
||||||
*/
|
*/
|
||||||
private static String generateKey(String prefix, String suffix) {
|
private static String generateKey(String prefix, String suffix) {
|
||||||
return StringUtils.format("{}{}{}", DEFAULT_PREFIX, StringUtils.blankToDefault(prefix, ""), suffix);
|
return StringUtils.format("{}{}", StringUtils.blankToDefault(prefix, ""), suffix);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user