Files
usdt/luqj-common/src/main/java/com/luqj/common/domain/RedisKey.java
T
2025-12-02 23:07:47 +08:00

75 lines
1.7 KiB
Java

package com.luqj.common.domain;
import com.ruoyi.common.utils.StringUtils;
import java.math.BigDecimal;
import java.util.Date;
public class RedisKey {
private StringBuffer stringBuffer = new StringBuffer("");
public RedisKey() {
}
public RedisKey(String key) {
stringBuffer = new StringBuffer(key);
}
public RedisKey add(String key) {
if (StringUtils.isNotBlank(key)) {
stringBuffer.append(key).append("_");
} else {
stringBuffer.append("NULL_");
}
return this;
}
public RedisKey add(BigDecimal key) {
if (key != null) {
stringBuffer.append(key).append("_");
} else {
stringBuffer.append("NULL_");
}
return this;
}
public RedisKey add(Boolean key) {
if (key != null) {
stringBuffer.append(key).append("_");
} else {
stringBuffer.append("NULL_");
}
return this;
}
public RedisKey add(Long key) {
if (key != null) {
stringBuffer.append(key).append("_");
} else {
stringBuffer.append("NULL_");
}
return this;
}
public RedisKey add(Date key) {
if (key != null) {
stringBuffer.append(key.getTime()).append("_");
} else {
stringBuffer.append("_NULL");
}
return this;
}
public RedisKey add(Integer key) {
if (key != null) {
stringBuffer.append(key).append("_");
} else {
stringBuffer.append("_NULL");
}
return this;
}
public String key() {
return this.stringBuffer.toString();
}
}