|
|
@@ -1,35 +0,0 @@
|
|
|
-package cn.reghao.tnb.content.app.util;
|
|
|
-
|
|
|
-import cn.reghao.jutil.jdk.id.SnowFlake;
|
|
|
-import org.springframework.stereotype.Component;
|
|
|
-
|
|
|
-import java.util.UUID;
|
|
|
-
|
|
|
-/**
|
|
|
- * ID 生成服务
|
|
|
- *
|
|
|
- * @author reghao
|
|
|
- * @date 2025-09-05 17:07:53
|
|
|
- */
|
|
|
-@Component
|
|
|
-public class IdService {
|
|
|
- private final SnowFlake idGenerator;
|
|
|
- private int dcId = 1;
|
|
|
- private int machineId = 1;
|
|
|
-
|
|
|
- public IdService() {
|
|
|
- this.idGenerator = new SnowFlake(dcId, machineId);
|
|
|
- }
|
|
|
-
|
|
|
- public long getLongId() {
|
|
|
- return idGenerator.nextId();
|
|
|
- }
|
|
|
-
|
|
|
- public String getStringId() {
|
|
|
- return null;
|
|
|
- }
|
|
|
-
|
|
|
- public String getFileId() {
|
|
|
- return UUID.randomUUID().toString().replace("-", "");
|
|
|
- }
|
|
|
-}
|